From b4db0e08e652a3ff72f3c16a5e738b83d88c2317 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sat, 9 Jul 2005 19:35:14 +0300 Subject: [PATCH] imported winuaesrc1101.zip --- akiko.c | 164 ++-- ar.c | 488 +++++----- arcadia.c | 22 +- audio.c | 252 +++--- autoconf.c | 8 +- blitter.c | 88 +- blkdev.c | 32 +- bsdsocket.c | 112 +-- catweasel.c | 52 +- cdtv.c | 2 +- cfgfile.c | 122 +-- cia.c | 48 +- custom.c | 556 ++++-------- debug.c | 74 +- disk.c | 200 ++-- drawing.c | 96 +- driveclick.c | 32 +- enforcer.c | 53 +- ersatz.c | 2 +- expansion.c | 40 +- fdi2raw.c | 1014 ++++++++++----------- filesys.c | 110 +-- fpp.c | 30 +- fsdb.c | 2 +- gfxlib.c | 4 +- gfxutil.c | 8 +- hardfile.c | 66 +- include/{COMPEMU.H => compemu.h} | 0 include/options.h | 1 + include/sysdeps.h | 12 + inputdevice.c | 300 ++---- inputevents.def | 32 +- keybuf.c | 2 +- memory.c | 70 +- newcpu.c | 162 ++-- od-win32/ahidsound.c | 191 ++-- od-win32/avioutput.c | 199 ++-- od-win32/blkdev_win32_aspi.c | 192 ++-- od-win32/blkdev_win32_ioctl.c | 24 +- od-win32/blkdev_win32_spti.c | 42 +- od-win32/bsdsock.c | 201 ++--- od-win32/caps/caps_win32.c | 2 +- od-win32/dinput.c | 144 +-- od-win32/direct3d.c | 56 +- od-win32/dxwrap.c | 378 ++++---- od-win32/fsdb_win32.c | 44 +- od-win32/ioport.c | 8 +- od-win32/keyboard_win32.c | 82 +- od-win32/midi.c | 370 ++++---- od-win32/mman.c | 35 +- od-win32/parser.c | 104 ++- od-win32/picasso96_win.c | 648 +++++++------ od-win32/resources/resource.h | 2 + od-win32/resources/winuae.rc | 13 +- od-win32/serial_win32.c | 2 +- od-win32/win32.c | 282 +++--- od-win32/win32gfx.c | 346 +++---- od-win32/win32gui.c | 1101 ++++++++++++----------- od-win32/winuae_msvc/winuae_msvc.vcproj | 1 + od-win32/writelog.c | 11 +- readcpu.c | 6 +- savestate.c | 302 +++---- scsiemul.c | 48 +- uaeexe.c | 8 +- uaelib.c | 8 +- unzip.c | 152 ++-- zfile.c | 36 +- 67 files changed, 4383 insertions(+), 4911 deletions(-) rename include/{COMPEMU.H => compemu.h} (100%) diff --git a/akiko.c b/akiko.c index 5e391969..00f85fe6 100755 --- a/akiko.c +++ b/akiko.c @@ -32,7 +32,7 @@ int cd32_enabled; -static int m68k_getpc(void) { return 0; } +static int m68k_getpc(void) { return 0; } /* * CD32 1Kb NVRAM (EEPROM) emulation @@ -47,31 +47,31 @@ static int m68k_getpc(void) { return 0; } * unnecessarily complex and not 100% correct.. */ -enum i2c { I2C_WAIT, I2C_START, I2C_DEVICEADDR, I2C_WORDADDR, I2C_DATA }; +enum i2c { I2C_WAIT, I2C_START, I2C_DEVICEADDR, I2C_WORDADDR, I2C_DATA }; /* size of EEPROM, don't try to change, * (hardcoded in Kickstart) */ -#define NVRAM_SIZE 1024 +#define NVRAM_SIZE 1024 /* max size of one write request */ -#define NVRAM_PAGE_SIZE 16 +#define NVRAM_PAGE_SIZE 16 static uae_u8 cd32_nvram[NVRAM_SIZE], nvram_writetmp[NVRAM_PAGE_SIZE]; static int nvram_address, nvram_writeaddr; static int nvram_rw; -static int bitcounter = -1, direction = -1; +static int bitcounter = -1, direction = -1; static uae_u8 nvram_byte; static int scl_out, scl_in, scl_dir, oscl, sda_out, sda_in, sda_dir, osda; static int sda_dir_nvram; static int state = I2C_WAIT; -static void nvram_write (int offset, int len) +static void nvram_write (int offset, int len) { struct zfile *f = zfile_fopen (currprefs.flashfile, "rb+"); if (!f) { - f = zfile_fopen (currprefs.flashfile, "wb"); - if (!f) return; - zfile_fwrite (cd32_nvram, NVRAM_SIZE, 1, f); + f = zfile_fopen (currprefs.flashfile, "wb"); + if (!f) return; + zfile_fwrite (cd32_nvram, NVRAM_SIZE, 1, f); } zfile_fseek (f, offset, SEEK_SET); zfile_fwrite (cd32_nvram + offset, len, 1, f); @@ -137,7 +137,7 @@ static void i2c_do (void) if (direction > 0) { nvram_writetmp[nvram_writeaddr++] = nvram_byte; nvram_writeaddr &= 15; - bitcounter = 0; + bitcounter = 0; } else { bitcounter = -1; } @@ -279,8 +279,8 @@ static void akiko_c2p_do (void) for (i = 0; i < 8; i++) akiko_result[i] = 0; /* FIXME: better c2p algoritm than this piece of crap.... */ for (i = 0; i < 8 * 32; i++) { - if (akiko_buffer[7 - (i >> 5)] & (1 << (i & 31))) - akiko_result[i & 7] |= 1 << (i >> 3); + if (akiko_buffer[7 - (i >> 5)] & (1 << (i & 31))) + akiko_result[i & 7] |= 1 << (i >> 3); } } @@ -318,29 +318,29 @@ static uae_u32 akiko_c2p_read (int offset) * this piece of crap emulates real CD32 CDROM controller and drive :) */ -#define CDSTATUS_FRAME 0x80000000 -#define CDSTATUS_DATA_AVAILABLE 0x10000000 -#define CDSTATUS_DATASECTOR_ERROR 0x08000000 /* ?? */ -#define CDSTATUS_DATASECTOR 0x04000000 -#define CDSTATUS_UNKNOWN 0x02000000 +#define CDSTATUS_FRAME 0x80000000 +#define CDSTATUS_DATA_AVAILABLE 0x10000000 +#define CDSTATUS_DATASECTOR_ERROR 0x08000000 /* ?? */ +#define CDSTATUS_DATASECTOR 0x04000000 +#define CDSTATUS_UNKNOWN 0x02000000 -#define CDS_ERROR 0x80 -#define CDS_PLAYING 0x08 +#define CDS_ERROR 0x80 +#define CDS_PLAYING 0x08 static uae_u32 cdrom_status1, cdrom_status2; static uae_u8 cdrom_status3; static uae_u32 cdrom_address1, cdrom_address2; static uae_u32 cdrom_longmask; static uae_u32 cdrom_readmask_r, cdrom_readmask_w; -static uae_u8 cdrom_command_offset_complete; /* 0x19 */ +static uae_u8 cdrom_command_offset_complete; /* 0x19 */ static uae_u8 cdrom_command_offset_todo; /* 0x1d */ -static uae_u8 cdrom_result_complete; /* 0x1a */ -static uae_u8 cdrom_result_last_pos; /* 0x1f */ +static uae_u8 cdrom_result_complete; /* 0x1a */ +static uae_u8 cdrom_result_last_pos; /* 0x1f */ static uae_u8 cdrom_result_buffer[32]; static uae_u8 cdrom_command_buffer[32]; static uae_u8 cdrom_command; -#define MAX_TOC_ENTRIES 103 /* tracks 1-99, A0,A1 and A2 */ +#define MAX_TOC_ENTRIES 103 /* tracks 1-99, A0,A1 and A2 */ static int cdrom_toc_entries; static int cdrom_toc_counter; static uae_u8 cdrom_toc_buffer[MAX_TOC_ENTRIES*13]; @@ -356,7 +356,7 @@ static int cdrom_dosomething; static uae_u8 *sector_buffer_1, *sector_buffer_2; static int sector_buffer_sector_1, sector_buffer_sector_2; -#define SECTOR_BUFFER_SIZE 64 +#define SECTOR_BUFFER_SIZE 64 static uae_u8 *sector_buffer_info_1, *sector_buffer_info_2; static int unitnum = -1; @@ -379,7 +379,7 @@ static int fromlongbcd (uae_u8 *p) } /* convert minutes, seconds and frames -> logical sector number */ -static int msf2lsn (int msf) +static int msf2lsn (int msf) { int sector = (((msf >> 16) & 0xff) * 60 * 75 + ((msf >> 8) & 0xff) * 75 + ((msf >> 0) & 0xff)) - 150; if (sector < 0) @@ -388,7 +388,7 @@ static int msf2lsn (int msf) } /* convert logical sector number -> minutes, seconds and frames */ -static int lsn2msf (int sectors) +static int lsn2msf (int sectors) { int msf; sectors += 150; @@ -398,7 +398,7 @@ static int lsn2msf (int sectors) return msf; } -static void cdaudiostop (void) +static void cdaudiostop (void) { cdrom_playing = 0; cdrom_paused = 0; @@ -410,7 +410,7 @@ static void cdaudiostop (void) } static uae_u32 last_play_end; -static int cd_play_audio (uae_u32 startmsf, uae_u32 endmsf, int scan) +static int cd_play_audio (uae_u32 startmsf, uae_u32 endmsf, int scan) { if (endmsf == 0xffffffff) endmsf = last_play_end; @@ -427,7 +427,7 @@ static int cd_qcode (uae_u8 *d) uae_u8 *buf, *s, as; if (d) - memset (d, 0, 11); + memset (d, 0, 11); last_play_pos = 0; buf = sys_command_qcode (DF_IOCTL, unitnum); if (!buf) @@ -460,7 +460,7 @@ static int cd_qcode (uae_u8 *d) /* Make sure end of disc position is passed. */ int lsn = msf2lsn ((s[5] << 16) | (s[6] << 8) | (s[7] << 0)); - int msf = lsn2msf (cdrom_leadout); + int msf = lsn2msf (cdrom_leadout); if (lsn >= cdrom_leadout || cdrom_leadout - lsn < 10) { d[8] = tobcd ((uae_u8)(msf >> 16)); d[9] = tobcd ((uae_u8)(msf >> 8)); @@ -524,7 +524,7 @@ static int sys_cddev_open (void) int audiounit = -1; for (unitnum = 0; unitnum < MAX_TOTAL_DEVICES; unitnum++) { - if (sys_command_open (DF_IOCTL, unitnum)) { + if (sys_command_open (DF_IOCTL, unitnum)) { di2 = sys_command_info (DF_IOCTL, unitnum, &di1); if (di2 && di2->type == INQ_ROMD) { write_log ("%s: ", di2->label); @@ -532,7 +532,7 @@ static int sys_cddev_open (void) first = unitnum; if (!cdrom_toc ()) { if (cdrom_data_end > 0) { - uae_u8 *p = sys_command_read (DF_IOCTL, unitnum, 16); + uae_u8 *p = sys_command_read (DF_IOCTL, unitnum, 16); if (p) { if (!memcmp (p + 8, "CDTV", 4) || !memcmp (p + 8, "CD32", 4)) { write_log ("CD32 or CDTV\n"); @@ -558,7 +558,7 @@ static int sys_cddev_open (void) } unitnum = audiounit; if (cd32unit >= 0) - unitnum = cd32unit; + unitnum = cd32unit; if (unitnum < 0) unitnum = first; if (unitnum < 0) @@ -688,7 +688,7 @@ static int cdrom_command_unpause (void) return 2; } -/* seek head/play CD audio/read data sectors */ +/* seek head/play CD audio/read data sectors */ static int cdrom_command_multi (void) { int seekpos = fromlongbcd (cdrom_command_buffer + 1); @@ -804,33 +804,33 @@ static void cdrom_run_command_run (void) memset (cdrom_result_buffer, 0, sizeof(cdrom_result_buffer)); switch (cdrom_command & 0x0f) { - case 2: - len = cdrom_command_pause (); - break; - case 3: - len = cdrom_command_unpause (); - break; - case 4: - len = cdrom_command_multi (); - break; + case 2: + len = cdrom_command_pause (); + break; + case 3: + len = cdrom_command_unpause (); + break; + case 4: + len = cdrom_command_multi (); + break; case 5: cdrom_dosomething = 1; len = cdrom_command_something (); break; - case 6: - len = cdrom_command_subq (); - break; - case 7: - len = cdrom_command_door_status (); - break; - default: - len = 0; - break; + case 6: + len = cdrom_command_subq (); + break; + case 7: + len = cdrom_command_door_status (); + break; + default: + len = 0; + break; } if (len == 0) - return; + return; if (cdrom_checksum_error) - cdrom_result_buffer[1] |= 0x80; + cdrom_result_buffer[1] |= 0x80; cdrom_return_data (len); } @@ -852,26 +852,26 @@ static void cdrom_run_read (void) return; j = cdrom_sector_counter & 15; if (unitnum >= 0 && cdrom_readmask_w & (1 << j)) { - sector = cdrom_current_sector = cdrom_data_offset + cdrom_sector_counter; - sec = sector - sector_buffer_sector_1; - if (sector_buffer_sector_1 >= 0 && sec >= 0 && sec < SECTOR_BUFFER_SIZE) { + sector = cdrom_current_sector = cdrom_data_offset + cdrom_sector_counter; + sec = sector - sector_buffer_sector_1; + if (sector_buffer_sector_1 >= 0 && sec >= 0 && sec < SECTOR_BUFFER_SIZE) { if (sector_buffer_info_1[sec] != 0xff && sector_buffer_info_1[sec] != 0) { - memcpy (buf + 16, sector_buffer_1 + sec * 2048, 2048); - encode_l2 (buf, sector + 150); - buf[0] = 0; - buf[1] = 0; - buf[2] = 0; - buf[3] = cdrom_sector_counter; - for (i = 0; i < 2352; i++) - put_byte (cdrom_address1 + j * 4096 + i, buf[i]); - cdrom_readmask_r |= 1 << j; + memcpy (buf + 16, sector_buffer_1 + sec * 2048, 2048); + encode_l2 (buf, sector + 150); + buf[0] = 0; + buf[1] = 0; + buf[2] = 0; + buf[3] = cdrom_sector_counter; + for (i = 0; i < 2352; i++) + put_byte (cdrom_address1 + j * 4096 + i, buf[i]); + cdrom_readmask_r |= 1 << j; } if (sector_buffer_info_1[sec] != 0xff) sector_buffer_info_1[sec]--; } else return; #if AKIKO_DEBUG_IO_CMD - write_log("read sector=%d, scnt=%d -> %d\n", cdrom_data_offset, cdrom_sector_counter, sector); + write_log("read sector=%d, scnt=%d -> %d\n", cdrom_data_offset, cdrom_sector_counter, sector); #endif cdrom_readmask_w &= ~(1 << j); } @@ -891,7 +891,7 @@ static void akiko_handler (void) if (unitnum < 0) return; if (cdrom_result_complete > cdrom_result_last_pos && cdrom_result_complete - cdrom_result_last_pos < 100) { - cdrom_status1 |= CDSTATUS_DATA_AVAILABLE; + cdrom_status1 |= CDSTATUS_DATA_AVAILABLE; return; } if (cdrom_result_last_pos < cdrom_result_complete) @@ -922,8 +922,8 @@ static void akiko_internal (void) { cdrom_run_command (); if (cdrom_command_active > 0) { - cdrom_command_active--; - if (!cdrom_command_active) + cdrom_command_active--; + if (!cdrom_command_active) cdrom_run_command_run (); } } @@ -943,7 +943,7 @@ void AKIKO_hsync_handler (void) cdrom_run_read (); framecounter = 1000000 / (74 * 75 * cdrom_speed); framecounter = 1000000 / (74 * 75 * cdrom_speed); - cdrom_status1 |= CDSTATUS_FRAME; + cdrom_status1 |= CDSTATUS_FRAME; } akiko_internal (); akiko_handler (); @@ -953,7 +953,7 @@ void AKIKO_hsync_handler (void) static volatile int akiko_thread_running; /* cdrom data buffering thread */ -static void *akiko_thread (void *null) +static void *akiko_thread (void *null) { int i; uae_u8 *tmp1; @@ -964,7 +964,7 @@ static void *akiko_thread (void *null) int sector; while(akiko_thread_running) { - uae_sem_wait (&akiko_sem); + uae_sem_wait (&akiko_sem); sector = cdrom_current_sector; for (i = 0; i < SECTOR_BUFFER_SIZE; i++) { if (sector_buffer_info_1[i] == 0xff) break; @@ -996,7 +996,7 @@ static void *akiko_thread (void *null) sector_buffer_sector_1 = sector_buffer_sector_2; sector_buffer_sector_2 = tmp3; } - uae_sem_post (&akiko_sem); + uae_sem_post (&akiko_sem); sleep_millis (10); } akiko_thread_running = -1; @@ -1007,7 +1007,7 @@ static uae_u8 akiko_get_long (uae_u32 v, int offset) { return v >> ((3 - offset) * 8); } -static void akiko_put_long (uae_u32 *p, int offset, int v) +static void akiko_put_long (uae_u32 *p, int offset, int v) { *p &= ~(0xff << ((3 - offset) * 8)); *p |= v << ((3 - offset) * 8); @@ -1089,7 +1089,7 @@ uae_u32 akiko_bget2 (uaecptr addr, int msg) /* C2P */ case 0x38: case 0x39: - case 0x3a: + case 0x3a: case 0x3b: v = akiko_c2p_read (addr - 0x38); break; @@ -1132,7 +1132,7 @@ uae_u32 akiko_lget (uaecptr addr) v |= akiko_bget2 (addr + 1, 0) << 16; v |= akiko_bget2 (addr + 0, 0) << 24; if (addr < 0x30 && (addr != 4 && addr != 8) && AKIKO_DEBUG_IO) - write_log ("akiko_lget %08.8X: %08.8X %08.8X\n", m68k_getpc(), addr, v); + write_log ("akiko_lget %08.8X: %08.8X %08.8X\n", m68k_getpc(), addr, v); return v; } @@ -1143,7 +1143,7 @@ void akiko_bput2 (uaecptr addr, uae_u32 v, int msg) addr &= 0xffff; v &= 0xff; if(msg && addr < 0x30 && AKIKO_DEBUG_IO) - write_log ("akiko_bput %08.8X: %08.8X=%02.2X\n", m68k_getpc(), addr, v & 0xff); + write_log ("akiko_bput %08.8X: %08.8X=%02.2X\n", m68k_getpc(), addr, v & 0xff); uae_sem_wait (&akiko_sem); switch (addr) { @@ -1246,7 +1246,7 @@ void akiko_lput (uaecptr addr, uae_u32 v) { addr &= 0xffff; if(addr < 0x30 && AKIKO_DEBUG_IO) - write_log("akiko_lput %08.8X: %08.8X=%08.8X\n", m68k_getpc(), addr, v); + write_log("akiko_lput %08.8X: %08.8X=%08.8X\n", m68k_getpc(), addr, v); akiko_bput2 (addr + 3, (v >> 0) & 0xff, 0); akiko_bput2 (addr + 2, (v >> 8) & 0xff, 0); akiko_bput2 (addr + 1, (v >> 16) & 0xff, 0); @@ -1336,9 +1336,9 @@ int akiko_init (void) } } if (!savestate_state) { - cdrom_playing = cdrom_paused = 0; + cdrom_playing = cdrom_paused = 0; cdrom_data_offset = -1; - uae_sem_init (&akiko_sem, 0, 1); + uae_sem_init (&akiko_sem, 0, 1); } if (cdromok && !akiko_thread_running) { akiko_thread_running = 1; @@ -1449,7 +1449,7 @@ uae_u8 *restore_akiko(uae_u8 *src) void akiko_entergui (void) { if (cdrom_playing) - sys_command_pause (DF_IOCTL, unitnum, 1); + sys_command_pause (DF_IOCTL, unitnum, 1); } void akiko_exitgui (void) { diff --git a/ar.c b/ar.c index b579736d..60283e5e 100755 --- a/ar.c +++ b/ar.c @@ -156,33 +156,33 @@ #include "ar.h" #include "savestate.h" -#define DEBUG +#define DEBUG #ifdef DEBUG -#define write_log_debug write_log +#define write_log_debug write_log #else -#define write_log_debug +#define write_log_debug #endif -#define ARMODE_FREEZE 0 /* AR2/3 The action replay 'freeze' button has been pressed. */ -#define ARMODE_BREAKPOINT_AR2 2 /* AR2: The action replay is activated via a breakpoint. */ -#define ARMODE_BREAKPOINT_ACTIVATED 1 -#define ARMODE_BREAKPOINT_AR3_RESET_AR2 3 /* AR2: The action replay is activated after a reset. */ - /* AR3: The action replay is activated by a breakpoint. */ +#define ARMODE_FREEZE 0 /* AR2/3 The action replay 'freeze' button has been pressed. */ +#define ARMODE_BREAKPOINT_AR2 2 /* AR2: The action replay is activated via a breakpoint. */ +#define ARMODE_BREAKPOINT_ACTIVATED 1 +#define ARMODE_BREAKPOINT_AR3_RESET_AR2 3 /* AR2: The action replay is activated after a reset. */ + /* AR3: The action replay is activated by a breakpoint. */ /* HRTMon baseaddress, can be freely changed */ -#define HRTMON_BASE 0x980000 +#define HRTMON_BASE 0x980000 uae_u8 ar_custom[2*256]; -int hrtmon_flag = ACTION_REPLAY_INACTIVE; +int hrtmon_flag = ACTION_REPLAY_INACTIVE; static uae_u8 *hrtmemory = 0; static uae_u8 *armemory_rom = 0, *armemory_ram = 0; static uae_u32 hrtmem_mask; static uae_u8 *hrtmon_custom; -uae_u32 hrtmem_start, hrtmem_size; +uae_u32 hrtmem_start, hrtmem_size; static uae_u32 hrtmem_lget (uaecptr) REGPARAM; static uae_u32 hrtmem_wget (uaecptr) REGPARAM; @@ -190,7 +190,7 @@ static uae_u32 hrtmem_bget (uaecptr) REGPARAM; static void hrtmem_lput (uaecptr, uae_u32) REGPARAM; static void hrtmem_wput (uaecptr, uae_u32) REGPARAM; static void hrtmem_bput (uaecptr, uae_u32) REGPARAM; -static int hrtmem_check (uaecptr addr, uae_u32 size) REGPARAM; +static int hrtmem_check (uaecptr addr, uae_u32 size) REGPARAM; static uae_u8 *hrtmem_xlate (uaecptr addr) REGPARAM; static void hrtmon_unmap_banks(void); @@ -254,7 +254,7 @@ static int REGPARAM2 hrtmem_check (uaecptr addr, uae_u32 size) return (addr + size) <= hrtmem_size; } -static uae_u8 REGPARAM2 *hrtmem_xlate (uaecptr addr) +static uae_u8 REGPARAM2 *hrtmem_xlate (uaecptr addr) { addr -= hrtmem_start & hrtmem_mask; addr &= hrtmem_mask; @@ -274,7 +274,7 @@ while(len--) { src++; } } -static void copytoamiga(uaecptr dst,uae_u8 *src,int len) +static void copytoamiga(uaecptr dst,uae_u8 *src,int len) { while(len--) { put_byte (dst, *src++); @@ -285,26 +285,26 @@ while(len--) { int action_replay_flag = ACTION_REPLAY_INACTIVE; static int ar_rom_file_size; -/* Use this for relocating AR? */ +/* Use this for relocating AR? */ static int ar_rom_location; /*static*/ int armodel; -static uae_u8 artemp[4]; /* Space to store the 'real' level 7 interrupt */ +static uae_u8 artemp[4]; /* Space to store the 'real' level 7 interrupt */ static uae_u8 armode; -static uae_u32 arrom_start, arrom_size, arrom_mask; -static uae_u32 arram_start, arram_size, arram_mask; +static uae_u32 arrom_start, arrom_size, arrom_mask; +static uae_u32 arram_start, arram_size, arram_mask; -static int ar_wait_pop = 0; /* bool used by AR1 when waiting for the program counter to exit it's ram. */ -uaecptr wait_for_pc = 0; /* The program counter that we wait for. */ +static int ar_wait_pop = 0; /* bool used by AR1 when waiting for the program counter to exit it's ram. */ +uaecptr wait_for_pc = 0; /* The program counter that we wait for. */ -/* returns true if the Program counter is currently in the AR rom. */ +/* returns true if the Program counter is currently in the AR rom. */ int is_ar_pc_in_rom() { uaecptr pc = m68k_getpc() & 0xFFFFFF; return pc >= arrom_start && pc < arrom_start+arrom_size; } -/* returns true if the Program counter is currently in the AR RAM. */ +/* returns true if the Program counter is currently in the AR RAM. */ int is_ar_pc_in_ram() { uaecptr pc = m68k_getpc() & 0xFFFFFF; @@ -312,44 +312,44 @@ int is_ar_pc_in_ram() } -/* flag writing == 1 for writing memory, 0 for reading from memory. */ -STATIC_INLINE int ar3a (uaecptr addr, uae_u8 b, int writing) +/* flag writing == 1 for writing memory, 0 for reading from memory. */ +STATIC_INLINE int ar3a (uaecptr addr, uae_u8 b, int writing) { uaecptr pc; -/* if ( addr < 8 ) //|| writing ) */ +/* if ( addr < 8 ) //|| writing ) */ /* { */ /* if ( writing ) */ -/* write_log_debug("ARSTATUS armode:%d, Writing %d to address %p, PC=%p\n", armode, b, addr, m68k_getpc()); */ +/* write_log_debug("ARSTATUS armode:%d, Writing %d to address %p, PC=%p\n", armode, b, addr, m68k_getpc()); */ /* else */ -/* write_log_debug("ARSTATUS armode:%d, Reading %d from address %p, PC=%p\n", armode, armemory_rom[addr], addr, m68k_getpc()); */ +/* write_log_debug("ARSTATUS armode:%d, Reading %d from address %p, PC=%p\n", armode, armemory_rom[addr], addr, m68k_getpc()); */ /* } */ if (armodel == 1 ) /* With AR1. It is always a read. Actually, it is a strobe on exit of the AR. * but, it is also read during the checksum routine. */ { - if ( addr < 2) - { + if ( addr < 2) + { if ( is_ar_pc_in_rom() ) { if ( ar_wait_pop ) { action_replay_flag = ACTION_REPLAY_WAIT_PC; -/* write_log_debug("SP %p\n", m68k_areg(regs,7)); */ -/* write_log_debug("SP+2 %p\n", m68k_areg(regs,7)+2 ); */ +/* write_log_debug("SP %p\n", m68k_areg(regs,7)); */ +/* write_log_debug("SP+2 %p\n", m68k_areg(regs,7)+2 ); */ /* write_log_debug("(SP+2) %p\n", longget(m68k_areg(regs,7)+2)); */ ar_wait_pop = 0; /* We get (SP+2) here, as the first word on the stack is the status register. */ /* We want the following long, which is the return program counter. */ wait_for_pc = longget(m68k_areg(regs,7)+2); /* Get (SP+2) */ - set_special (SPCFLAG_ACTION_REPLAY); + set_special (SPCFLAG_ACTION_REPLAY); - pc = m68k_getpc(); -/* write_log_debug("Action Replay marked as ACTION_REPLAY_WAIT_PC, PC=%p\n",pc);*/ + pc = m68k_getpc(); +/* write_log_debug("Action Replay marked as ACTION_REPLAY_WAIT_PC, PC=%p\n",pc);*/ } else { - uaecptr pc = m68k_getpc(); -/* write_log_debug("Action Replay marked as IDLE, PC=%p\n",pc);*/ + uaecptr pc = m68k_getpc(); +/* write_log_debug("Action Replay marked as IDLE, PC=%p\n",pc);*/ action_replay_flag = ACTION_REPLAY_IDLE; } } @@ -377,12 +377,12 @@ STATIC_INLINE int ar3a (uaecptr addr, uae_u8 b, int writing) } /* else, we are writing */ else if (addr == 1) { - armode = b; - if(armode >= 2) + armode = b; + if(armode >= 2) { if ( armode == ARMODE_BREAKPOINT_AR2 ) { - write_log("AR2: exit with breakpoint(s) active\n"); /* Correct for AR2 */ + write_log("AR2: exit with breakpoint(s) active\n"); /* Correct for AR2 */ } else if ( armode == ARMODE_BREAKPOINT_AR3_RESET_AR2 ) { @@ -393,13 +393,13 @@ STATIC_INLINE int ar3a (uaecptr addr, uae_u8 b, int writing) write_log("AR2/3: mode(%d) > 3 this shouldn't happen.\n", armode); } } else { - write_log("AR: exit with armode(%d)\n", armode); - } - set_special (SPCFLAG_ACTION_REPLAY); - action_replay_flag = ACTION_REPLAY_HIDE; + write_log("AR: exit with armode(%d)\n", armode); + } + set_special (SPCFLAG_ACTION_REPLAY); + action_replay_flag = ACTION_REPLAY_HIDE; } else if (addr == 6) { - copytoamiga (regs.vbr + 0x7c, artemp, 4); - write_log ("AR: chipmem returned\n"); + copytoamiga (regs.vbr + 0x7c, artemp, 4); + write_log ("AR: chipmem returned\n"); } return 0; } @@ -441,7 +441,7 @@ void REGPARAM2 chipmem_lput_actionreplay23 (uaecptr addr, uae_u32 l) m = (uae_u32 *)(chipmemory + addr); do_put_mem_long (m, l); if (addr >= 0x40 && addr < 0x200 && action_replay_flag == ACTION_REPLAY_WAITRESET) - action_replay_chipwrite(); + action_replay_chipwrite(); } void REGPARAM2 chipmem_wput_actionreplay23 (uaecptr addr, uae_u32 w) { @@ -452,26 +452,26 @@ void REGPARAM2 chipmem_wput_actionreplay23 (uaecptr addr, uae_u32 w) m = (uae_u16 *)(chipmemory + addr); do_put_mem_word (m, w); if (addr >= 0x40 && addr < 0x200 && action_replay_flag == ACTION_REPLAY_WAITRESET) - action_replay_chipwrite(); + action_replay_chipwrite(); } static uae_u32 arram_lget (uaecptr) REGPARAM; static uae_u32 arram_wget (uaecptr) REGPARAM; static uae_u32 arram_bget (uaecptr) REGPARAM; -static void arram_lput (uaecptr, uae_u32) REGPARAM; -static void arram_wput (uaecptr, uae_u32) REGPARAM; -static void arram_bput (uaecptr, uae_u32) REGPARAM; -static int arram_check (uaecptr addr, uae_u32 size) REGPARAM; +static void arram_lput (uaecptr, uae_u32) REGPARAM; +static void arram_wput (uaecptr, uae_u32) REGPARAM; +static void arram_bput (uaecptr, uae_u32) REGPARAM; +static int arram_check (uaecptr addr, uae_u32 size) REGPARAM; static uae_u8 *arram_xlate (uaecptr addr) REGPARAM; static uae_u32 arrom_lget (uaecptr) REGPARAM; static uae_u32 arrom_wget (uaecptr) REGPARAM; static uae_u32 arrom_bget (uaecptr) REGPARAM; -static void arrom_lput (uaecptr, uae_u32) REGPARAM; -static void arrom_wput (uaecptr, uae_u32) REGPARAM; -static void arrom_bput (uaecptr, uae_u32) REGPARAM; -static int arrom_check (uaecptr addr, uae_u32 size) REGPARAM; +static void arrom_lput (uaecptr, uae_u32) REGPARAM; +static void arrom_wput (uaecptr, uae_u32) REGPARAM; +static void arrom_bput (uaecptr, uae_u32) REGPARAM; +static int arrom_check (uaecptr addr, uae_u32 size) REGPARAM; static uae_u8 *arrom_xlate (uaecptr addr) REGPARAM; static void action_replay_unmap_banks(void); @@ -489,7 +489,7 @@ static uae_u32 REGPARAM2 arram_lget (uaecptr addr) addr &= arram_mask; m = (uae_u32 *)(armemory_ram + addr); if (strncmp("T8", (char*)m, 2) == 0) - write_log_debug("Reading T8 from addr %08.08x PC=%p\n", addr, m68k_getpc()); + write_log_debug("Reading T8 from addr %08.08x PC=%p\n", addr, m68k_getpc()); if (strncmp("LAME", (char*)m, 4) == 0) write_log_debug("Reading LAME from addr %08.08x PC=%p\n", addr, m68k_getpc()); if (strncmp("RES1", (char*)m, 4) == 0) @@ -571,14 +571,14 @@ void REGPARAM2 arram_bput (uaecptr addr, uae_u32 b) armemory_ram[addr] = b; } -static int REGPARAM2 arram_check (uaecptr addr, uae_u32 size) +static int REGPARAM2 arram_check (uaecptr addr, uae_u32 size) { addr -= arram_start; addr &= arram_mask; return (addr + size) <= arram_size; } -static uae_u8 REGPARAM2 *arram_xlate (uaecptr addr) +static uae_u8 REGPARAM2 *arram_xlate (uaecptr addr) { addr -= arram_start; addr &= arram_mask; @@ -615,7 +615,7 @@ static uae_u32 REGPARAM2 arrom_bget (uaecptr addr) return ar3a (addr, 0, 0); } -static void REGPARAM2 arrom_lput (uaecptr addr, uae_u32 l) +static void REGPARAM2 arrom_lput (uaecptr addr, uae_u32 l) { #ifdef JIT special_mem |= S_WRITE; @@ -628,7 +628,7 @@ static void REGPARAM2 arrom_lput (uaecptr addr, uae_u32 l) ar3a (addr + 3,(uae_u8)(l >> 0), 1); } -static void REGPARAM2 arrom_wput (uaecptr addr, uae_u32 w) +static void REGPARAM2 arrom_wput (uaecptr addr, uae_u32 w) { #ifdef JIT special_mem |= S_WRITE; @@ -639,7 +639,7 @@ static void REGPARAM2 arrom_wput (uaecptr addr, uae_u32 w) ar3a (addr + 1,(uae_u8)(w >> 0), 1); } -static void REGPARAM2 arrom_bput (uaecptr addr, uae_u32 b) +static void REGPARAM2 arrom_bput (uaecptr addr, uae_u32 b) { #ifdef JIT special_mem |= S_WRITE; @@ -649,26 +649,26 @@ static void REGPARAM2 arrom_bput (uaecptr addr, uae_u32 b) ar3a (addr, b, 1); } -static int REGPARAM2 arrom_check (uaecptr addr, uae_u32 size) +static int REGPARAM2 arrom_check (uaecptr addr, uae_u32 size) { addr -= arrom_start; addr &= arrom_mask; return (addr + size) <= arrom_size; } -static uae_u8 REGPARAM2 *arrom_xlate (uaecptr addr) +static uae_u8 REGPARAM2 *arrom_xlate (uaecptr addr) { addr -= arrom_start; addr &= arrom_mask; return armemory_rom + addr; } -static addrbank arrom_bank = { +static addrbank arrom_bank = { arrom_lget, arrom_wget, arrom_bget, arrom_lput, arrom_wput, arrom_bput, arrom_xlate, arrom_check, NULL }; -static addrbank arram_bank = { +static addrbank arram_bank = { arram_lget, arram_wget, arram_bget, arram_lput, arram_wput, arram_bput, arram_xlate, arram_check, NULL @@ -677,7 +677,7 @@ static addrbank arram_bank = { static void action_replay_unmap_banks() { if(!armemory_rom) - return; + return; map_banks (&dummy_bank, arrom_start >> 16 , arrom_size >> 16, 0); map_banks (&dummy_bank, arram_start >> 16 , arram_size >> 16, 0); @@ -686,7 +686,7 @@ static void action_replay_unmap_banks() void action_replay_map_banks() { if(!armemory_rom) - return; + return; map_banks (&arrom_bank, arrom_start >> 16, arrom_size >> 16, 0); map_banks (&arram_bank, arram_start >> 16, arram_size >> 16, 0); @@ -696,16 +696,16 @@ static void hide_cart(int hide) { #ifdef ACTION_REPLAY_HIDE_CARTRIDGE if(hide) { - action_replay_unmap_banks(); + action_replay_unmap_banks(); } else { - action_replay_map_banks(); + action_replay_map_banks(); } #endif } -/*extern void Interrupt (int nr);*/ +/*extern void Interrupt (int nr);*/ -/* Cartridge activates itself by overlaying its rom +/* Cartridge activates itself by overlaying its rom * over chip-ram and then issuing IRQ 7 * * I just copy IRQ vector 7 from ROM to chip RAM @@ -753,16 +753,16 @@ void action_replay_enter(void) if (!armemory_rom) return; if (armodel == 1) { write_log("AR1: Enter PC:%p\n", m68k_getpc()); - action_replay_go1 (7); - unset_special (SPCFLAG_ACTION_REPLAY); - return; + action_replay_go1 (7); + unset_special (SPCFLAG_ACTION_REPLAY); + return; } if (action_replay_flag == ACTION_REPLAY_DORESET) { - write_log("AR2/3: reset\n"); - armode = ARMODE_BREAKPOINT_AR3_RESET_AR2; + write_log("AR2/3: reset\n"); + armode = ARMODE_BREAKPOINT_AR3_RESET_AR2; } else if (armode == ARMODE_FREEZE) { - write_log("AR2/3: activated (freeze)\n"); + write_log("AR2/3: activated (freeze)\n"); } else if (armode >= 2) { @@ -788,16 +788,16 @@ void check_prefs_changed_carts(int in_memory_reset) if (strcmp (currprefs.cartfile, changed_prefs.cartfile) != 0) { write_log("Cartridge ROM Prefs changed.\n"); - if (action_replay_unload(in_memory_reset)) - { + if (action_replay_unload(in_memory_reset)) + { memcpy (currprefs.cartfile, changed_prefs.cartfile, sizeof currprefs.cartfile); #ifdef ACTION_REPLAY - action_replay_load(); - action_replay_init(1); - #endif - #ifdef ACTION_REPLAY_HRTMON - hrtmon_load(1); - #endif + action_replay_load(); + action_replay_init(1); + #endif + #ifdef ACTION_REPLAY_HRTMON + hrtmon_load(1); + #endif } } } @@ -809,12 +809,12 @@ void action_replay_reset(void) write_log_debug("action_replay_reset()\n"); if (savestate_state == STATE_RESTORE) { - if (regs.pc >= arrom_start && regs.pc <= arrom_start + arrom_size) { + if (regs.pc >= arrom_start && regs.pc <= arrom_start + arrom_size) { action_replay_flag = ACTION_REPLAY_ACTIVE; hide_cart (0); } else { action_replay_flag = ACTION_REPLAY_IDLE; - hide_cart (1); + hide_cart (1); } return; } @@ -828,14 +828,14 @@ void action_replay_reset(void) { write_log_debug("Setting flag to ACTION_REPLAY_WAITRESET\n"); write_log_debug("armode == %d\n", armode); - action_replay_flag = ACTION_REPLAY_WAITRESET; + action_replay_flag = ACTION_REPLAY_WAITRESET; } } void action_replay_ciaread(void) { if (armodel < 2) - return; + return; if (action_replay_flag != ACTION_REPLAY_IDLE) return; if (action_replay_flag == ACTION_REPLAY_INACTIVE) return; if (armode < 2) /* If there are no active breakpoints*/ return; @@ -857,11 +857,11 @@ int action_replay_freeze(void) action_replay_flag = ACTION_REPLAY_ACTIVATE; set_special (SPCFLAG_ACTION_REPLAY); armode = ARMODE_FREEZE; - } + } return 1; } else if(hrtmon_flag == ACTION_REPLAY_IDLE) { - hrtmon_flag = ACTION_REPLAY_ACTIVATE; - set_special (SPCFLAG_ACTION_REPLAY); + hrtmon_flag = ACTION_REPLAY_ACTIVATE; + set_special (SPCFLAG_ACTION_REPLAY); return 1; } return 0; @@ -871,15 +871,15 @@ void action_replay_chipwrite(void) { if (armodel > 1) { - action_replay_flag = ACTION_REPLAY_DORESET; - set_special (SPCFLAG_ACTION_REPLAY); + action_replay_flag = ACTION_REPLAY_DORESET; + set_special (SPCFLAG_ACTION_REPLAY); } else { /* copy 0x60 addr info to level 7 */ /* This is to emulate the 0x60 interrupt. */ - copyfromamiga (artemp, regs.vbr + 0x60, 4); - copytoamiga (regs.vbr + 0x7c, artemp, 4); + copyfromamiga (artemp, regs.vbr + 0x60, 4); + copytoamiga (regs.vbr + 0x7c, artemp, 4); ar_wait_pop = 1; /* Wait for stack to pop. */ action_replay_flag = ACTION_REPLAY_ACTIVATE; @@ -907,13 +907,13 @@ void hrtmon_breakenter(void) } -/* Disabling copperlist processing: +/* Disabling copperlist processing: * On: ar317 an rts at 41084c does it. * On: ar214: an rts at 41068e does it. */ -/* Original AR3 only works with KS 1.3 +/* Original AR3 only works with KS 1.3 * this patch fixes that problem. */ @@ -926,16 +926,16 @@ static void action_replay_patch(void) uae_u8 *kickmem = kickmemory; if (armodel != 3 || !kickmem) - return; + return; if (!memcmp (kickmem, kickmem + 262144, 262144)) off1 = 262144; else off1 = 0; for (;;) { - if (!memcmp (kickmem + off1, ar3patch1, sizeof (ar3patch1)) || off1 == 524288 - sizeof (ar3patch1)) break; - off1++; + if (!memcmp (kickmem + off1, ar3patch1, sizeof (ar3patch1)) || off1 == 524288 - sizeof (ar3patch1)) break; + off1++; } off2 = 0; for(;;) { - if (!memcmp (armemory_rom + off2, ar3patch2, sizeof(ar3patch2)) || off2 == ar_rom_file_size - sizeof (ar3patch2)) break; - off2++; + if (!memcmp (armemory_rom + off2, ar3patch2, sizeof(ar3patch2)) || off2 == ar_rom_file_size - sizeof (ar3patch2)) break; + off2++; } if (off1 == 524288 - sizeof (ar3patch1) || off2 == ar_rom_file_size - sizeof (ar3patch2)) return; @@ -946,7 +946,7 @@ static void action_replay_patch(void) write_log ("AR ROM patched for KS2.0+\n"); } -/* Returns 0 if the checksum is OK. +/* Returns 0 if the checksum is OK. * Else, it returns the calculated checksum. * Note: Will be wrong if the checksum is zero, but i'll take my chances on that not happenning ;) */ @@ -1017,7 +1017,7 @@ static uae_u32 action_replay_calculate_checksum() return checksum == stored_checksum ? 0 : checksum; } -/* Returns 0 on error. */ +/* Returns 0 on error. */ static uae_u8* get_checksum_location() { uae_u32* checksum_end; @@ -1036,8 +1036,8 @@ static uae_u8* get_checksum_location() } -/* Replaces the existing cart checksum with a correct one. */ -/* Useful if you want to patch the rom. */ +/* Replaces the existing cart checksum with a correct one. */ +/* Useful if you want to patch the rom. */ static void action_replay_fixup_checksum(uae_u32 new_checksum) { uae_u32* checksum = (uae_u32*)get_checksum_location(); @@ -1056,7 +1056,7 @@ static void action_replay_fixup_checksum(uae_u32 new_checksum) * the search_value is assumed to already be in the local endian format * return 0 on failure */ -static uae_u8* find_absolute_long(uae_u8* start_addr, uae_u8* end_addr, uae_u32 search_value) +static uae_u8* find_absolute_long(uae_u8* start_addr, uae_u8* end_addr, uae_u32 search_value) { uae_u8* addr; @@ -1072,13 +1072,13 @@ static uae_u8* find_absolute_long(uae_u8* start_addr, uae_u8* end_addr, uae_u32 return 0; } -/* word search on word boundary +/* word search on word boundary * the search_addr is assumed to already be in the local endian format * return 0 on failure * Currently only tested where the address we are looking for is AFTER the instruction. * Not sure it works with negative offsets. */ -static uae_u8* find_relative_word(uae_u8* start_addr, uae_u8* end_addr, uae_u16 search_addr) +static uae_u8* find_relative_word(uae_u8* start_addr, uae_u8* end_addr, uae_u16 search_addr) { uae_u8* addr; @@ -1086,7 +1086,7 @@ static uae_u8* find_relative_word(uae_u8* start_addr, uae_u8* end_addr, uae_u16 { if ( do_get_mem_word((uae_u16*)addr) == (uae_u16)(search_addr - (uae_u16)(addr-start_addr)) ) { -/* write_log_debug("Found %p at offset %p.\n", search_addr, addr - start_addr);*/ +/* write_log_debug("Found %p at offset %p.\n", search_addr, addr - start_addr);*/ return addr; } addr+=2; @@ -1095,7 +1095,7 @@ static uae_u8* find_relative_word(uae_u8* start_addr, uae_u8* end_addr, uae_u16 } /* Disable rom test */ -/* This routine replaces the rom-test routine with a 'rts'. +/* This routine replaces the rom-test routine with a 'rts'. * It does this in a 'safe' way, by searching for a reference to the checksum * and only disables it if the surounding bytes are what it expects. */ @@ -1128,9 +1128,9 @@ static void disable_rom_test() { if ( do_get_mem_word((uae_u16*)(addr-6)) == 0x6100 && /* bsr.w */ do_get_mem_word((uae_u16*)(addr-2)) == 0x41fa ) /* lea relative */ - { + { write_log("Patching to disable ROM TEST.\n"); - do_put_mem_word((uae_u16*)(addr-6), 0x4e75); /* rts */ + do_put_mem_word((uae_u16*)(addr-6), 0x4e75); /* rts */ } } } @@ -1143,15 +1143,15 @@ static void disable_rom_test() { if ( do_get_mem_word((uae_u16*)(addr-6)) == 0x6100 && /* bsr.w */ do_get_mem_word((uae_u16*)(addr-2)) == 0x41f9 ) /* lea absolute */ - { + { write_log("Patching to disable ROM TEST.\n"); - do_put_mem_word((uae_u16*)(addr-6), 0x4e75); /* rts */ + do_put_mem_word((uae_u16*)(addr-6), 0x4e75); /* rts */ } } } } -/* After we have calculated the checksum, and verified the rom is ok, +/* After we have calculated the checksum, and verified the rom is ok, * we can do two things. * 1. (optionally)Patch it and then update the checksum. * 2. Remove the checksum check and (optionally) patch it. @@ -1163,7 +1163,7 @@ static void action_replay_checksum_info(void) return; if ( action_replay_calculate_checksum() == 0 ) { - write_log("Action Replay Checksum is OK.\n"); + write_log("Action Replay Checksum is OK.\n"); } else { @@ -1177,20 +1177,20 @@ static void action_replay_checksum_info(void) static void action_replay_setbanks (void) { if (!savestate_state && chipmem_bank.lput == chipmem_lput) { - switch (armodel) - { - case 2: - case 3: - if (currprefs.cpu_cycle_exact) - chipmem_bank.wput = chipmem_wput_actionreplay23; - chipmem_bank.lput = chipmem_lput_actionreplay23; - break; - case 1: - chipmem_bank.bput = chipmem_bput_actionreplay1; - chipmem_bank.wput = chipmem_wput_actionreplay1; - chipmem_bank.lput = chipmem_lput_actionreplay1; - break; - } + switch (armodel) + { + case 2: + case 3: + if (currprefs.cpu_cycle_exact) + chipmem_bank.wput = chipmem_wput_actionreplay23; + chipmem_bank.lput = chipmem_lput_actionreplay23; + break; + case 1: + chipmem_bank.bput = chipmem_bput_actionreplay1; + chipmem_bank.wput = chipmem_wput_actionreplay1; + chipmem_bank.lput = chipmem_lput_actionreplay1; + break; + } } } @@ -1201,7 +1201,7 @@ static void action_replay_unsetbanks (void) chipmem_bank.lput = chipmem_lput; } -/* param to allow us to unload the cart. Currently we know it is safe if we are doing a reset to unload it.*/ +/* param to allow us to unload the cart. Currently we know it is safe if we are doing a reset to unload it.*/ int action_replay_unload(int in_memory_reset) { char* state[] = @@ -1264,41 +1264,41 @@ int action_replay_load(void) if (armemory_rom || hrtmemory) { write_log("action_replay_load() ROM already loaded.\n"); - return 0; + return 0; } if (strlen(currprefs.cartfile) == 0) - return 0; + return 0; f = zfile_fopen(currprefs.cartfile,"rb"); if (!f) { - write_log("failed to load '%s' Action Replay ROM\n", currprefs.cartfile); - return 0; + write_log("failed to load '%s' Action Replay ROM\n", currprefs.cartfile); + return 0; } zfile_fseek(f, 0, SEEK_END); ar_rom_file_size = zfile_ftell(f); zfile_fseek(f, 0, SEEK_SET); if (ar_rom_file_size != 65536 && ar_rom_file_size != 131072 && ar_rom_file_size != 262144) { - write_log("rom size must be 64KB (AR1), 128KB (AR2) or 256KB (AR3)\n"); - zfile_fclose(f); - return 0; + write_log("rom size must be 64KB (AR1), 128KB (AR2) or 256KB (AR3)\n"); + zfile_fclose(f); + return 0; } action_replay_flag = ACTION_REPLAY_INACTIVE; armemory_rom = xmalloc (ar_rom_file_size); zfile_fread (armemory_rom, ar_rom_file_size, 1, f); zfile_fclose (f); if (ar_rom_file_size == 65536) { - armodel = 1; - arrom_start = 0xf00000; - arrom_size = 0x10000; - /* real AR1 RAM location is 0x9fc000-0x9fffff */ - arram_start = 0x9f0000; - arram_size = 0x10000; + armodel = 1; + arrom_start = 0xf00000; + arrom_size = 0x10000; + /* real AR1 RAM location is 0x9fc000-0x9fffff */ + arram_start = 0x9f0000; + arram_size = 0x10000; } else { - armodel = ar_rom_file_size / 131072 + 1; - arrom_start = 0x400000; - arrom_size = armodel == 2 ? 0x20000 : 0x40000; - arram_start = 0x440000; - arram_size = 0x10000; + armodel = ar_rom_file_size / 131072 + 1; + arrom_start = 0x400000; + arrom_size = armodel == 2 ? 0x20000 : 0x40000; + arram_start = 0x440000; + arram_size = 0x10000; } arram_mask = arram_size - 1; arrom_mask = arrom_size - 1; @@ -1309,20 +1309,20 @@ int action_replay_load(void) return armodel; } -void action_replay_init (int activate) +void action_replay_init (int activate) { if (!armemory_rom) - return; + return; hide_cart (0); if (armodel > 1) - hide_cart (1); + hide_cart (1); if (activate) { - if (armodel > 1) - action_replay_flag = ACTION_REPLAY_WAITRESET; + if (armodel > 1) + action_replay_flag = ACTION_REPLAY_WAITRESET; } } -/* This only deallocates memory, it is not suitable for unloading roms and continuing */ +/* This only deallocates memory, it is not suitable for unloading roms and continuing */ void action_replay_cleanup() { if (armemory_rom) @@ -1330,49 +1330,49 @@ void action_replay_cleanup() if (armemory_ram) free (armemory_ram); if (hrtmemory) - free (hrtmemory); + free (hrtmemory); armemory_rom = 0; armemory_ram = 0; hrtmemory = 0; } -#ifndef FALSE -#define FALSE 0 +#ifndef FALSE +#define FALSE 0 #endif -#ifndef TRUE -#define TRUE 1 +#ifndef TRUE +#define TRUE 1 #endif -typedef struct { - char jmps[20]; - unsigned int mon_size; - unsigned short col0, col1; - char right; - char keyboard; - char key; - char ide; - char a1200; - char aga; - char insert; - char delay; - char lview; - char cd32; - char screenmode; - char vbr; - char entered; - char hexmode; - unsigned short error_sr; - unsigned int error_pc; - unsigned short error_status; - char newid[6]; - unsigned short mon_version; - unsigned short mon_revision; - unsigned int whd_base; - unsigned short whd_version; - unsigned short whd_revision; - unsigned int max_chip; - unsigned int custom; +typedef struct { + char jmps[20]; + unsigned int mon_size; + unsigned short col0, col1; + char right; + char keyboard; + char key; + char ide; + char a1200; + char aga; + char insert; + char delay; + char lview; + char cd32; + char screenmode; + char vbr; + char entered; + char hexmode; + unsigned short error_sr; + unsigned int error_pc; + unsigned short error_status; + char newid[6]; + unsigned short mon_version; + unsigned short mon_revision; + unsigned int whd_base; + unsigned short whd_version; + unsigned short whd_revision; + unsigned int max_chip; + unsigned int custom; } HRTCFG; static void hrtmon_configure(HRTCFG *cfg) @@ -1383,18 +1383,18 @@ cfg->right = 0; cfg->key = FALSE; cfg->ide = 0; cfg->a1200 = 0; -cfg->aga = (currprefs.chipset_mask & 4) ? 1 : 0; +cfg->aga = (currprefs.chipset_mask & 4) ? 1 : 0; cfg->insert = TRUE; cfg->delay = 15; cfg->lview = FALSE; cfg->cd32 = 0; -cfg->screenmode = 0; +cfg->screenmode = 0; cfg->vbr = TRUE; cfg->hexmode = FALSE; cfg->mon_size=0; cfg->hexmode = TRUE; do_put_mem_long(&cfg->max_chip,currprefs.chipmem_size); -hrtmon_custom = do_get_mem_long ((uae_u32*)&cfg->custom)+hrtmemory; +hrtmon_custom = do_get_mem_long ((uae_u32*)&cfg->custom)+hrtmemory; } static void hrtmon_reloc(uae_u32 *mem,uae_u32 *header) @@ -1407,9 +1407,9 @@ static void hrtmon_reloc(uae_u32 *mem,uae_u32 *header) p=mem+len+3; len=do_get_mem_long(p-2); for(i=0;i> 16, hrtmem_size >> 16, hrtmem_size); } @@ -1497,19 +1497,19 @@ void hrtmon_map_banks() static void hrtmon_unmap_banks() { if(!hrtmemory) - return; + return; map_banks (&dummy_bank, hrtmem_start >> 16, hrtmem_size >> 16, hrtmem_size); } -#define AR_VER_STR_OFFSET 0x4 /* offset in the rom where the version string begins. */ -#define AR_VER_STR_END 0x7c /* offset in the rom where the version string ends. */ -#define AR_VER_STR_LEN (AR_VER_STR_END - AR_VER_STR_OFFSET) +#define AR_VER_STR_OFFSET 0x4 /* offset in the rom where the version string begins. */ +#define AR_VER_STR_END 0x7c /* offset in the rom where the version string ends. */ +#define AR_VER_STR_LEN (AR_VER_STR_END - AR_VER_STR_OFFSET) char arVersionString[AR_VER_STR_LEN+1]; -/* This function extracts the version info for AR2 and AR3. */ +/* This function extracts the version info for AR2 and AR3. */ void action_replay_version() { @@ -1521,7 +1521,7 @@ void action_replay_version() *sArDate = '\0'; if (!armemory_rom) - return; + return; if ( armodel == 1 ) return; /* no support yet. */ @@ -1532,47 +1532,47 @@ void action_replay_version() tmp = strchr(arVersionString, 0x0d); if ( tmp ) { - *tmp = '\0'; + *tmp = '\0'; } /* write_log_debug("Version string is : '%s'\n", arVersionString); */ tmp = strchr(arVersionString,')'); if ( tmp ) { - *tmp = '\0'; - tmp = strchr(arVersionString, '('); - if ( tmp ) - { - if ( *(tmp + 1 ) == 'V' ) - { - pNext = tmp + 2; - tmp = strchr(pNext, '.'); - if ( tmp ) - { - *tmp = '\0'; - iArVersionMajor = atoi(pNext); - pNext = tmp+1; - tmp = strchr(pNext, ' '); - if ( tmp ) - { - *tmp = '\0'; - iArVersionMinor = atoi(pNext); - } - pNext = tmp+1; - strcpy(sArDate, pNext); - } - - } - } + *tmp = '\0'; + tmp = strchr(arVersionString, '('); + if ( tmp ) + { + if ( *(tmp + 1 ) == 'V' ) + { + pNext = tmp + 2; + tmp = strchr(pNext, '.'); + if ( tmp ) + { + *tmp = '\0'; + iArVersionMajor = atoi(pNext); + pNext = tmp+1; + tmp = strchr(pNext, ' '); + if ( tmp ) + { + *tmp = '\0'; + iArVersionMinor = atoi(pNext); + } + pNext = tmp+1; + strcpy(sArDate, pNext); + } + + } + } } if ( iArVersionMajor > 0 ) { - write_log("Version of cart is '%d.%.02d', date is '%s'\n", iArVersionMajor, iArVersionMinor, sArDate); + write_log("Version of cart is '%d.%.02d', date is '%s'\n", iArVersionMajor, iArVersionMinor, sArDate); } } -/* This function doesn't reset the Cart memory, it is just called during a memory reset */ +/* This function doesn't reset the Cart memory, it is just called during a memory reset */ void action_replay_memory_reset(void) { #ifdef ACTION_REPLAY @@ -1584,7 +1584,7 @@ void action_replay_memory_reset(void) #ifdef ACTION_REPLAY_HRTMON if ( hrtmemory ) { - hrtmon_hide(); /* It is never really idle */ + hrtmon_hide(); /* It is never really idle */ } #endif #ifdef ACTION_REPLAY_COMMON @@ -1594,7 +1594,7 @@ void action_replay_memory_reset(void) action_replay_checksum_info(); } -uae_u8 *save_action_replay (int *len, uae_u8 *dstptr) +uae_u8 *save_action_replay (int *len, uae_u8 *dstptr) { uae_u8 *dstbak,*dst; @@ -1605,7 +1605,7 @@ uae_u8 *save_action_replay (int *len, uae_u8 *dstptr) if (dstptr) dstbak = dst = dstptr; else - dstbak = dst = malloc (*len); + dstbak = dst = malloc (*len); save_u8 (armodel); strcpy (dst, currprefs.cartfile); dst += strlen(dst) + 1; @@ -1630,7 +1630,7 @@ uae_u8 *restore_action_replay (uae_u8 *src) if (armemory_ram) { memcpy (armemory_ram, src, arram_size); memcpy (ar_custom, armemory_ram + 0xf000, 2 * 256); - src += arram_size; + src += arram_size; } src += 256; return src; diff --git a/arcadia.c b/arcadia.c index 851d8dc2..975c1aa7 100755 --- a/arcadia.c +++ b/arcadia.c @@ -20,7 +20,7 @@ #include "arcadia.h" #include "zfile.h" -/* supported roms (mame 0.90) +/* supported roms (mame 0.90) * * - ar_airh * - ar_bowl @@ -41,7 +41,7 @@ struct arcadiarom *arcadia_rom; static char arcadia_path[MAX_DPATH]; -static struct arcadiarom roms[] = { +static struct arcadiarom roms[] = { { "ar_airh.zip", "scpa211", "airh_", 1, 5, 0, 2, 4, 7, 6, 1, 3, 0x98f564 }, { "ar_bowl.zip", "scpa211", "bowl_", 1, 7, 6, 0, 1, 2, 3, 4, 5, 0x98f564 }, { "ar_dart.zip", "scpa211", "dart_", 1, 4, 0, 7, 6, 3, 1, 2, 5, 0x98f564 }, @@ -58,17 +58,17 @@ static struct arcadiarom roms[] = { }; static uae_u8 *arbmemory; -#define arb_start 0x800000 -#define arb_mask 0x1fffff -#define allocated_arbmemory 0x200000 +#define arb_start 0x800000 +#define arb_mask 0x1fffff +#define allocated_arbmemory 0x200000 -#define nvram_offset 0x1fc000 -#define bios_offset 0x180000 -#define NVRAM_SIZE 0x4000 +#define nvram_offset 0x1fc000 +#define bios_offset 0x180000 +#define NVRAM_SIZE 0x4000 static int nvwrite; -static int load_rom8 (char *xpath, uae_u8 *mem, int isbin) +static int load_rom8 (char *xpath, uae_u8 *mem, int isbin) { struct zfile *zf; char path[MAX_DPATH]; @@ -174,7 +174,7 @@ static int load_roms (char *xpath, struct arcadiarom *rom) return 1; } -static uae_u8 bswap (uae_u8 v,int b7,int b6,int b5,int b4,int b3,int b2,int b1,int b0) +static uae_u8 bswap (uae_u8 v,int b7,int b6,int b5,int b4,int b3,int b2,int b1,int b0) { uae_u8 b = 0; @@ -204,7 +204,7 @@ static void decrypt_roms (struct arcadiarom *rom) arbmemory[1] = 0xfc; } -uae_u32 REGPARAM2 aab_bget (uaecptr addr) +uae_u32 REGPARAM2 aab_bget (uaecptr addr) { return 0; } diff --git a/audio.c b/audio.c index 4e5c9477..4dc8e0fb 100755 --- a/audio.c +++ b/audio.c @@ -135,7 +135,7 @@ void audio_sampleripper(int mode) struct zfile *wavfile; if (mode < 0) { - while (rs) { + while (rs) { struct ripped_sample *next = rs->next; xfree(rs); rs = next; @@ -200,9 +200,9 @@ static void do_samplerip(struct audio_channel_data *adp) xfree(rs->sample); rs->sample = xmalloc(len); memcpy(rs->sample, smp, len); - write_log("SAMPLERIPPER: replaced sample %d (%d -> %d)\n", cnt, rs->len, len); + write_log("SAMPLERIPPER: replaced sample %d (%d -> %d)\n", cnt, rs->len, len); rs->len = len; - rs->per = adp->per / CYCLE_UNIT; + rs->per = adp->per / CYCLE_UNIT; rs->changed = 1; audio_sampleripper(0); return; @@ -261,27 +261,27 @@ void init_sound_table8 (void) sound_table[j][i] = (j * (uae_s8)i * (currprefs.sound_stereo ? 2 : 1)) / 256; } -#define MULTIPLICATION_PROFITABLE +#define MULTIPLICATION_PROFITABLE #ifdef MULTIPLICATION_PROFITABLE -typedef uae_s8 sample8_t; -#define DO_CHANNEL_1(v, c) do { (v) *= audio_channel[c].vol; } while (0) -#define SBASEVAL16(logn) ((logn) == 1 ? SOUND16_BASE_VAL >> 1 : SOUND16_BASE_VAL) -#define FINISH_DATA(data,b,logn) do { if (14 - (b) + (logn) > 0) (data) >>= 14 - (b) + (logn); else (data) <<= (b) - 14 - (logn); } while (0); +typedef uae_s8 sample8_t; +#define DO_CHANNEL_1(v, c) do { (v) *= audio_channel[c].vol; } while (0) +#define SBASEVAL16(logn) ((logn) == 1 ? SOUND16_BASE_VAL >> 1 : SOUND16_BASE_VAL) +#define FINISH_DATA(data,b,logn) do { if (14 - (b) + (logn) > 0) (data) >>= 14 - (b) + (logn); else (data) <<= (b) - 14 - (logn); } while (0); #else -typedef uae_u8 sample8_t; -#define DO_CHANNEL_1(v, c) do { (v) = audio_channel[c].voltbl[(v)]; } while (0) -#define SBASEVAL16(logn) SOUND16_BASE_VAL -#define FINISH_DATA(data,b,logn) +typedef uae_u8 sample8_t; +#define DO_CHANNEL_1(v, c) do { (v) = audio_channel[c].voltbl[(v)]; } while (0) +#define SBASEVAL16(logn) SOUND16_BASE_VAL +#define FINISH_DATA(data,b,logn) #endif /* Always put the right word before the left word. */ -#define MAX_DELAY_BUFFER 1024 +#define MAX_DELAY_BUFFER 1024 static uae_u32 right_word_saved[MAX_DELAY_BUFFER]; static uae_u32 left_word_saved[MAX_DELAY_BUFFER]; static int saved_ptr; -#define MIXED_STEREO_MAX 32 +#define MIXED_STEREO_MAX 32 static int mixed_on, mixed_stereo_size, mixed_mul1, mixed_mul2; STATIC_INLINE void put_sound_word_right (uae_u32 w) @@ -293,7 +293,7 @@ STATIC_INLINE void put_sound_word_right (uae_u32 w) PUT_SOUND_WORD_RIGHT (w); } -STATIC_INLINE void put_sound_word_left (uae_u32 w) +STATIC_INLINE void put_sound_word_left (uae_u32 w) { if (mixed_on) { uae_u32 rold, lold, rnew, lnew, tmp; @@ -302,7 +302,7 @@ STATIC_INLINE void put_sound_word_left (uae_u32 w) lnew = w - SOUND16_BASE_VAL; rnew = right_word_saved[saved_ptr] - SOUND16_BASE_VAL; - saved_ptr = (saved_ptr + 1) & mixed_stereo_size; + saved_ptr = (saved_ptr + 1) & mixed_stereo_size; lold = left_word_saved[saved_ptr] - SOUND16_BASE_VAL; tmp = (rnew * mixed_mul1 + lold * mixed_mul2) / MIXED_STEREO_MAX; @@ -315,7 +315,7 @@ STATIC_INLINE void put_sound_word_left (uae_u32 w) PUT_SOUND_WORD_LEFT (w); } -#define DO_CHANNEL(v, c) do { (v) &= audio_channel[c].adk_mask; data += v; } while (0); +#define DO_CHANNEL(v, c) do { (v) &= audio_channel[c].adk_mask; data += v; } while (0); void sample16_handler (void) { @@ -335,9 +335,9 @@ void sample16_handler (void) data0 += data2; data0 += data3; { - uae_u32 data = SBASEVAL16(2) + data0; - FINISH_DATA (data, 16, 2); - PUT_SOUND_WORD (data); + uae_u32 data = SBASEVAL16(2) + data0; + FINISH_DATA (data, 16, 2); + PUT_SOUND_WORD (data); } check_sound_buffers (); } @@ -386,9 +386,9 @@ void sample16i_rh_handler (void) ratio = ((audio_channel[3].evtime % delta) << 8) / delta; data0 += (data3 * (256 - ratio) + data3p * ratio) >> 8; { - uae_u32 data = SBASEVAL16(2) + data0; - FINISH_DATA (data, 16, 2); - PUT_SOUND_WORD (data); + uae_u32 data = SBASEVAL16(2) + data0; + FINISH_DATA (data, 16, 2); + PUT_SOUND_WORD (data); } check_sound_buffers (); } @@ -422,44 +422,44 @@ void sample16i_crux_handler (void) data3p &= audio_channel[3].adk_mask; { - struct audio_channel_data *cdp; - unsigned long ratio, ratio1; -#define INTERVAL (scaled_sample_evtime * 3) - cdp = audio_channel + 0; - ratio1 = cdp->per - cdp->evtime; - ratio = (ratio1 << 12) / INTERVAL; - if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL) + struct audio_channel_data *cdp; + unsigned long ratio, ratio1; +#define INTERVAL (scaled_sample_evtime * 3) + cdp = audio_channel + 0; + ratio1 = cdp->per - cdp->evtime; + ratio = (ratio1 << 12) / INTERVAL; + if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL) ratio = 4096; - data0 = (data0 * ratio + data0p * (4096 - ratio)) >> 12; + data0 = (data0 * ratio + data0p * (4096 - ratio)) >> 12; cdp = audio_channel + 1; - ratio1 = cdp->per - cdp->evtime; - ratio = (ratio1 << 12) / INTERVAL; - if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL) + ratio1 = cdp->per - cdp->evtime; + ratio = (ratio1 << 12) / INTERVAL; + if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL) ratio = 4096; - data1 = (data1 * ratio + data1p * (4096 - ratio)) >> 12; + data1 = (data1 * ratio + data1p * (4096 - ratio)) >> 12; - cdp = audio_channel + 2; - ratio1 = cdp->per - cdp->evtime; - ratio = (ratio1 << 12) / INTERVAL; - if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL) + cdp = audio_channel + 2; + ratio1 = cdp->per - cdp->evtime; + ratio = (ratio1 << 12) / INTERVAL; + if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL) ratio = 4096; - data2 = (data2 * ratio + data2p * (4096 - ratio)) >> 12; + data2 = (data2 * ratio + data2p * (4096 - ratio)) >> 12; - cdp = audio_channel + 3; - ratio1 = cdp->per - cdp->evtime; - ratio = (ratio1 << 12) / INTERVAL; - if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL) + cdp = audio_channel + 3; + ratio1 = cdp->per - cdp->evtime; + ratio = (ratio1 << 12) / INTERVAL; + if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL) ratio = 4096; - data3 = (data3 * ratio + data3p * (4096 - ratio)) >> 12; + data3 = (data3 * ratio + data3p * (4096 - ratio)) >> 12; } data1 += data2; data0 += data3; data0 += data1; { - uae_u32 data = SBASEVAL16(2) + data0; - FINISH_DATA (data, 16, 2); - PUT_SOUND_WORD (data); + uae_u32 data = SBASEVAL16(2) + data0; + FINISH_DATA (data, 16, 2); + PUT_SOUND_WORD (data); } check_sound_buffers (); } @@ -508,15 +508,15 @@ void sample16s_handler (void) data0 += data3; { uae_u32 data = SBASEVAL16(1) + data0; - FINISH_DATA (data, 16, 1); - put_sound_word_left (data); + FINISH_DATA (data, 16, 1); + put_sound_word_left (data); } data1 += data2; { - uae_u32 data = SBASEVAL16(1) + data1; - FINISH_DATA (data, 16, 1); - put_sound_word_right (data); + uae_u32 data = SBASEVAL16(1) + data1; + FINISH_DATA (data, 16, 1); + put_sound_word_right (data); } check_sound_buffers (); @@ -552,49 +552,49 @@ void sample16si_crux_handler (void) data3p &= audio_channel[3].adk_mask; { - struct audio_channel_data *cdp; - unsigned long ratio, ratio1; -#define INTERVAL (scaled_sample_evtime * 3) - cdp = audio_channel + 0; - ratio1 = cdp->per - cdp->evtime; - ratio = (ratio1 << 12) / INTERVAL; - if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL) + struct audio_channel_data *cdp; + unsigned long ratio, ratio1; +#define INTERVAL (scaled_sample_evtime * 3) + cdp = audio_channel + 0; + ratio1 = cdp->per - cdp->evtime; + ratio = (ratio1 << 12) / INTERVAL; + if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL) ratio = 4096; - data0 = (data0 * ratio + data0p * (4096 - ratio)) >> 12; + data0 = (data0 * ratio + data0p * (4096 - ratio)) >> 12; - cdp = audio_channel + 1; - ratio1 = cdp->per - cdp->evtime; - ratio = (ratio1 << 12) / INTERVAL; - if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL) + cdp = audio_channel + 1; + ratio1 = cdp->per - cdp->evtime; + ratio = (ratio1 << 12) / INTERVAL; + if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL) ratio = 4096; - data1 = (data1 * ratio + data1p * (4096 - ratio)) >> 12; + data1 = (data1 * ratio + data1p * (4096 - ratio)) >> 12; - cdp = audio_channel + 2; - ratio1 = cdp->per - cdp->evtime; - ratio = (ratio1 << 12) / INTERVAL; - if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL) + cdp = audio_channel + 2; + ratio1 = cdp->per - cdp->evtime; + ratio = (ratio1 << 12) / INTERVAL; + if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL) ratio = 4096; - data2 = (data2 * ratio + data2p * (4096 - ratio)) >> 12; + data2 = (data2 * ratio + data2p * (4096 - ratio)) >> 12; - cdp = audio_channel + 3; - ratio1 = cdp->per - cdp->evtime; - ratio = (ratio1 << 12) / INTERVAL; - if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL) + cdp = audio_channel + 3; + ratio1 = cdp->per - cdp->evtime; + ratio = (ratio1 << 12) / INTERVAL; + if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL) ratio = 4096; - data3 = (data3 * ratio + data3p * (4096 - ratio)) >> 12; + data3 = (data3 * ratio + data3p * (4096 - ratio)) >> 12; } data1 += data2; data0 += data3; { uae_u32 data = SBASEVAL16(1) + data0; - FINISH_DATA (data, 16, 1); - put_sound_word_left (data); + FINISH_DATA (data, 16, 1); + put_sound_word_left (data); } { - uae_u32 data = SBASEVAL16(1) + data1; - FINISH_DATA (data, 16, 1); - put_sound_word_right (data); + uae_u32 data = SBASEVAL16(1) + data1; + FINISH_DATA (data, 16, 1); + put_sound_word_right (data); } check_sound_buffers (); } @@ -645,14 +645,14 @@ void sample16si_rh_handler (void) data0 += (data3 * (256 - ratio) + data3p * ratio) >> 8; { uae_u32 data = SBASEVAL16(1) + data0; - FINISH_DATA (data, 16, 1); - put_sound_word_left (data); + FINISH_DATA (data, 16, 1); + put_sound_word_left (data); } { - uae_u32 data = SBASEVAL16(1) + data1; - FINISH_DATA (data, 16, 1); - put_sound_word_right (data); + uae_u32 data = SBASEVAL16(1) + data1; + FINISH_DATA (data, 16, 1); + put_sound_word_right (data); } check_sound_buffers (); } @@ -701,7 +701,7 @@ static void setirq (int nr) INTREQ (0x8000 | (0x80 << nr)); #ifdef DEBUG_AUDIO if (debugchannel (nr)) - write_log ("SETIRQ %d %08.8X\n", nr, m68k_getpc()); + write_log ("SETIRQ %d %08.8X\n", nr, m68k_getpc()); #endif } @@ -783,10 +783,10 @@ static void audio_handler (int nr, int timed) } cdp->state = 5; if (cdp->wlen != 1) - cdp->wlen = (cdp->wlen - 1) & 0xFFFF; + cdp->wlen = (cdp->wlen - 1) & 0xFFFF; cdp->request_word = 2; if (current_hpos () > maxhpos - 20) - cdp->request_word_skip = 1; + cdp->request_word_skip = 1; return; case 5: @@ -798,12 +798,12 @@ static void audio_handler (int nr, int timed) if (!cdp->dmaen) { cdp->state = 0; cdp->request_word = 0; - return; + return; } cdp->state = 2; cdp->request_word = 3; if (napnav) - cdp->request_word = 2; + cdp->request_word = 2; cdp->dat = cdp->dat2; return; @@ -812,10 +812,10 @@ static void audio_handler (int nr, int timed) cdp->per = PERIOD_MAX; if (!cdp->dmaen && isirq (nr) && ((cdp->per <= 30 ) || (evtime == 0 || evtime == MAX_EV || evtime == cdp->per))) { - cdp->state = 0; - cdp->evtime = MAX_EV; - cdp->request_word = 0; - return; + cdp->state = 0; + cdp->evtime = MAX_EV; + cdp->request_word = 0; + return; } state23 (cdp); @@ -829,7 +829,7 @@ static void audio_handler (int nr, int timed) setirq (nr); cdp->intreq2 = 0; cdp->request_word = 1; - cdp->dat = cdp->dat2; + cdp->dat = cdp->dat2; if (nr < 3) { if (cdp->dat == 0) (cdp+1)->per = PERIOD_MAX; @@ -839,7 +839,7 @@ static void audio_handler (int nr, int timed) (cdp+1)->per = cdp->dat * CYCLE_UNIT; } } - return; + return; case 3: if (currprefs.produce_sound == 0) @@ -853,7 +853,7 @@ static void audio_handler (int nr, int timed) if (cdp->dmaen) { if (napnav) cdp->request_word = 1; - if (cdp->intreq2 && napnav) + if (cdp->intreq2 && napnav) setirq (nr); } else { if (napnav) @@ -870,7 +870,7 @@ static void audio_handler (int nr, int timed) #endif } } - return; + return; } } @@ -899,7 +899,7 @@ void audio_reset (void) } } -#ifndef MULTIPLICATION_PROFITABLE +#ifndef MULTIPLICATION_PROFITABLE for (i = 0; i < 4; i++) audio_channel[i].voltbl = sound_table[audio_channel[i].vol]; #endif @@ -1003,13 +1003,13 @@ void update_audio (void) for (;;) { unsigned long int best_evtime = n_cycles + 1; - if (audio_channel[0].evtime != MAX_EV && best_evtime > audio_channel[0].evtime) + if (audio_channel[0].evtime != MAX_EV && best_evtime > audio_channel[0].evtime) best_evtime = audio_channel[0].evtime; - if (audio_channel[1].evtime != MAX_EV && best_evtime > audio_channel[1].evtime) + if (audio_channel[1].evtime != MAX_EV && best_evtime > audio_channel[1].evtime) best_evtime = audio_channel[1].evtime; - if (audio_channel[2].evtime != MAX_EV && best_evtime > audio_channel[2].evtime) + if (audio_channel[2].evtime != MAX_EV && best_evtime > audio_channel[2].evtime) best_evtime = audio_channel[2].evtime; - if (audio_channel[3].evtime != MAX_EV && best_evtime > audio_channel[3].evtime) + if (audio_channel[3].evtime != MAX_EV && best_evtime > audio_channel[3].evtime) best_evtime = audio_channel[3].evtime; if (currprefs.produce_sound > 1 && best_evtime > next_sample_evtime) @@ -1018,13 +1018,13 @@ void update_audio (void) if (best_evtime > n_cycles) break; - if (audio_channel[0].evtime != MAX_EV) + if (audio_channel[0].evtime != MAX_EV) audio_channel[0].evtime -= best_evtime; - if (audio_channel[1].evtime != MAX_EV) + if (audio_channel[1].evtime != MAX_EV) audio_channel[1].evtime -= best_evtime; - if (audio_channel[2].evtime != MAX_EV) + if (audio_channel[2].evtime != MAX_EV) audio_channel[2].evtime -= best_evtime; - if (audio_channel[3].evtime != MAX_EV) + if (audio_channel[3].evtime != MAX_EV) audio_channel[3].evtime -= best_evtime; n_cycles -= best_evtime; @@ -1035,13 +1035,13 @@ void update_audio (void) (*sample_handler) (); } } - if (audio_channel[0].evtime == 0) + if (audio_channel[0].evtime == 0) audio_handler (0, 1); - if (audio_channel[1].evtime == 0) + if (audio_channel[1].evtime == 0) audio_handler (1, 1); - if (audio_channel[2].evtime == 0) + if (audio_channel[2].evtime == 0) audio_handler (2, 1); - if (audio_channel[3].evtime == 0) + if (audio_channel[3].evtime == 0) audio_handler (3, 1); } last_cycles = get_cycles () - n_cycles; @@ -1056,7 +1056,7 @@ void audio_evhandler (void) #ifdef CPUEMU_6 extern uae_u8 cycle_line[]; #endif -uae_u16 dmacon; +uae_u16 dmacon; void audio_hsync (int dmaaction) { @@ -1069,11 +1069,11 @@ void audio_hsync (int dmaaction) handle = 0; /* Sound data is fetched at the beginning of each line */ for (nr = 0; nr < 4; nr++) { - struct audio_channel_data *cdp = audio_channel + nr; - int chan_ena = (dmacon & DMA_MASTER) && (dmacon & (1 << nr)); - int handle2 = 0; + struct audio_channel_data *cdp = audio_channel + nr; + int chan_ena = (dmacon & DMA_MASTER) && (dmacon & (1 << nr)); + int handle2 = 0; - if (dmaaction && cdp->request_word > 0) { + if (dmaaction && cdp->request_word > 0) { if (cdp->request_word_skip) { cdp->request_word_skip = 0; @@ -1081,7 +1081,7 @@ void audio_hsync (int dmaaction) } if (cdp->state == 5) { - cdp->pt = cdp->lc; + cdp->pt = cdp->lc; if (sampleripper_enabled) do_samplerip(cdp); #ifdef DEBUG_AUDIO @@ -1106,7 +1106,7 @@ void audio_hsync (int dmaaction) if (cdp->dmaen != chan_ena) { #ifdef DEBUG_AUDIO if (debugchannel (nr)) - write_log ("AUD%dDMA %d->%d (%d) LEN=%d/%d %08.8X\n", nr, cdp->dmaen, chan_ena, + write_log ("AUD%dDMA %d->%d (%d) LEN=%d/%d %08.8X\n", nr, cdp->dmaen, chan_ena, cdp->state, cdp->wlen, cdp->len, m68k_getpc()); #endif cdp->dmaen = chan_ena; @@ -1139,7 +1139,7 @@ void AUDxDAT (int nr, uae_u16 v) if (cdp->state == 0) { cdp->state = 2; audio_handler (nr, 0); - schedule_audio (); + schedule_audio (); events_schedule (); } } @@ -1150,7 +1150,7 @@ void AUDxLCH (int nr, uae_u16 v) audio_channel[nr].lc = (audio_channel[nr].lc & 0xffff) | ((uae_u32)v << 16); #ifdef DEBUG_AUDIO if (debugchannel (nr)) - write_log ("AUD%dLCH: %04.4X %p\n", nr, v, m68k_getpc()); + write_log ("AUD%dLCH: %04.4X %p\n", nr, v, m68k_getpc()); #endif } @@ -1160,7 +1160,7 @@ void AUDxLCL (int nr, uae_u16 v) audio_channel[nr].lc = (audio_channel[nr].lc & ~0xffff) | (v & 0xFFFE); #ifdef DEBUG_AUDIO if (debugchannel (nr)) - write_log ("AUD%dLCL: %04.4X %p\n", nr, v, m68k_getpc()); + write_log ("AUD%dLCL: %04.4X %p\n", nr, v, m68k_getpc()); #endif } @@ -1186,7 +1186,7 @@ void AUDxPER (int nr, uae_u16 v) audio_channel[nr].per = per; #ifdef DEBUG_AUDIO if (debugchannel (nr)) - write_log ("AUD%dPER: %d %p\n", nr, v, m68k_getpc()); + write_log ("AUD%dPER: %d %p\n", nr, v, m68k_getpc()); #endif } @@ -1196,7 +1196,7 @@ void AUDxLEN (int nr, uae_u16 v) audio_channel[nr].len = v; #ifdef DEBUG_AUDIO if (debugchannel (nr)) - write_log ("AUD%dLEN: %d %p\n", nr, v, m68k_getpc()); + write_log ("AUD%dLEN: %d %p\n", nr, v, m68k_getpc()); #endif } @@ -1205,12 +1205,12 @@ void AUDxVOL (int nr, uae_u16 v) int v2 = v & 64 ? 63 : v & 63; update_audio (); audio_channel[nr].vol = v2; -#ifndef MULTIPLICATION_PROFITABLE +#ifndef MULTIPLICATION_PROFITABLE audio_channel[nr].voltbl = sound_table[v2]; #endif #ifdef DEBUG_AUDIO if (debugchannel (nr)) - write_log ("AUD%dVOL: %d %p\n", nr, v2, m68k_getpc()); + write_log ("AUD%dVOL: %d %p\n", nr, v2, m68k_getpc()); #endif } diff --git a/autoconf.c b/autoconf.c index e9d9c2e1..a9082c9a 100755 --- a/autoconf.c +++ b/autoconf.c @@ -21,7 +21,7 @@ #include "osdep/exectasks.h" /* We'll need a lot of these. */ -#define MAX_TRAPS 4096 +#define MAX_TRAPS 4096 static TrapFunction traps[MAX_TRAPS]; static int trapmode[MAX_TRAPS]; static const char *trapstr[MAX_TRAPS]; @@ -37,7 +37,7 @@ int lasttrap; /* Stack management */ -/* The mechanism for doing m68k calls from native code is as follows: +/* The mechanism for doing m68k calls from native code is as follows: * * m68k code executes, stack is main * calltrap to execute_fn_on_extra_stack. new stack is allocated @@ -196,7 +196,7 @@ static uae_u32 call_m68k (uaecptr addr, int saveregs) volatile int do_save = saveregs; sm_log("\nDoing call_m68k (addr=%08x, savereg=%d) extra_stack=%p\n", - addr,saveregs,current_extra_stack); + addr,saveregs,current_extra_stack); if (current_extra_stack != NULL) { @@ -384,7 +384,7 @@ void REGPARAM2 call_calltrap (int func) static volatile int four = 4; uaecptr libemu_InstallFunctionFlags (TrapFunction f, uaecptr libbase, int offset, - int flags, const char *tracename) + int flags, const char *tracename) { int i; uaecptr retval; diff --git a/blitter.c b/blitter.c index 1338894e..d6c61b2a 100755 --- a/blitter.c +++ b/blitter.c @@ -175,7 +175,7 @@ STATIC_INLINE int channel_state (int cycles) if (cycles < 0) return 0; if (cycles < blit_diag[0]) - return blit_diag[blit_diag[1] + 2 + cycles]; + return blit_diag[blit_diag[1] + 2 + cycles]; return blit_diag[((cycles - blit_diag[0]) % blit_diag[1]) + 2]; } @@ -271,7 +271,7 @@ static void blitter_dofast(void) int ifemode = blitife ? 2 : 0; int fc1 = blit_filltable[d & 255][ifemode + blitfc][1]; blt_info.bltddat = (blit_filltable[d & 255][ifemode + blitfc][0] - + (blit_filltable[d >> 8][ifemode + fc1][0] << 8)); + + (blit_filltable[d >> 8][ifemode + fc1][0] << 8)); blitfc = blit_filltable[d >> 8][ifemode + fc1][1]; } if (blt_info.bltddat) @@ -364,7 +364,7 @@ static void blitter_dofast_desc(void) int ifemode = blitife ? 2 : 0; int fc1 = blit_filltable[d & 255][ifemode + blitfc][1]; blt_info.bltddat = (blit_filltable[d & 255][ifemode + blitfc][0] - + (blit_filltable[d >> 8][ifemode + fc1][0] << 8)); + + (blit_filltable[d >> 8][ifemode + fc1][0] << 8)); blitfc = blit_filltable[d >> 8][ifemode + fc1][1]; } if (blt_info.bltddat) @@ -394,7 +394,7 @@ STATIC_INLINE void blitter_read(void) if (bltcon0 & 0x200) { if (!dmaen(DMA_BLITTER)) return; - blt_info.bltcdat = chipmem_bank.wget(bltcpt); + blt_info.bltcdat = chipmem_bank.wget(bltcpt); } bltstate = BLT_work; } @@ -506,7 +506,7 @@ static void decide_blitter_line (int hpos) while (blit_last_hpos < hpos) { int c = blit_cyclecounter % 2; for (;;) { - if (blit_cyclecounter < 0) { + if (blit_cyclecounter < 0) { blit_cyclecounter++; break; } @@ -533,7 +533,7 @@ static void decide_blitter_line (int hpos) return; } } - break; + break; } blit_last_hpos++; } @@ -563,24 +563,24 @@ static void actually_do_blit(void) blitter_dofast_desc(); else blitter_dofast(); - bltstate = BLT_done; + bltstate = BLT_done; } } void blitter_handler(void) { if (!dmaen(DMA_BLITTER)) { - eventtab[ev_blitter].active = 1; - eventtab[ev_blitter].oldcycles = get_cycles (); - eventtab[ev_blitter].evtime = 10 * CYCLE_UNIT + get_cycles (); /* wait a little */ - return; /* gotta come back later. */ + eventtab[ev_blitter].active = 1; + eventtab[ev_blitter].oldcycles = get_cycles (); + eventtab[ev_blitter].evtime = 10 * CYCLE_UNIT + get_cycles (); /* wait a little */ + return; /* gotta come back later. */ } if (blit_slowdown > 0) { eventtab[ev_blitter].active = 1; - eventtab[ev_blitter].oldcycles = get_cycles (); - eventtab[ev_blitter].evtime = blit_slowdown * CYCLE_UNIT + get_cycles (); - blit_slowdown = -1; - return; + eventtab[ev_blitter].oldcycles = get_cycles (); + eventtab[ev_blitter].evtime = blit_slowdown * CYCLE_UNIT + get_cycles (); + blit_slowdown = -1; + return; } #ifdef BLITTER_DEBUG if (!blitter_dontdo) @@ -608,24 +608,24 @@ STATIC_INLINE uae_u16 blitter_doblit (void) if (blitter_hcounter1 == blt_info.hblitsize - 1) bltadat &= blt_info.bltalwm; if (blitdesc) - blitahold = (((uae_u32)bltadat << 16) | preva) >> blt_info.blitdownashift; + blitahold = (((uae_u32)bltadat << 16) | preva) >> blt_info.blitdownashift; else - blitahold = (((uae_u32)preva << 16) | bltadat) >> blt_info.blitashift; + blitahold = (((uae_u32)preva << 16) | bltadat) >> blt_info.blitashift; preva = bltadat; ddat = blit_func (blitahold, blt_info.bltbhold, blt_info.bltcdat, mt) & 0xFFFF; if (bltcon1 & 0x18) { - uae_u16 d = ddat; - int ifemode = blitife ? 2 : 0; - int fc1 = blit_filltable[d & 255][ifemode + blitfc][1]; - ddat = (blit_filltable[d & 255][ifemode + blitfc][0] - + (blit_filltable[d >> 8][ifemode + fc1][0] << 8)); - blitfc = blit_filltable[d >> 8][ifemode + fc1][1]; + uae_u16 d = ddat; + int ifemode = blitife ? 2 : 0; + int fc1 = blit_filltable[d & 255][ifemode + blitfc][1]; + ddat = (blit_filltable[d & 255][ifemode + blitfc][0] + + (blit_filltable[d >> 8][ifemode + fc1][0] << 8)); + blitfc = blit_filltable[d >> 8][ifemode + fc1][1]; } if (ddat) - blt_info.blitzero = 0; + blt_info.blitzero = 0; return ddat; } @@ -672,7 +672,7 @@ STATIC_INLINE void blitter_dodma (int ch) switch (ch) { case 1: - blt_info.bltadat = chipmem_agnus_wget (bltapt); + blt_info.bltadat = chipmem_agnus_wget (bltapt); bltapt += blit_add; break; case 2: @@ -742,19 +742,19 @@ void decide_blitter (int hpos) } #endif for (;;) { - if (c && !canblit (blit_last_hpos)) { + if (c && !canblit (blit_last_hpos)) { blit_misscyclecounter++; break; } if (c == 4) { if (blitter_doddma ()) { cycle_line[blit_last_hpos] |= CYCLE_BLITTER; - blit_cyclecounter++; + blit_cyclecounter++; } } else if (c) { if (blitter_vcounter1 < blt_info.vblitsize) { cycle_line[blit_last_hpos] |= CYCLE_BLITTER; - blitter_dodma (c); + blitter_dodma (c); } blit_cyclecounter++; } else { @@ -775,7 +775,7 @@ void decide_blitter (int hpos) blit_diag = blit_cycle_diagram_finald; } } - break; + break; } blit_last_hpos++; } @@ -797,14 +797,14 @@ static void blitter_force_finish (void) if (bltstate != BLT_done) { /* blitter is currently running * force finish (no blitter state support yet) - */ + */ odmacon = dmacon; dmacon |= DMA_MASTER | DMA_BLITTER; write_log ("forcing blitter finish\n"); if (currprefs.blitter_cycle_exact) { int rounds = 10000; while (bltstate != BLT_done && rounds > 0) { - memset (cycle_line, 0, maxhpos); + memset (cycle_line, 0, maxhpos); decide_blitter (maxhpos); rounds--; } @@ -833,7 +833,7 @@ static void blit_bltset (int con) if (blitline) { if (blt_info.hblitsize != 2) write_log ("weird hblitsize in linemode: %d vsize=%d PC%=%x\n", blt_info.hblitsize, blt_info.vblitsize, m68k_getpc()); - blit_diag = blit_cycle_diagram_line; + blit_diag = blit_cycle_diagram_line; blit_singlechannel = 1; } else { if (con & 2) { @@ -852,7 +852,7 @@ static void blit_bltset (int con) if (blitfill && !blitdesc) { static int warn = 1; if (warn) - write_log ("warning: blitter fill without desc (further messages suppressed) PC=%x\n", m68k_getpc()); + write_log ("warning: blitter fill without desc (further messages suppressed) PC=%x\n", m68k_getpc()); warn = 0; } blit_diag = blitfill ? blit_cycle_diagram_fill[blit_ch] : blit_cycle_diagram[blit_ch]; @@ -888,7 +888,7 @@ void blit_modset (void) blit_modaddd = mult * blt_info.bltdmod; } -void reset_blit (int bltcon) +void reset_blit (int bltcon) { if (bltstate == BLT_done) return; @@ -897,7 +897,7 @@ void reset_blit (int bltcon) blit_modset (); } -void do_blitter (int hpos) +void do_blitter (int hpos) { int cycles; #ifdef BLITTER_DEBUG @@ -923,10 +923,10 @@ void do_blitter (int hpos) blineb = (blt_info.bltbdat >> blt_info.blitbshift) | (blt_info.bltbdat << (16 - blt_info.blitbshift)); blitsign = bltcon1 & 0x40; blitonedot = 0; - cycles = blt_info.vblitsize; + cycles = blt_info.vblitsize; } else { - blit_firstline_cycles = blit_first_cycle + blit_diag[1] * blt_info.hblitsize * CYCLE_UNIT; - cycles = blt_info.vblitsize * blt_info.hblitsize; + blit_firstline_cycles = blit_first_cycle + blit_diag[1] * blt_info.hblitsize * CYCLE_UNIT; + cycles = blt_info.vblitsize * blt_info.hblitsize; } #ifdef BLITTER_DEBUG @@ -945,11 +945,11 @@ void do_blitter (int hpos) unset_special (SPCFLAG_BLTNASTY); if (dmaen(DMA_BLITPRI)) - set_special (SPCFLAG_BLTNASTY); + set_special (SPCFLAG_BLTNASTY); if (blt_info.vblitsize == 0 || (blitline && blt_info.hblitsize != 2)) { - blitter_done (); - return; + blitter_done (); + return; } if (dmaen(DMA_BLITTER)) @@ -970,7 +970,7 @@ void do_blitter (int hpos) } if (currprefs.immediate_blits) - cycles = 1; + cycles = 1; eventtab[ev_blitter].active = 1; eventtab[ev_blitter].oldcycles = get_cycles (); @@ -1019,7 +1019,7 @@ int blitnasty (void) if (!dmaen(DMA_BLITTER)) return 0; if (blit_last_cycle >= blit_diag[0] && blit_dmacount == blit_diag[1]) - return 0; + return 0; cycles = (get_cycles () - blit_first_cycle) / CYCLE_UNIT; ccnt = 0; while (blit_last_cycle < cycles) { @@ -1080,7 +1080,7 @@ uae_u8 *save_blitter (int *len, uae_u8 *dstptr) if (dstptr) dstbak = dst = dstptr; else - dstbak = dst = malloc (16); + dstbak = dst = malloc (16); save_u32((bltstate != BLT_done) ? 0 : 1); *len = dst - dstbak; return dstbak; diff --git a/blkdev.c b/blkdev.c index dbc2d38a..c730369a 100755 --- a/blkdev.c +++ b/blkdev.c @@ -32,11 +32,11 @@ static void install_driver (int flags) #ifdef WINDDK if (os_winnt && os_winnt_admin) { device_func[DF_IOCTL] = &devicefunc_win32_ioctl; - device_func[DF_SCSI] = &devicefunc_win32_spti; - installed = 1; + device_func[DF_SCSI] = &devicefunc_win32_spti; + installed = 1; } if (currprefs.win32_aspi || !installed) { - device_func[DF_SCSI] = &devicefunc_win32_aspi; + device_func[DF_SCSI] = &devicefunc_win32_aspi; device_func[DF_IOCTL] = 0; } #endif @@ -121,7 +121,7 @@ void sys_command_stop (int mode, int unitnum) int sys_command_play (int mode, int unitnum,uae_u32 startmsf, uae_u32 endmsf, int scan) { if (mode == DF_SCSI || !ioctl) { - uae_u8 cmd[12] = {0,0,0,0,0,0,0,0,0,0,0,0}; + uae_u8 cmd[12] = {0,0,0,0,0,0,0,0,0,0,0,0}; #if 0 if (scan) { cmd[0] = 0xba; @@ -142,7 +142,7 @@ int sys_command_play (int mode, int unitnum,uae_u32 startmsf, uae_u32 endmsf, in #if 0 } #endif - return device_func[DF_SCSI]->exec_out (unitnum, cmd, sizeof (cmd)) == 0 ? 0 : 1; + return device_func[DF_SCSI]->exec_out (unitnum, cmd, sizeof (cmd)) == 0 ? 0 : 1; } return device_func[DF_IOCTL]->play (unitnum, startmsf, endmsf, scan); } @@ -162,7 +162,7 @@ uae_u8 *sys_command_toc (int mode, int unitnum) { if (mode == DF_SCSI || !ioctl) { uae_u8 cmd [10] = { 0x43,0,2,0,0,0,1,DEVICE_SCSI_BUFSIZE>>8,DEVICE_SCSI_BUFSIZE&0xFF,0}; - return device_func[DF_SCSI]->exec_in (unitnum, cmd, sizeof(cmd), 0); + return device_func[DF_SCSI]->exec_in (unitnum, cmd, sizeof(cmd), 0); } return device_func[DF_IOCTL]->toc (unitnum); } @@ -175,7 +175,7 @@ uae_u8 *sys_command_read (int mode, int unitnum, int offset) cmd[3] = (uae_u8)(offset >> 16); cmd[4] = (uae_u8)(offset >> 8); cmd[5] = (uae_u8)(offset >> 0); - return device_func[DF_SCSI]->exec_in (unitnum, cmd, sizeof (cmd), 0); + return device_func[DF_SCSI]->exec_in (unitnum, cmd, sizeof (cmd), 0); } return device_func[DF_IOCTL]->read (unitnum, offset); } @@ -248,7 +248,7 @@ void scsi_atapi_fixup_post (uae_u8 *scsi_cmd, int len, uae_u8 *olddata, uae_u8 * olddata[1] = data[2]; olddata[2] = data[3]; olddata[3] = data[7]; - datalen -= 4; + datalen -= 4; if (datalen > 4) memcpy (olddata + 4, data + 8, datalen - 4); *datalenp = datalen; @@ -281,7 +281,7 @@ int sys_command_scsi_direct (int unitnum, uaecptr request) { int ret = device_func[DF_SCSI]->exec_direct (unitnum, request); if (!ret && device_func[DF_SCSI]->isatapi(unitnum)) - scsi_atapi_fixup_inquiry (request); + scsi_atapi_fixup_inquiry (request); return ret; } @@ -289,14 +289,14 @@ void scsi_log_before (uae_u8 *cdb, int cdblen, uae_u8 *data, int datalen) { int i; for (i = 0; i < cdblen; i++) { - write_log("%s%02.2X", i > 0 ? "." : "", cdb[i]); + write_log("%s%02.2X", i > 0 ? "." : "", cdb[i]); } write_log("\n"); if (data) { write_log ("DATAOUT: %d\n", datalen); - for (i = 0; i < datalen && i < 100; i++) + for (i = 0; i < datalen && i < 100; i++) write_log("%s%02.2X", i > 0 ? "." : "", data[i]); - if (datalen > 0) + if (datalen > 0) write_log("\n"); } } @@ -306,12 +306,12 @@ void scsi_log_after (uae_u8 *data, int datalen, uae_u8 *sense, int senselen) int i; write_log ("DATAIN: %d\n", datalen); for (i = 0; i < datalen && i < 100 && data; i++) - write_log("%s%02.2X", i > 0 ? "." : "", data[i]); + write_log("%s%02.2X", i > 0 ? "." : "", data[i]); if (data && datalen > 0) - write_log("\n"); + write_log("\n"); if (senselen > 0) { - write_log("SENSE: %d,", senselen); - for (i = 0; i < senselen && i < 32; i++) { + write_log("SENSE: %d,", senselen); + for (i = 0; i < senselen && i < 32; i++) { write_log("%s%02.2X", i > 0 ? "." : "", sense[i]); } write_log("\n"); diff --git a/bsdsocket.c b/bsdsocket.c index 109e7e03..62022feb 100755 --- a/bsdsocket.c +++ b/bsdsocket.c @@ -28,7 +28,7 @@ static uae_u32 SockLibBase; #define SOCKPOOLSIZE 128 -#define UNIQUE_ID (-1) +#define UNIQUE_ID (-1) /* ObtainSocket()/ReleaseSocket() public socket pool */ long sockpoolids[SOCKPOOLSIZE]; @@ -112,7 +112,7 @@ static uae_u32 gettask (void) uae_u32 currtask, a1 = m68k_areg (regs, 1); m68k_areg (regs, 1) = 0; - currtask = CallLib (get_long (4), -0x126); /* FindTask */ + currtask = CallLib (get_long (4), -0x126); /* FindTask */ m68k_areg (regs, 1) = a1; @@ -123,10 +123,9 @@ static uae_u32 gettask (void) /* errno/herrno setting */ void seterrno (SB, int sb_errno) { - sb->sb_errno = sb_errno; - - if (sb->sb_errno >= 1001 && sb->sb_errno <= 1005) setherrno(sb,sb->sb_errno-1000); - + sb->sb_errno = sb_errno; + if (sb->sb_errno >= 1001 && sb->sb_errno <= 1005) + setherrno(sb,sb->sb_errno-1000); if (sb->errnoptr) { switch (sb->errnosize) { case 1: @@ -212,7 +211,7 @@ int getsd (SB, SOCKET_TYPE s) return i + 1; } /* descriptor table full. */ - seterrno (sb, 24); /* EMFILE */ + seterrno (sb, 24); /* EMFILE */ return -1; } @@ -221,7 +220,7 @@ SOCKET_TYPE getsock (SB, int sd) { if ((unsigned int) (sd - 1) >= (unsigned int) sb->dtablesize) { TRACE (("Invalid Socket Descriptor (%d)\n", sd)); - seterrno (sb, 38); /* ENOTSOCK */ + seterrno (sb, 38); /* ENOTSOCK */ return -1; } @@ -285,7 +284,7 @@ static uae_u32 bsdsock_int_handler (void) struct regstruct sbved_regs = regs; m68k_areg (regs, 1) = sb->ownertask; m68k_dreg (regs, 0) = sb->sigstosend; - CallLib (get_long (4), -0x144); /* Signal() */ + CallLib (get_long (4), -0x144); /* Signal() */ regs = sbved_regs; @@ -306,12 +305,12 @@ void waitsig (SB) m68k_dreg (regs, 0) = (((uae_u32) 1) << sb->signal) | sb->eintrsigs; if ((sigs = CallLib (get_long (4), -0x13e)) & sb->eintrsigs) { sockabort (sb); - seterrno (sb, 4); /* EINTR */ + seterrno (sb, 4); /* EINTR */ // Set signal m68k_dreg (regs, 0) = sigs; m68k_dreg (regs, 1) = sb->eintrsigs; - sigs = CallLib (get_long (4), -0x132); /* SetSignal() */ + sigs = CallLib (get_long (4), -0x132); /* SetSignal() */ sb->eintr = 1; } else @@ -327,7 +326,7 @@ void cancelsig (SB) m68k_dreg (regs, 0) = 0; m68k_dreg (regs, 1) = ((uae_u32) 1) << sb->signal; - CallLib (get_long (4), -0x132); /* SetSignal() */ + CallLib (get_long (4), -0x132); /* SetSignal() */ } @@ -359,7 +358,7 @@ static struct socketbase *alloc_socketbase (void) for (i = sb->dtablesize; i--;) sb->dtable[i] = -1; - sb->eintrsigs = 0x1000; /* SIGBREAKF_CTRL_C */ + sb->eintrsigs = 0x1000; /* SIGBREAKF_CTRL_C */ if (!host_sbinit (sb)) { /* @@@ free everything */ @@ -385,24 +384,24 @@ static void free_socketbase (void) if ((sb = get_socketbase ()) != NULL) { m68k_dreg (regs, 0) = sb->signal; - CallLib (get_long (4), -0x150); /* FreeSignal */ + CallLib (get_long (4), -0x150); /* FreeSignal */ if (sb->hostent) { m68k_areg (regs, 1) = sb->hostent; m68k_dreg (regs, 0) = sb->hostentsize; - CallLib (get_long (4), -0xD2); /* FreeMem */ + CallLib (get_long (4), -0xD2); /* FreeMem */ } if (sb->protoent) { m68k_areg (regs, 1) = sb->protoent; m68k_dreg (regs, 0) = sb->protoentsize; - CallLib (get_long (4), -0xD2); /* FreeMem */ + CallLib (get_long (4), -0xD2); /* FreeMem */ } if (sb->servent) { m68k_areg (regs, 1) = sb->servent; m68k_dreg (regs, 0) = sb->serventsize; - CallLib (get_long (4), -0xD2); /* FreeMem */ + CallLib (get_long (4), -0xD2); /* FreeMem */ } host_sbcleanup (sb); @@ -495,7 +494,7 @@ static uae_u32 bsdsocklib_Close (void) m68k_areg (regs, 1) = base - negsize; m68k_dreg (regs, 0) = negsize + get_word (base + 18); - CallLib (get_long (4), -0xD2); /* FreeMem */ + CallLib (get_long (4), -0xD2); /* FreeMem */ TRACE (("CloseLibrary() -> [%d]\n", opencount)); @@ -506,15 +505,15 @@ static uae_u32 bsdsocklib_Close (void) static uae_u32 bsdsocklib_socket (void) { return host_socket (SOCKETBASE, m68k_dreg (regs, 0), m68k_dreg (regs, 1), - m68k_dreg (regs, 2)); + m68k_dreg (regs, 2)); } /* bind(s, name, namelen)(d0/a0/d1) */ static uae_u32 bsdsocklib_bind (void) { return host_bind (SOCKETBASE, m68k_dreg (regs, 0), m68k_areg (regs, 0), - m68k_dreg (regs, 1)); - } + m68k_dreg (regs, 1)); +} /* listen(s, backlog)(d0/d1) */ static uae_u32 bsdsocklib_listen (void) @@ -543,7 +542,7 @@ static uae_u32 bsdsocklib_sendto (void) { SB = get_socketbase (); host_sendto (sb, m68k_dreg (regs, 0), m68k_areg (regs, 0), m68k_dreg (regs, 1), - m68k_dreg (regs, 2), m68k_areg (regs, 1), m68k_dreg (regs, 3)); + m68k_dreg (regs, 2), m68k_areg (regs, 1), m68k_dreg (regs, 3)); return sb->resultval; } @@ -552,7 +551,7 @@ static uae_u32 bsdsocklib_send (void) { SB = get_socketbase (); host_sendto (sb, m68k_dreg (regs, 0), m68k_areg (regs, 0), m68k_dreg (regs, 1), - m68k_dreg (regs, 2), 0, 0); + m68k_dreg (regs, 2), 0, 0); return sb->resultval; } @@ -561,16 +560,16 @@ static uae_u32 bsdsocklib_recvfrom (void) { SB = get_socketbase (); host_recvfrom (sb, m68k_dreg (regs, 0), m68k_areg (regs, 0), m68k_dreg (regs, 1), - m68k_dreg (regs, 2), m68k_areg (regs, 1), m68k_areg (regs, 2)); + m68k_dreg (regs, 2), m68k_areg (regs, 1), m68k_areg (regs, 2)); return sb->resultval; } -/* recv(s, buf, len, flags)(d0/a0/d1/d2) */ +/* recv(s, buf, len, flags)(d0/a0/d1/d2) */ static uae_u32 bsdsocklib_recv (void) { SB = get_socketbase (); host_recvfrom (sb, m68k_dreg (regs, 0), m68k_areg (regs, 0), m68k_dreg (regs, 1), - m68k_dreg (regs, 2), 0, 0); + m68k_dreg (regs, 2), 0, 0); return sb->resultval; } @@ -585,7 +584,7 @@ static uae_u32 bsdsocklib_setsockopt (void) { SB = get_socketbase (); host_setsockopt (sb, m68k_dreg (regs, 0), m68k_dreg (regs, 1), m68k_dreg (regs, 2), - m68k_areg (regs, 0), m68k_dreg (regs, 3)); + m68k_areg (regs, 0), m68k_dreg (regs, 3)); return sb->resultval; } @@ -593,7 +592,7 @@ static uae_u32 bsdsocklib_setsockopt (void) static uae_u32 bsdsocklib_getsockopt (void) { return host_getsockopt (SOCKETBASE, m68k_dreg (regs, 0), m68k_dreg (regs, 1), m68k_dreg (regs, 2), - m68k_areg (regs, 0), m68k_areg (regs, 1)); + m68k_areg (regs, 0), m68k_areg (regs, 1)); } /* getsockname(s, hostname, namelen)(d0/a0/a1) */ @@ -627,7 +626,7 @@ static uae_u32 bsdsocklib_WaitSelect (void) { SB = get_socketbase (); host_WaitSelect (sb, m68k_dreg (regs, 0), m68k_areg (regs, 0), m68k_areg (regs, 1), - m68k_areg (regs, 2), m68k_areg (regs, 3), m68k_dreg (regs, 1)); + m68k_areg (regs, 2), m68k_areg (regs, 3), m68k_dreg (regs, 1)); return sb->resultval; } @@ -705,8 +704,8 @@ static uae_u32 bsdsocklib_ReleaseSocket (void) sd = m68k_dreg (regs, 0); id = m68k_dreg (regs, 1); - - sd++; + + sd++; TRACE (("ReleaseSocket(%d,%d) -> ", sd, id)); s = getsock (sb, sd); @@ -785,7 +784,7 @@ static uae_u32 bsdsocklib_SetErrnoPtr (void) TRACE (("OK\n")); return 0; } - seterrno (sb, 22); /* EINVAL */ + seterrno (sb, 22); /* EINVAL */ return -1; } @@ -885,7 +884,7 @@ static uae_u32 bsdsocklib_getprotobyname (void) return sb->sb_errno ? 0 : sb->protoent; } -/* getprotobynumber(proto)(d0) */ +/* getprotobynumber(proto)(d0) */ static uae_u32 bsdsocklib_getprotobynumber (void) { write_log ("bsdsocket: UNSUPPORTED: getprotobynumber()\n"); @@ -971,10 +970,10 @@ static const char * const strErr = "Errlist lookup error"; uae_u32 strErrptr; -#define TAG_DONE (0L) /* terminates array of TagItems. ti_Data unused */ -#define TAG_IGNORE (1L) /* ignore this item, not end of array */ -#define TAG_MORE (2L) /* ti_Data is pointer to another array of TagItems */ -#define TAG_SKIP (3L) /* skip this and the next ti_Data items */ +#define TAG_DONE (0L) /* terminates array of TagItems. ti_Data unused */ +#define TAG_IGNORE (1L) /* ignore this item, not end of array */ +#define TAG_MORE (2L) /* ti_Data is pointer to another array of TagItems */ +#define TAG_SKIP (3L) /* skip this and the next ti_Data items */ #define TAG_USER ((uae_u32)(1L<<31)) #define SBTF_VAL 0x0000 @@ -991,23 +990,23 @@ uae_u32 strErrptr; (TAG_USER | SBTF_REF | (((code) & SBTS_CODE) << SBTB_CODE) | SBTF_SET) #define SBTM_SETVAL(code) \ (TAG_USER | (((code) & SBTS_CODE) << SBTB_CODE) | SBTF_SET) -#define SBTC_BREAKMASK 1 -#define SBTC_SIGIOMASK 2 -#define SBTC_SIGURGMASK 3 +#define SBTC_BREAKMASK 1 +#define SBTC_SIGIOMASK 2 +#define SBTC_SIGURGMASK 3 #define SBTC_SIGEVENTMASK 4 -#define SBTC_ERRNO 6 -#define SBTC_HERRNO 7 -#define SBTC_DTABLESIZE 8 -#define SBTC_FDCALLBACK 9 -#define SBTC_LOGSTAT 10 -#define SBTC_LOGTAGPTR 11 +#define SBTC_ERRNO 6 +#define SBTC_HERRNO 7 +#define SBTC_DTABLESIZE 8 +#define SBTC_FDCALLBACK 9 +#define SBTC_LOGSTAT 10 +#define SBTC_LOGTAGPTR 11 #define SBTC_LOGFACILITY 12 -#define SBTC_LOGMASK 13 -#define SBTC_ERRNOSTRPTR 14 /* */ -#define SBTC_HERRNOSTRPTR 15 /* */ -#define SBTC_IOERRNOSTRPTR 16 /* */ -#define SBTC_S2ERRNOSTRPTR 17 /* */ -#define SBTC_S2WERRNOSTRPTR 18 /* */ +#define SBTC_LOGMASK 13 +#define SBTC_ERRNOSTRPTR 14 /* */ +#define SBTC_HERRNOSTRPTR 15 /* */ +#define SBTC_IOERRNOSTRPTR 16 /* */ +#define SBTC_S2ERRNOSTRPTR 17 /* */ +#define SBTC_S2WERRNOSTRPTR 18 /* */ #define SBTC_ERRNOBYTEPTR 21 #define SBTC_ERRNOWORDPTR 22 #define SBTC_ERRNOLONGPTR 24 @@ -1017,19 +1016,19 @@ uae_u32 strErrptr; static void tagcopy (uae_u32 currtag, uae_u32 currval, uae_u32 tagptr, uae_u32 * ptr) { switch (currtag & 0x8001) { - case 0x0000: /* SBTM_GETVAL */ + case 0x0000: /* SBTM_GETVAL */ put_long (tagptr + 4, *ptr); break; - case 0x8000: /* SBTM_GETREF */ + case 0x8000: /* SBTM_GETREF */ put_long (currval, *ptr); break; - case 0x0001: /* SBTM_SETVAL */ + case 0x0001: /* SBTM_SETVAL */ *ptr = currval; break; - default: /* SBTM_SETREF */ + default: /* SBTM_SETREF */ *ptr = get_long (currval); } @@ -1224,6 +1223,7 @@ static uae_u32 bsdsocklib_init (void) { uae_u32 tmp1; int i; + write_log ("Creating UAE bsdsocket.library 4.1\n"); if (SockLibBase) bsdlib_reset (); diff --git a/catweasel.c b/catweasel.c index 1c03e94d..727e4853 100755 --- a/catweasel.c +++ b/catweasel.c @@ -26,7 +26,7 @@ int catweasel_isjoystick(void) { uae_u8 b = cwc.can_joy; if (b) { - if (cwc.type == CATWEASEL_TYPE_MK3 && cwc.sid[0]) + if (cwc.type == CATWEASEL_TYPE_MK3 && cwc.sid[0]) b |= 0x80; if (cwc.type >= CATWEASEL_TYPE_MK4) b |= 0x80; @@ -71,7 +71,7 @@ static uae_u8 get_buttons(void) if (!(b2 & 0x40)) b |= 0x08; if (cwc.type >= CATWEASEL_TYPE_MK4) { - b &= ~0x80; + b &= ~0x80; catweasel_do_bput(3, 0x81); if (!(catweasel_do_bget(0x07) & 0x10)) b |= 0x80; @@ -116,7 +116,7 @@ static void sid_reset(void) int i; for (i = 0; i < 0x19; i++) { sid_write(i, 0, 0); - sid_write(i, 0, 1); + sid_write(i, 0, 1); } } @@ -130,7 +130,7 @@ static void catweasel_detect_sid(void) return; sid_reset(); if (cwc.type >= CATWEASEL_TYPE_MK4) { - catweasel_do_bput(3, 0x81); + catweasel_do_bput(3, 0x81); b1 = catweasel_do_bget(0xd0); for (i = 0; i < 100; i++) { sid_read(0x19, 0); // delay @@ -143,17 +143,17 @@ static void catweasel_detect_sid(void) } catweasel_do_bput(3, 0x41); for (i = 0; i < 2 ;i++) { - sid_reset(); + sid_reset(); sid_write(0x0f, 0xff, i); - sid_write(0x12, 0x10, i); + sid_write(0x12, 0x10, i); for(j = 0; j != 1000; j++) { sid_write(0, 0, i); if((sid_read(0x1b, i) & 0x80) != 0) { - cwc.sid[i] = 6581; - break; + cwc.sid[i] = 6581; + break; } - } - sid_reset(); + } + sid_reset(); sid_write(0x0f, 0xff, i); sid_write(0x12, 0x30, i); for(j = 0; j != 1000; j++) { @@ -179,12 +179,12 @@ void catweasel_hsync (void) cwhsync = 10; if (handshake) { /* keyboard handshake */ - catweasel_do_bput(0xd0, 0); + catweasel_do_bput(0xd0, 0); handshake = 0; } if (cwc.type == CATWEASEL_TYPE_MK3 && cwc.sid[0]) { uae_u8 b; - cwmk3buttonsync--; + cwmk3buttonsync--; if (cwmk3buttonsync <= 0) { cwmk3buttonsync = 30; b = 0; @@ -198,7 +198,7 @@ void catweasel_hsync (void) cwmk3port = 1; } else { cwmk3port2 = b; - catweasel_do_bget(0xd4); // select port1 + catweasel_do_bget(0xd4); // select port1 cwmk3port = 0; } } @@ -255,7 +255,7 @@ int catweasel_read_keyboard (uae_u8 *keycode) return 1; } -uae_u32 catweasel_do_bget (uaecptr addr) +uae_u32 catweasel_do_bget (uaecptr addr) { DWORD did_read = 0; uae_u8 buf1[1], buf2[1]; @@ -271,7 +271,7 @@ uae_u32 catweasel_do_bget (uaecptr addr) return buf2[0]; } -void catweasel_do_bput (uaecptr addr, uae_u32 b) +void catweasel_do_bput (uaecptr addr, uae_u32 b) { uae_u8 buf[2]; DWORD did_read = 0; @@ -281,7 +281,7 @@ void catweasel_do_bput (uaecptr addr, uae_u32 b) buf[0] = (uae_u8)addr; buf[1] = b; if (handle != INVALID_HANDLE_VALUE) - DeviceIoControl (handle, CW_POKEREG_FULL, buf, 2, 0, 0, &did_read, 0); + DeviceIoControl (handle, CW_POKEREG_FULL, buf, 2, 0, 0, &did_read, 0); else ioport_write (cwc.iobase + addr, b); //write_log ("P %02.2X %02.2X %d\n", (uae_u8)addr, (uae_u8)b, did_read); @@ -364,16 +364,16 @@ int catweasel_init(void) sprintf(tmp, "CW: Catweasel MK%d @%p (%s) enabled.", cwc.type, (uae_u8*)cwc.iobase, name); if (cwc.can_sid) { - char *p = tmp + strlen(tmp); + char *p = tmp + strlen(tmp); catweasel_detect_sid(); - sprintf(p, " SID0=%d", cwc.sid[0]); + sprintf(p, " SID0=%d", cwc.sid[0]); if (cwc.can_sid > 1) { p += strlen(p); sprintf(p, " SID1=%d", cwc.sid[1]); } } write_log("%s\n", tmp); - + return 1; fail: catweasel_free (); @@ -402,7 +402,7 @@ int catweasel_detect (void) if (handle != INVALID_HANDLE_VALUE) return TRUE; for (i = 0; i < 4; i++) { - sprintf (name, "\\\\.\\CAT%u_F0", i); + sprintf (name, "\\\\.\\CAT%u_F0", i); handle = CreateFile (name, GENERIC_READ, FILE_SHARE_WRITE|FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); if (handle != INVALID_HANDLE_VALUE) @@ -463,8 +463,8 @@ static uae_u8 *mergepieces(uae_u8 *start,int len,int bits,uae_u8 *sync) } return tmpmfmbuffer; } - -#define SCANOFFSET 1 /* scanning range in bytes, -SCANOFFSET to SCANOFFSET */ + +#define SCANOFFSET 1 /* scanning range in bytes, -SCANOFFSET to SCANOFFSET */ #define SCANOFFSET2 20 #define SCANLENGHT 200 /* scanning length in bytes */ @@ -582,7 +582,7 @@ void catweasel_init_controller(catweasel_contr *c) c->io_mem = c->iobase + 0xe0; break; default: - return; + return; } c->control_register = 255; @@ -662,7 +662,7 @@ int catweasel_disk_changed(catweasel_drive *d) return ret; } -int catweasel_diskready(catweasel_drive *d) +int catweasel_diskready(catweasel_drive *d) { int ret; CWSetCReg(d->contr, d->sel, 0); @@ -819,7 +819,7 @@ static void mfmcode (uae_u16 * mfm, int words) } } -#define FLOPPY_GAP_LEN 360 +#define FLOPPY_GAP_LEN 360 static int amigados_mfmcode (uae_u8 *src, uae_u16 *dst, int num_secs, int track) { @@ -1015,7 +1015,7 @@ int catweasel_fillmfm (catweasel_drive *d, uae_u16 *mfm, int side, int clock, in for (i = 0; i < bytes + 2; i+=2) { mfm[j++] = (p1[i] << 8) | p1[i + 1]; } - return bytes * 8 + bits; + return bytes * 8 + bits; } } } else { diff --git a/cdtv.c b/cdtv.c index d6cb2f58..dcecbe63 100755 --- a/cdtv.c +++ b/cdtv.c @@ -38,7 +38,7 @@ static void cdtv_do_interrupt (void) { if (dmacmemory[0x41] & 0x10) { write_log ("cdtv doint\n"); - INTREQ (0x8008); + INTREQ (0x8008); } } diff --git a/cfgfile.c b/cfgfile.c index aba821e6..b12ac21c 100755 --- a/cfgfile.c +++ b/cfgfile.c @@ -136,7 +136,7 @@ static const char *stereomode[] = { "mono", "stereo", "4ch", "mixed", 0 }; static const char *interpolmode[] = { "none", "rh", "crux", 0 }; static const char *collmode[] = { "none", "sprites", "playfields", "full", 0 }; static const char *compmode[] = { "direct", "indirect", "indirectKS", "afterPic", 0 }; -static const char *flushmode[] = { "soft", "hard", 0 }; +static const char *flushmode[] = { "soft", "hard", 0 }; static const char *kbleds[] = { "none", "POWER", "DF0", "DF1", "DF2", "DF3", "HD", "CD", 0 }; static const char *soundfiltermode[] = { "off", "emulated", "on", 0 }; #ifdef GFXFILTER @@ -297,8 +297,8 @@ static void save_options (struct zfile *f, struct uae_prefs *p, int type) for (i = 0; i < 2; i++) { int v = i == 0 ? p->jport0 : p->jport1; - char tmp1[100], tmp2[50]; - if (v < JSEM_JOYS) { + char tmp1[100], tmp2[50]; + if (v < JSEM_JOYS) { sprintf (tmp2, "kbd%d", v + 1); } else if (v < JSEM_MICE) { sprintf (tmp2, "joy%d", v - JSEM_JOYS); @@ -342,7 +342,7 @@ static void save_options (struct zfile *f, struct uae_prefs *p, int type) #ifdef GFXFILTER if (p->gfx_filter > 0) { int i = 0; - struct uae_filter *uf; + struct uae_filter *uf; while (uaefilters[i].name) { uf = &uaefilters[i]; if (uf->type == p->gfx_filter) { @@ -363,7 +363,7 @@ static void save_options (struct zfile *f, struct uae_prefs *p, int type) i++; } } else { - cfgfile_write (f, "gfx_filter=no\n"); + cfgfile_write (f, "gfx_filter=no\n"); } cfgfile_write (f, "gfx_filter_vert_zoom=%d\n", p->gfx_filter_vert_zoom); @@ -378,6 +378,7 @@ static void save_options (struct zfile *f, struct uae_prefs *p, int type) cfgfile_write (f, "immediate_blits=%s\n", p->immediate_blits ? "true" : "false"); cfgfile_write (f, "fast_copper=%s\n", p->fast_copper ? "true" : "false"); cfgfile_write (f, "ntsc=%s\n", p->ntscmode ? "true" : "false"); + cfgfile_write (f, "genlock=%s\n", p->genlock ? "true" : "false"); cfgfile_write (f, "show_leds=%s\n", p->leds_on_screen ? "true" : "false"); cfgfile_write (f, "keyboard_leds=numlock:%s,capslock:%s,scrolllock:%s\n", kbleds[p->keyboard_leds[0]], kbleds[p->keyboard_leds[1]], kbleds[p->keyboard_leds[2]]); @@ -418,13 +419,13 @@ static void save_options (struct zfile *f, struct uae_prefs *p, int type) cfgfile_write (f, "catweasel=%d\n", p->catweasel); cfgfile_write (f, "kbd_lang=%s\n", (p->keyboard_lang == KBD_LANG_DE ? "de" - : p->keyboard_lang == KBD_LANG_DK ? "dk" - : p->keyboard_lang == KBD_LANG_ES ? "es" - : p->keyboard_lang == KBD_LANG_US ? "us" - : p->keyboard_lang == KBD_LANG_SE ? "se" - : p->keyboard_lang == KBD_LANG_FR ? "fr" - : p->keyboard_lang == KBD_LANG_IT ? "it" - : "FOO")); + : p->keyboard_lang == KBD_LANG_DK ? "dk" + : p->keyboard_lang == KBD_LANG_ES ? "es" + : p->keyboard_lang == KBD_LANG_US ? "us" + : p->keyboard_lang == KBD_LANG_SE ? "se" + : p->keyboard_lang == KBD_LANG_FR ? "fr" + : p->keyboard_lang == KBD_LANG_IT ? "it" + : "FOO")); cfgfile_write (f, "state_replay=%s\n", p->statecapture ? "yes" : "no"); cfgfile_write (f, "state_replay_rate=%d\n", p->statecapturerate); @@ -433,7 +434,7 @@ static void save_options (struct zfile *f, struct uae_prefs *p, int type) #ifdef FILESYS write_filesys_config (&currprefs, currprefs.mountinfo, UNEXPANDED, p->path_hardfile, f); if (p->filesys_no_uaefsdb) - cfgfile_write (f, "filesys_no_fsdb=%s\n", p->filesys_no_uaefsdb ? "true" : "false"); + cfgfile_write (f, "filesys_no_fsdb=%s\n", p->filesys_no_uaefsdb ? "true" : "false"); #endif write_inputdevice_config (p, f); @@ -553,10 +554,10 @@ static int getintval2 (char **p, int *result, int delim) static void set_chipset_mask (struct uae_prefs *p, int val) { p->chipset_mask = (val == 0 ? 0 - : val == 1 ? CSMASK_ECS_AGNUS - : val == 2 ? CSMASK_ECS_DENISE - : val == 3 ? CSMASK_ECS_DENISE | CSMASK_ECS_AGNUS - : CSMASK_AGA | CSMASK_ECS_DENISE | CSMASK_ECS_AGNUS); + : val == 1 ? CSMASK_ECS_AGNUS + : val == 2 ? CSMASK_ECS_DENISE + : val == 3 ? CSMASK_ECS_DENISE | CSMASK_ECS_AGNUS + : CSMASK_AGA | CSMASK_ECS_DENISE | CSMASK_ECS_AGNUS); } static int cfgfile_parse_host (struct uae_prefs *p, char *option, char *value) @@ -704,7 +705,7 @@ static int cfgfile_parse_host (struct uae_prefs *p, char *option, char *value) if (uf->x[0]) { cfgfile_strval (option, value, "gfx_filter_mode", &p->gfx_filter_filtermode, filtermode1, 0); } else { - int mt[4], j; + int mt[4], j; i = 0; if (uf->x[1]) mt[i++] = 1; if (uf->x[2]) mt[i++] = 2; @@ -812,7 +813,7 @@ static int cfgfile_parse_host (struct uae_prefs *p, char *option, char *value) } if (cfgfile_string (option, value, "keyboard_leds", tmpbuf, sizeof (tmpbuf))) { - char *tmpp2 = tmpbuf; + char *tmpp2 = tmpbuf; int i, num; p->keyboard_leds[0] = p->keyboard_leds[1] = p->keyboard_leds[2] = 0; p->keyboard_leds_in_use = 0; @@ -829,11 +830,11 @@ static int cfgfile_parse_host (struct uae_prefs *p, char *option, char *value) tmpp2 = tmpp; tmpp = strchr (tmpp2, ','); if (!tmpp) - break; + break; *tmpp++= 0; if (num >= 0) { - p->keyboard_leds[num] = match_string (kbleds, tmpp2); - if (p->keyboard_leds[num]) p->keyboard_leds_in_use = 1; + p->keyboard_leds[num] = match_string (kbleds, tmpp2); + if (p->keyboard_leds[num]) p->keyboard_leds_in_use = 1; } tmpp2 = tmpp; } @@ -853,6 +854,7 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, char *option, char *valu || cfgfile_yesno (option, value, "fast_copper", &p->fast_copper) || cfgfile_yesno (option, value, "kickshifter", &p->kickshifter) || cfgfile_yesno (option, value, "ntsc", &p->ntscmode) + || cfgfile_yesno (option, value, "genlock", &p->genlock) || cfgfile_yesno (option, value, "cpu_compatible", &p->cpu_compatible) || cfgfile_yesno (option, value, "cpu_cycle_exact", &p->cpu_cycle_exact) || cfgfile_yesno (option, value, "blitter_cycle_exact", &p->blitter_cycle_exact) @@ -943,7 +945,7 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, char *option, char *valu } if (cfgfile_intval (option, value, "cpu_speed", &p->m68k_speed, 1)) { - p->m68k_speed *= CYCLE_UNIT; + p->m68k_speed *= CYCLE_UNIT; return 1; } @@ -952,7 +954,7 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, char *option, char *valu int factor = OFFICIAL_CYCLE_UNIT / CYCLE_UNIT; p->m68k_speed = (p->m68k_speed + factor - 1) / factor; } - if (strcasecmp (value, "max") == 0) + if (strcasecmp (value, "max") == 0) p->m68k_speed = -1; return 1; } @@ -1005,7 +1007,7 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, char *option, char *valu tmpp = 0; #ifdef FILESYS tmpp = add_filesys_unit (currprefs.mountinfo, 0, aname, str, ro, secs, - heads, reserved, bs, 0, 0, 0); + heads, reserved, bs, 0, 0, 0); #endif free (str); if (tmpp) @@ -1074,7 +1076,7 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, char *option, char *valu goto invalid_fs; if (getintval2 (&tmpp, &bp, ',')) { fs = tmpp; - tmpp = strchr (tmpp, ','); + tmpp = strchr (tmpp, ','); if (tmpp != 0) *tmpp = 0; } @@ -1083,7 +1085,7 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, char *option, char *valu tmpp = 0; #ifdef FILESYS tmpp = add_filesys_unit (currprefs.mountinfo, dname, aname, str, ro, secs, - heads, reserved, bs, bp, fs, 0); + heads, reserved, bs, bp, fs, 0); #endif free (str); if (tmpp) @@ -1139,13 +1141,13 @@ static int separate_line (char *line, char *line1b, char *line2b) /* Get rid of whitespace. */ i = strlen (line2); while (i > 0 && (line2[i - 1] == '\t' || line2[i - 1] == ' ' - || line2[i - 1] == '\r' || line2[i - 1] == '\n')) + || line2[i - 1] == '\r' || line2[i - 1] == '\n')) line2[--i] = '\0'; line2 += strspn (line2, "\t \r\n"); strcpy (line2b, line2); i = strlen (line); while (i > 0 && (line[i - 1] == '\t' || line[i - 1] == ' ' - || line[i - 1] == '\r' || line[i - 1] == '\n')) + || line[i - 1] == '\r' || line[i - 1] == '\n')) line[--i] = '\0'; line += strspn (line, "\t \r\n"); strcpy (line1b, line); @@ -1273,7 +1275,7 @@ static int cfgfile_load_2 (struct uae_prefs *p, const char *filename, int real, } fh = fopen (filename, "r"); -#ifndef SINGLEFILE +#ifndef SINGLEFILE if (! fh) return 0; #endif @@ -1290,10 +1292,10 @@ static int cfgfile_load_2 (struct uae_prefs *p, const char *filename, int real, continue; type1 = type2 = 0; if (cfgfile_yesno (line1b, line2b, "config_hardware", &type1) || - cfgfile_yesno (line1b, line2b, "config_host", &type2)) { - if (type1 && type) - *type |= CONFIG_TYPE_HARDWARE; - if (type2 && type) + cfgfile_yesno (line1b, line2b, "config_host", &type2)) { + if (type1 && type) + *type |= CONFIG_TYPE_HARDWARE; + if (type2 && type) *type |= CONFIG_TYPE_HOST; continue; } @@ -1365,7 +1367,7 @@ end: return v; } -void cfgfile_backup (const char *path) +void cfgfile_backup (const char *path) { char dpath[MAX_DPATH]; @@ -1421,7 +1423,7 @@ void cfgfile_show_usage (void) write_log ("%s: %s\n", opttable[i].config_label, opttable[i].config_help); } -/* This implements the old commandline option parsing. I've re-added this +/* This implements the old commandline option parsing. I've re-added this because the new way of doing things is painful for me (it requires me to type a couple hundred characters when invoking UAE). The following is far less annoying to use. */ @@ -1812,7 +1814,6 @@ static int getconfigstoreline (struct zfile *z, char *option, char *value) } return separate_line (tmp, option, value); } - int cfgfile_handle_custom_event (char *custom, int mode) { @@ -1824,7 +1825,7 @@ int cfgfile_handle_custom_event (char *custom, int mode) if (!mode) { uae_u8 zero = 0; - configstore = zfile_fopen_empty ("configstore", 50000); + configstore = zfile_fopen_empty ("configstore", 50000); save_options (configstore, &currprefs, 0); zfile_fwrite (&zero, 1, 1, configstore); } @@ -1892,13 +1893,13 @@ int cmdlineparser (char *s, char *outp[], int max) continue; if (c == '\\') slash = 1; - if (!slash && c == '"') { + if (!slash && c == '"') { if (quote) { - quote = 0; - doout = 1; + quote = 0; + doout = 1; } else { - quote = 1; - j = -1; + quote = 1; + j = -1; } } if (!quote && c == ' ') @@ -1939,7 +1940,7 @@ uae_u32 cfgfile_uaelib_modify (uae_u32 index, uae_u32 parms, uae_u32 size, uae_u argv = 0; p = 0; if (index != 0xffffffff) { - if (!configstore) { + if (!configstore) { err = 20; goto end; } @@ -2028,8 +2029,8 @@ uae_u32 cfgfile_uaelib_modify (uae_u32 index, uae_u32 parms, uae_u32 size, uae_u if (!p) return 10; for (i = 0; i < size; i++) { - p[i] = get_byte (parms + i); - if (p[i] == 10 || p[i] == 13 || p[i] == 0) + p[i] = get_byte (parms + i); + if (p[i] == 10 || p[i] == 13 || p[i] == 0) break; } p[i] = 0; @@ -2072,7 +2073,7 @@ end: xfree (argc[i]); xfree (p); return err; -} +} uae_u32 cfgfile_uaelib (int mode, uae_u32 name, uae_u32 dst, uae_u32 maxlen) { @@ -2097,11 +2098,11 @@ uae_u32 cfgfile_uaelib (int mode, uae_u32 name, uae_u32 dst, uae_u32 maxlen) } if (sl) { - for (i = 0; i < maxlen; i++) { + for (i = 0; i < maxlen; i++) { put_byte (dst + i, sl->value[i]); if (sl->value[i] == 0) break; - } + } return dst; } return 0; @@ -2117,7 +2118,7 @@ static int configure_rom (struct uae_prefs *p, int *rom, int msg) tmp2[0] = 0; i = 0; while (rom[i] >= 0) { - rd = getromdatabyid (rom[i]); + rd = getromdatabyid (rom[i]); if (!rd) { i++; continue; @@ -2143,12 +2144,12 @@ static int configure_rom (struct uae_prefs *p, int *rom, int msg) } switch (rd->type) { - case ROMTYPE_KICK: - case ROMTYPE_KICKCD32: + case ROMTYPE_KICK: + case ROMTYPE_KICKCD32: strcpy (p->romfile, path); break; - case ROMTYPE_EXTCD32: - case ROMTYPE_EXTCDTV: + case ROMTYPE_EXTCD32: + case ROMTYPE_EXTCDTV: strcpy (p->romextfile, path); break; } @@ -2232,8 +2233,8 @@ void default_prefs (struct uae_prefs *p, int type) int i; for (i = 0;i < 10; i++) p->optcount[i] = -1; - p->optcount[0] = 4; /* How often a block has to be executed before it - is translated */ + p->optcount[0] = 4; /* How often a block has to be executed before it + is translated */ p->optcount[1] = 0; /* How often to use the naive translation */ p->optcount[2] = 0; p->optcount[3] = 0; @@ -2306,6 +2307,8 @@ void default_prefs (struct uae_prefs *p, int type) p->cpu_cycle_exact = 0; p->blitter_cycle_exact = 0; p->chipset_mask = CSMASK_ECS_AGNUS; + p->genlock = 0; + p->ntscmode = 0; p->fastmem_size = 0x00000000; p->a3000mem_size = 0x00000000; @@ -2413,7 +2416,7 @@ static void set_68020_compa (struct uae_prefs *p, int compa) if (compa > 1) { p->immediate_blits = 1; p->produce_sound = 2; - } + } } /* 0: cycle-exact @@ -2580,7 +2583,7 @@ static int bip_a500 (struct uae_prefs *p, int config, int compa, int romcheck) roms[1] = 32; p->bogomem_size = 0; p->chipset_mask = 0; - p->dfxtype[1] = -1; + p->dfxtype[1] = -1; break; case 4: // KS 1.2, OCS Agnus, 0.5M Chip roms[0] = 5; @@ -2588,7 +2591,7 @@ static int bip_a500 (struct uae_prefs *p, int config, int compa, int romcheck) roms[2] = 3; p->bogomem_size = 0; p->chipset_mask = 0; - p->dfxtype[1] = -1; + p->dfxtype[1] = -1; break; case 5: // KS 1.2, OCS Agnus, 0.5M Chip + 0.5M Slow roms[0] = 5; @@ -2632,7 +2635,6 @@ static int bip_super (struct uae_prefs *p, int config, int compa, int romcheck) return configure_rom (p, roms, romcheck); } - int build_in_prefs (struct uae_prefs *p, int model, int config, int compa, int romcheck) { int v = 0, i; diff --git a/cia.c b/cia.c index 9b5cdd3c..55316dc2 100755 --- a/cia.c +++ b/cia.c @@ -254,10 +254,10 @@ static void CIA_calctimers (void) * one pulse, it will not underflow. */ if (ciaatb == 0 || (ciaacra & 0x8) == 0) { /* Otherwise, we can determine the time of the underflow. */ - /* This may overflow, however. So just ignore this timer and - use the fact that we'll call CIA_handler for the A timer. */ + /* This may overflow, however. So just ignore this timer and + use the fact that we'll call CIA_handler for the A timer. */ #if 0 - ciaatimeb = ciaatimea + ciaala * DIV10 * ciaatb; + ciaatimeb = ciaatimea + ciaala * DIV10 * ciaatb; #endif } } @@ -277,7 +277,7 @@ static void CIA_calctimers (void) if (ciabtb == 0 || (ciabcra & 0x8) == 0) { /* Otherwise, we can determine the time of the underflow. */ #if 0 - ciabtimeb = ciabtimea + ciabla * DIV10 * ciabtb; + ciabtimeb = ciabtimea + ciabla * DIV10 * ciabtb; #endif } } @@ -286,7 +286,7 @@ static void CIA_calctimers (void) ciabtimeb = (DIV10 - div10) + DIV10 * ciabtb; } eventtab[ev_cia].active = (ciaatimea != -1 || ciaatimeb != -1 - || ciabtimea != -1 || ciabtimeb != -1); + || ciabtimea != -1 || ciabtimeb != -1); if (eventtab[ev_cia].active) { unsigned long int ciatime = ~0L; if (ciaatimea != -1) ciatime = ciaatimea; @@ -394,7 +394,7 @@ void CIA_vsync_handler () { #ifdef TOD_HACK if (currprefs.tod_hack && ciaatodon) { - struct timeval tv; + struct timeval tv; uae_u32 t, nt, rate = currprefs.ntscmode ? 60 : 50; if (tod_hack_delay > 0) { @@ -432,20 +432,20 @@ static void bfe001_change (void) v |= ~ciaadra; /* output is high when pin's direction is input */ if ((v & 2) != oldled) { int led = (v & 2) ? 0 : 1; - oldled = v & 2; - gui_led (0, led); - gui_ledstate &= ~1; - gui_data.powerled = led; + oldled = v & 2; + gui_led (0, led); + gui_ledstate &= ~1; + gui_data.powerled = led; gui_ledstate |= led; } if ((v & 1) != oldovl) { oldovl = v & 1; - if (!oldovl || ersatzkickfile) { + if (!oldovl || ersatzkickfile) { map_overlay (1); } else if (!(currprefs.chipset_mask & CSMASK_AGA)) { /* pin disconnected in AGA chipset, CD audio mute on/off on CD32 */ - map_overlay (0); - } + map_overlay (0); + } } } @@ -771,13 +771,13 @@ static void WriteCIAA (uae_u16 addr,uae_u8 val) break; case 12: CIA_update (); - ciaasdr = val; - if (ciaacra & 0x40) { + ciaasdr = val; + if (ciaacra & 0x40) { kback = 1; } else { ciaasdr_cnt = 0; - } - if ((ciaacra & 0x41) == 0x41) + } + if ((ciaacra & 0x41) == 0x41) ciaasdr_cnt = 8 * 2; CIA_calctimers (); break; @@ -826,7 +826,7 @@ static void WriteCIAB (uae_u16 addr,uae_u8 val) #endif #ifdef PARALLEL_PORT if (isprinter () < 0) - parallel_direct_write_status (val, ciabdra); + parallel_direct_write_status (val, ciabdra); #endif break; case 1: @@ -969,7 +969,7 @@ void CIA_reset (void) div10 = 0; ciaasdr_cnt = 0; ciaasdr = 0; ciabsdr_cnt = 0; ciabsdr = 0; - ciaata_passed = ciaatb_passed = ciabta_passed = ciabtb_passed = 0; + ciaata_passed = ciaatb_passed = ciabta_passed = ciabtb_passed = 0; } CIA_calctimers (); if (! ersatzkickfile) @@ -1082,7 +1082,7 @@ uae_u32 REGPARAM2 cia_bget (uaecptr addr) case 2: v = (addr & 1) ? ReadCIAA (r) : 0xff; break; - case 3: + case 3: if (currprefs.cpu_level == 0 && currprefs.cpu_compatible) v = (addr & 1) ? regs.irc : regs.irc >> 8; if (warned > 0) { @@ -1192,8 +1192,8 @@ void REGPARAM2 cia_wput (uaecptr addr, uae_u32 value) if ((addr & 0x1000) == 0) WriteCIAA (r, value & 0xff); if (((addr & 0x3000) == 0x3000) && warned > 0) { - write_log ("cia_wput: unknown CIA address %x %x\n", addr, value); - warned--; + write_log ("cia_wput: unknown CIA address %x %x\n", addr, value); + warned--; } cia_wait_post (); } @@ -1225,7 +1225,7 @@ static void cdtv_battram_reset (void) { struct zfile *f = zfile_fopen (currprefs.flashfile,"rb"); if (!f) - return; + return; zfile_fread (cdtv_battram, CDTV_NVRAM_SIZE,1 ,f); zfile_fclose (f); } @@ -1380,7 +1380,7 @@ uae_u8 *restore_cia (int num, uae_u8 *src) b = restore_u8 (); /* F CRB */ if (num) ciabcrb = b; else ciaacrb = b; -/* CIA internal data */ +/* CIA internal data */ b = restore_u8 (); /* ICR MASK */ if (num) ciabimask = b; else ciaaimask = b; diff --git a/custom.c b/custom.c index 55614bd5..1d6f6f5a 100755 --- a/custom.c +++ b/custom.c @@ -122,6 +122,12 @@ static uae_u16 lof; static int next_lineno; static enum nln_how nextline_how; static int lof_changed = 0; +/* Stupid genlock-detection prevention hack. + * We should stop calling vsync_handler() and + * hstop_handler() completely but it is not + * worth the trouble.. + */ +static int vpos_previous, hpos_previous; static uae_u32 sprtaba[256],sprtabb[256]; static uae_u32 sprite_ab_merge[256]; @@ -253,33 +259,10 @@ struct copper { unsigned int ignore_next; int vcmp, hcmp; - /* When we schedule a copper event, knowing a few things about the future - of the copper list can reduce the number of sync_with_cpu calls - dramatically. */ - unsigned int first_sync; - unsigned int regtypes_modified; int strobe; /* COPJMP1 / COPJMP2 accessed */ int last_write, last_write_hpos; }; -#define REGTYPE_NONE 0 -#define REGTYPE_COLOR 1 -#define REGTYPE_SPRITE 2 -#define REGTYPE_PLANE 4 -#define REGTYPE_BLITTER 8 -#define REGTYPE_JOYPORT 16 -#define REGTYPE_DISK 32 -#define REGTYPE_POS 64 -#define REGTYPE_AUDIO 128 - -#define REGTYPE_ALL 255 -/* Always set in regtypes_modified, to enable a forced update when things like - DMACON, BPLCON0, COPJMPx get written. */ -#define REGTYPE_FORCE 256 - - -static unsigned int regtypes[512]; - static struct copper cop_state; static int copper_enabled_thisline; static int cop_min_waittime; @@ -294,7 +277,7 @@ unsigned long int idletime; int bogusframe; #if DEBUG_COPPER -/* 10000 isn't enough! */ +/* 10000 isn't enough! */ #define NR_COPPER_RECORDS 40000 #else #define NR_COPPER_RECORDS 1 @@ -316,9 +299,9 @@ static int current_change_set; #ifdef OS_WITHOUT_MEMORY_MANAGEMENT /* sam: Those arrays uses around 7Mb of BSS... That seems */ /* too much for AmigaDOS (uae crashes as soon as one loads */ -/* it. So I use a different strategy here (realloc the */ +/* it. So I use a different strategy here (realloc the */ /* arrays when needed. That strategy might be usefull for */ -/* computer with low memory. */ +/* computer with low memory. */ struct sprite_entry *sprite_entries[2]; struct color_change *color_changes[2]; static int max_sprite_entry = 400; @@ -466,7 +449,7 @@ STATIC_INLINE void docols (struct color_entry *colentry) } } else { #endif - for (i = 0; i < 32; i++) { + for (i = 0; i < 32; i++) { int v = color_reg_get (colentry, i); if (v < 0 || v > 4095) continue; @@ -568,7 +551,7 @@ static int get_maxplanes (int res) return planes[fetchmode * 4 + res]; } -/* Disable bitplane DMA if planes > maxplanes. This is needed e.g. by the +/* Disable bitplane DMA if planes > maxplanes. This is needed e.g. by the Sanity WOC demo (at the "Party Effect"). */ STATIC_INLINE int GET_PLANES_LIMIT (uae_u16 v) { @@ -578,8 +561,8 @@ STATIC_INLINE int GET_PLANES_LIMIT (uae_u16 v) } /* The HRM says 0xD8, but that can't work... */ -#define HARD_DDF_STOP 0xd4 -#define HARD_DDF_START 0x18 +#define HARD_DDF_STOP 0xd4 +#define HARD_DDF_START 0x18 static void add_modulos (void) { @@ -703,7 +686,7 @@ static void create_cycle_diagram_table(void) cycle_sequence = &cycle_sequences[(max_planes - 1) * 8]; max_planes = 1 << max_planes; for (planes = 0; planes <= 8; planes++) { - freecycles = 0; + freecycles = 0; for (cycle = 0; cycle < 32; cycle++) cycle_diagram_table[fm][res][planes][cycle] = -1; if (planes <= max_planes) { @@ -728,7 +711,7 @@ static void create_cycle_diagram_table(void) } -/* Used by the copper. */ +/* Used by the copper. */ static int estimated_last_fetch_cycle; static int cycle_diagram_shift; @@ -762,7 +745,7 @@ static uae_u32 fetched_aga1[MAX_PLANES]; #endif /* Expansions from bplcon0/bplcon1. */ -static int toscr_res, toscr_res_first, toscr_nr_planes, fetchwidth; +static int toscr_res, toscr_res_first, toscr_nr_planes, fetchwidth; static int toscr_delay1x, toscr_delay2x, toscr_delay1, toscr_delay2; /* The number of bits left from the last fetched words. @@ -863,17 +846,17 @@ STATIC_INLINE void fetch (int nr, int fm) #endif } if (passed_plfstop == 2 && fetch_cycle >= (fetch_cycle & ~fetchunit_mask) + fetchunit - fetchstart) { - int mod; - if (fmode & 0x4000) { - if (((diwstrt >> 8) ^ vpos) & 1) - mod = bpl2mod; - else - mod = bpl1mod; - } else if (nr & 1) - mod = bpl2mod; - else - mod = bpl1mod; - bplpt[nr] += mod; + int mod; + if (fmode & 0x4000) { + if (((diwstrt >> 8) ^ vpos) & 1) + mod = bpl2mod; + else + mod = bpl1mod; + } else if (nr & 1) + mod = bpl2mod; + else + mod = bpl1mod; + bplpt[nr] += mod; } if (nr == 0) fetch_state = fetch_was_plane0; @@ -1114,7 +1097,7 @@ STATIC_INLINE void beginning_of_plane_block (int pos, int fm) #ifdef SPEEDUP -/* The usual inlining tricks - don't touch unless you know what you are doing. */ +/* The usual inlining tricks - don't touch unless you know what you are doing. */ STATIC_INLINE void long_fetch_ecs (int plane, int nwords, int weird_number_of_bits, int dma) { uae_u16 *real_pt = (uae_u16 *)pfield_xlateptr (bplpt[plane] + bpl_off[plane], nwords * 2); @@ -1253,10 +1236,10 @@ STATIC_INLINE void long_fetch_aga (int plane, int nwords, int weird_number_of_bi static void long_fetch_ecs_0 (int hpos, int nwords, int dma) { long_fetch_ecs (hpos, nwords, 0, dma); } static void long_fetch_ecs_1 (int hpos, int nwords, int dma) { long_fetch_ecs (hpos, nwords, 1, dma); } #ifdef AGA -static void long_fetch_aga_1_0 (int hpos, int nwords, int dma) { long_fetch_aga (hpos, nwords, 0, 1, dma); } -static void long_fetch_aga_1_1 (int hpos, int nwords, int dma) { long_fetch_aga (hpos, nwords, 1, 1, dma); } -static void long_fetch_aga_2_0 (int hpos, int nwords, int dma) { long_fetch_aga (hpos, nwords, 0, 2, dma); } -static void long_fetch_aga_2_1 (int hpos, int nwords, int dma) { long_fetch_aga (hpos, nwords, 1, 2, dma); } +static void long_fetch_aga_1_0 (int hpos, int nwords, int dma) { long_fetch_aga (hpos, nwords, 0, 1, dma); } +static void long_fetch_aga_1_1 (int hpos, int nwords, int dma) { long_fetch_aga (hpos, nwords, 1, 1, dma); } +static void long_fetch_aga_2_0 (int hpos, int nwords, int dma) { long_fetch_aga (hpos, nwords, 0, 2, dma); } +static void long_fetch_aga_2_1 (int hpos, int nwords, int dma) { long_fetch_aga (hpos, nwords, 1, 2, dma); } #endif static void do_long_fetch (int hpos, int nwords, int dma, int fm) @@ -1482,8 +1465,8 @@ STATIC_INLINE void update_fetch (int until, int fm) passed_plfstop = 1; if (pos <= ddfstop_to_test && pos + count > ddf2) passed_plfstop = 2; - if (pos <= ddf2 && pos + count >= ddf2 + fm_maxplane) - add_modulos (); + if (pos <= ddf2 && pos + count >= ddf2 + fm_maxplane) + add_modulos (); pos += count; fetch_cycle += count; } @@ -1570,11 +1553,11 @@ static void maybe_start_bpl_dma (int hpos) if (hpos > plfstop) return; if (ddfstate != DIW_waiting_start) - passed_plfstop = 1; + passed_plfstop = 1; start_bpl_dma (hpos, hpos); } -/* This function is responsible for turning on datafetch if necessary. */ +/* This function is responsible for turning on datafetch if necessary. */ STATIC_INLINE void decide_line (int hpos) { /* Take care of the vertical DIW. */ @@ -1590,7 +1573,7 @@ STATIC_INLINE void decide_line (int hpos) if (dmaen (DMA_BITPLANE) && diwstate == DIW_waiting_stop) { int ok = 0; - /* Test if we passed the start of the DDF window. */ + /* Test if we passed the start of the DDF window. */ if (last_decide_line_hpos < plfstrt && hpos >= plfstrt) { ok = 1; /* hack warning.. Writing to DDFSTRT when DMA should start must be ignored @@ -1598,10 +1581,10 @@ STATIC_INLINE void decide_line (int hpos) if (hpos - 2 == ddfstrt_old_hpos && ddfstrt_old_vpos == vpos) ok = 0; if (ok) { - start_bpl_dma (hpos, plfstrt); + start_bpl_dma (hpos, plfstrt); estimate_last_fetch_cycle (plfstrt); last_decide_line_hpos = hpos; -#ifndef CUSTOM_SIMPLE +#ifndef CUSTOM_SIMPLE do_sprites (plfstrt); #endif return; @@ -1609,7 +1592,7 @@ STATIC_INLINE void decide_line (int hpos) } } -#ifndef CUSTOM_SIMPLE +#ifndef CUSTOM_SIMPLE if (last_sprite_decide_line_hpos < SPR0_HPOS + 4 * MAX_SPRITES) do_sprites (hpos); #endif @@ -1650,7 +1633,7 @@ static void record_color_change (int hpos, int regno, unsigned long value) curr_color_changes[next_color_change++].value = value; } -typedef int sprbuf_res_t, cclockres_t, hwres_t, bplres_t; +typedef int sprbuf_res_t, cclockres_t, hwres_t, bplres_t; /* handle very rarely needed playfield collision (CLXDAT bit 0) */ static void do_playfield_collisions (void) @@ -1773,23 +1756,23 @@ static void do_sprite_collisions (void) if (bplcon0 & 0x400) match = 1; for (l = k; match && l < planes; l += 2) { - int t = 0; + int t = 0; if (l < thisline_decision.nr_planes) { - uae_u32 *ldata = (uae_u32 *)(line_data[next_lineno] + 2 * l * MAX_WORDS_PER_LINE); - uae_u32 word = ldata[offs >> 5]; - t = (word >> (31 - (offs & 31))) & 1; + uae_u32 *ldata = (uae_u32 *)(line_data[next_lineno] + 2 * l * MAX_WORDS_PER_LINE); + uae_u32 word = ldata[offs >> 5]; + t = (word >> (31 - (offs & 31))) & 1; #if 0 /* debug: draw collision mask */ if (1) { int m; for (m = 0; m < 5; m++) { - ldata = (uae_u32 *)(line_data[next_lineno] + 2 * m * MAX_WORDS_PER_LINE); + ldata = (uae_u32 *)(line_data[next_lineno] + 2 * m * MAX_WORDS_PER_LINE); ldata[(offs >> 5) + 1] |= 15 << (31 - (offs & 31)); } } #endif } if (clxcon_bpl_enable & (1 << l)) { - if (t != ((clxcon_bpl_match >> l) & 1)) + if (t != ((clxcon_bpl_match >> l) & 1)) match = 0; } } @@ -1840,7 +1823,7 @@ static void expand_sprres (void) } STATIC_INLINE void record_sprite_1 (uae_u16 *buf, uae_u32 datab, int num, int dbl, - unsigned int mask, int do_collisions, uae_u32 collision_mask) + unsigned int mask, int do_collisions, uae_u32 collision_mask) { int j = 0; while (datab) { @@ -1939,7 +1922,7 @@ static void record_sprite (int line, int num, int sprxp, uae_u16 *data, uae_u16 // if (ctl & 0x80) { uae_u32 state = 0x01010101 << (num & ~1); uae_u32 *stbuf = spixstate.words + (word_offs >> 2); - uae_u8 *stb1 = spixstate.bytes + word_offs; + uae_u8 *stb1 = spixstate.bytes + word_offs; for (i = 0; i < width; i += 8) { stb1[0] |= state; stb1[1] |= state; @@ -2205,7 +2188,7 @@ void compute_vsynctime (void) } } if (!fake_vblank_hz) - fake_vblank_hz = vblank_hz; + fake_vblank_hz = vblank_hz; if (turbo_emulation) vsynctime = vsynctime_orig = 1; else @@ -2227,13 +2210,13 @@ void init_hz (void) int isntsc; if ((currprefs.chipset_refreshrate == 50 && !currprefs.ntscmode) || - (currprefs.chipset_refreshrate == 60 && currprefs.ntscmode)) { - currprefs.chipset_refreshrate = 0; - changed_prefs.chipset_refreshrate = 0; + (currprefs.chipset_refreshrate == 60 && currprefs.ntscmode)) { + currprefs.chipset_refreshrate = 0; + changed_prefs.chipset_refreshrate = 0; } if (currprefs.gfx_vsync && currprefs.gfx_afullscreen) { - currprefs.chipset_refreshrate = abs (currprefs.gfx_refreshrate); - changed_prefs.chipset_refreshrate = abs (currprefs.gfx_refreshrate); + currprefs.chipset_refreshrate = abs (currprefs.gfx_refreshrate); + changed_prefs.chipset_refreshrate = abs (currprefs.gfx_refreshrate); } beamcon0 = new_beamcon0; @@ -2411,10 +2394,20 @@ STATIC_INLINE uae_u16 ADKCONR (void) { return adkcon; } + +STATIC_INLINE GETVPOS(void) +{ + return ((bplcon0 & 2) && !currprefs.genlock) ? vpos_previous : vpos; +} +STATIC_INLINE GETHPOS(void) +{ + return ((bplcon0 & 2) && !currprefs.genlock) ? hpos_previous : current_hpos (); +} + STATIC_INLINE uae_u16 VPOSR (void) { unsigned int csbit = currprefs.ntscmode ? 0x1000 : 0; - int vp = (vpos >> 8) & 7; + int vp = (GETVPOS() >> 8) & 7; #ifdef AGA csbit |= (currprefs.chipset_mask & CSMASK_AGA) ? 0x2300 : 0; #endif @@ -2422,6 +2415,9 @@ STATIC_INLINE uae_u16 VPOSR (void) if (!(currprefs.chipset_mask & CSMASK_ECS_AGNUS)) vp &= 1; vp = vp | lof | csbit; +#if 0 + write_log ("vposr %x at %x\n", vp, m68k_getpc()); +#endif return vp; } static void VPOSW (uae_u16 v) @@ -2438,8 +2434,8 @@ static void VPOSW (uae_u16 v) STATIC_INLINE uae_u16 VHPOSR (void) { - uae_u16 v = vpos << 8; - uae_u16 hp = current_hpos (); + uae_u16 v = GETVPOS() << 8; + uae_u16 hp = GETHPOS(); v |= hp; return v; } @@ -2528,7 +2524,7 @@ static void DMACON (int hpos, uae_u16 v) if (changed & (DMA_MASTER | 0x0f)) audio_hsync (0); if (changed & (DMA_MASTER | DMA_BITPLANE)) { - ddf_change = vpos; + ddf_change = vpos; if (dmaen (DMA_BITPLANE)) maybe_start_bpl_dma (hpos); } @@ -2536,7 +2532,6 @@ static void DMACON (int hpos, uae_u16 v) events_schedule(); } - #define INTDELAY static int intlev_2 (void) @@ -2547,7 +2542,7 @@ static int intlev_2 (void) int i; if (!(imask && (intena & 0x4000))) { - unset_special (SPCFLAG_INT); + unset_special (SPCFLAG_INT); return -1; } for (i = 14; i >= 0; i--) { @@ -2675,9 +2670,9 @@ static void BEAMCON0 (uae_u16 v) if (!(currprefs.chipset_mask & CSMASK_ECS_DENISE)) v &= 0x20; if (v != new_beamcon0) { - new_beamcon0 = v; + new_beamcon0 = v; if (v & ~0x20) - write_log ("warning: %04.4X written to BEAMCON0\n", v); + write_log ("warning: %04.4X written to BEAMCON0\n", v); } } } @@ -2767,6 +2762,11 @@ static void BPLCON0 (int hpos, uae_u16 v) if (bplcon0 == v) return; + if ((bplcon0 & 2) && !(v & 2)) { + vpos_previous = vpos; + hpos_previous = hpos; + } + ddf_change = vpos; decide_line (hpos); decide_fetch (hpos); @@ -3062,11 +3062,11 @@ STATIC_INLINE spr_arm (int num, int state) switch (state) { case 0: - nr_armed -= spr[num].armed; + nr_armed -= spr[num].armed; spr[num].armed = 0; break; default: - nr_armed += 1 - spr[num].armed; + nr_armed += 1 - spr[num].armed; spr[num].armed = 1; break; } @@ -3075,9 +3075,9 @@ STATIC_INLINE spr_arm (int num, int state) STATIC_INLINE void sprstartstop (struct sprite *s) { if (vpos == s->vstart) - s->dmastate = 1; + s->dmastate = 1; if (vpos == s->vstop) - s->dmastate = 0; + s->dmastate = 0; } STATIC_INLINE void SPRxCTLPOS (int num) @@ -3128,7 +3128,7 @@ STATIC_INLINE void SPRxPOS_1 (uae_u16 v, int num, int hpos) SPRxCTLPOS (num); #if SPRITE_DEBUG > 0 if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) { - write_log ("%d:%d:SPR%dPOS %04.4X P=%06.6X VSTRT=%d VSTOP=%d HSTRT=%d D=%d A=%d CP=%x PC=%x\n", + write_log ("%d:%d:SPR%dPOS %04.4X P=%06.6X VSTRT=%d VSTOP=%d HSTRT=%d D=%d A=%d CP=%x PC=%x\n", vpos, hpos, num, v, s->pt, s->vstart, s->vstop, s->xpos, spr[num].dmastate, spr[num].armed, cop_state.ip, m68k_getpc()); } #endif @@ -3144,7 +3144,7 @@ STATIC_INLINE void SPRxDATA_1 (uae_u16 v, int num, int hpos) spr_arm (num, 1); #if SPRITE_DEBUG > 1 if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) { - write_log ("%d:%d:SPR%dDATA %04.4X P=%06.6X D=%d A=%d PC=%x\n", + write_log ("%d:%d:SPR%dDATA %04.4X P=%06.6X D=%d A=%d PC=%x\n", vpos, hpos, num, v, spr[num].pt, spr[num].dmastate, spr[num].armed, m68k_getpc()); } #endif @@ -3159,7 +3159,7 @@ STATIC_INLINE void SPRxDATB_1 (uae_u16 v, int num, int hpos) #endif #if SPRITE_DEBUG > 1 if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) { - write_log ("%d:%d:SPR%dDATB %04.4X P=%06.6X D=%d A=%d PC=%x\n", + write_log ("%d:%d:SPR%dDATB %04.4X P=%06.6X D=%d A=%d PC=%x\n", vpos, hpos, num, v, spr[num].pt, spr[num].dmastate, spr[num].armed, m68k_getpc()); } #endif @@ -3175,7 +3175,7 @@ static void SPRxPTH (int hpos, uae_u16 v, int num) spr[num].pt |= (uae_u32)v << 16; #if SPRITE_DEBUG > 0 if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) { - write_log ("%d:%d:SPR%dPTH %06.6X\n", vpos, hpos, num, spr[num].pt); + write_log ("%d:%d:SPR%dPTH %06.6X\n", vpos, hpos, num, spr[num].pt); } #endif } @@ -3349,152 +3349,10 @@ STATIC_INLINE int dangerous_reg (int reg) return 1; } -#define FAST_COPPER 1 - -/* The future, Conan? - We try to look ahead in the copper list to avoid doing continuous calls - to updat_copper (which is what happens when SPCFLAG_COPPER is set). If - we find that the same effect can be achieved by setting a delayed event - and then doing multiple copper insns in one batch, we can get a massive - speedup. - - We don't try to be precise here. All copper reads take exactly 2 cycles, - the effect of bitplane contention is ignored. Trying to get it exactly - right would be much more complex and as such carry a huge risk of getting - it subtly wrong; and it would also be more expensive - we want this code - to be fast. */ -static void predict_copper (void) -{ - uaecptr ip = cop_state.ip; - unsigned int c_hpos = cop_state.hpos; - enum copper_states state = cop_state.state; - unsigned int w1, w2, cycle_count; - - switch (state) { - case COP_read1_wr_in2: - case COP_read2_wr_in2: - case COP_read1_wr_in4: - if (dangerous_reg (cop_state.saved_i1)) - return; - state = state == COP_read2_wr_in2 ? COP_read2 : COP_read1; - break; - - case COP_read1_in2: - c_hpos += 2; - state = COP_read1; - break; - - case COP_stop: - case COP_bltwait: - case COP_wait1: - case COP_skip_in4: - case COP_skip_in2: - case COP_skip1: - case COP_strobe_delay: - return; - - case COP_wait_in4: - c_hpos += 2; - /* fallthrough */ - case COP_wait_in2: - c_hpos += 2; - /* fallthrough */ - case COP_wait: - state = COP_wait; - break; - - default: - break; - } - - /* Only needed for COP_wait, but let's shut up the compiler. */ - w1 = cop_state.saved_i1; - w2 = cop_state.saved_i2; - cop_state.first_sync = c_hpos; - cop_state.regtypes_modified = REGTYPE_FORCE; - - /* Get this case out of the way, so that the loop below only has to deal - with read1 and wait. */ - if (state == COP_read2) { - w1 = cop_state.i1; - if (w1 & 1) { - w2 = chipmem_agnus_wget (ip); - if (w2 & 1) - goto done; - state = COP_wait; - c_hpos += 4; - } else if (dangerous_reg (w1)) { - c_hpos += 4; - goto done; - } else { - cop_state.regtypes_modified |= regtypes[w1 & 0x1FE]; - state = COP_read1; - c_hpos += 2; - } - ip += 2; - } - - while (c_hpos + 1 < maxhpos) { - if (state == COP_read1) { - w1 = chipmem_agnus_wget (ip); - if (w1 & 1) { - w2 = chipmem_agnus_wget (ip + 2); - if (w2 & 1) - break; - state = COP_wait; - c_hpos += 6; - } else if (dangerous_reg (w1)) { - c_hpos += 6; - break; - } else { - cop_state.regtypes_modified |= regtypes[w1 & 0x1FE]; - c_hpos += 4; - } - ip += 4; - } else if (state == COP_wait) { - if ((w2 & 0xFE) != 0xFE) - break; - else { - unsigned int vcmp = (w1 & (w2 | 0x8000)) >> 8; - unsigned int hcmp = (w1 & 0xFE); - - unsigned int vp = vpos & (((w2 >> 8) & 0x7F) | 0x80); - if (vp < vcmp) { - /* Whee. We can wait until the end of the line! */ - c_hpos = maxhpos; - } else if (vp > vcmp || hcmp <= c_hpos) { - state = COP_read1; - /* minimum wakeup time */ - c_hpos += 2; - } else { - state = COP_read1; - c_hpos = hcmp; - } - /* If this is the current instruction, remember that we don't - need to sync CPU and copper anytime soon. */ - if (cop_state.ip == ip) { - cop_state.first_sync = c_hpos; - } - } - } else - uae_abort ("predict copper %d", state); - } - - done: - cycle_count = c_hpos - cop_state.hpos; - if (cycle_count >= 8) { - unset_special (SPCFLAG_COPPER); - eventtab[ev_copper].active = 1; - eventtab[ev_copper].oldcycles = get_cycles (); - eventtab[ev_copper].evtime = get_cycles () + cycle_count * CYCLE_UNIT; - events_schedule (); - } -} - static int test_copper_dangerous (unsigned int address) { if ((address & 0x1fe) < (copcon & 2 ? ((currprefs.chipset_mask & CSMASK_AGA) ? 0 : 0x40u) : 0x80u)) { - cop_state.state = COP_stop; + cop_state.state = COP_stop; copper_enabled_thisline = 0; unset_special (SPCFLAG_COPPER); return 1; @@ -3551,7 +3409,7 @@ static int isagnus[]= { static void dump_copper (char *error, int until_hpos) { write_log("%s: vpos=%d until_hpos=%d\n", - error, vpos, until_hpos); + error, vpos, until_hpos); write_log("cvcmp=%d chcmp=%d chpos=%d cvpos=%d ci1=%04.4X ci2=%04.4X\n", cop_state.vcmp,cop_state.hcmp,cop_state.hpos,cop_state.vpos,cop_state.saved_i1,cop_state.saved_i2); write_log("cstate=%d ip=%08.8X ev_copper=%d\n", @@ -3636,7 +3494,7 @@ static void update_copper (int until_hpos) case COP_skip_in4: cop_state.state = COP_skip_in2; break; - case COP_strobe_delay: + case COP_strobe_delay: cop_state.state = COP_read1_in2; break; @@ -3646,10 +3504,10 @@ static void update_copper (int until_hpos) c_hpos += 2; #if 0 - if (copper_cant_read (old_hpos)) + if (copper_cant_read (old_hpos)) continue; #endif - if (cop_state.strobe) { + if (cop_state.strobe) { if (cop_state.strobe > 0) cop_state.ip = cop_state.strobe == 1 ? cop1lc : cop2lc; cop_state.strobe = 0; @@ -3700,7 +3558,7 @@ static void update_copper (int until_hpos) cop_state.state = COP_wait_in4; } else { unsigned int reg = cop_state.i1 & 0x1FE; - cop_state.state = isagnus[reg >> 1] ? COP_read1_wr_in2 : COP_read1_wr_in4; + cop_state.state = isagnus[reg >> 1] ? COP_read1_wr_in2 : COP_read1_wr_in4; } break; @@ -3749,20 +3607,8 @@ static void update_copper (int until_hpos) continue; hp = c_hpos & (cop_state.saved_i2 & 0xFE); - if (vp == cop_state.vcmp && hp < cop_state.hcmp) { - /* Position not reached yet. */ - if (currprefs.fast_copper && FAST_COPPER && (cop_state.saved_i2 & 0xFE) == 0xFE) { - int wait_finish = cop_state.hcmp - 2; - /* This will leave c_hpos untouched if it's equal to wait_finish. */ - if (wait_finish < c_hpos) - uae_abort ("wait_finish < c_hpos"); - else if (wait_finish <= until_hpos) { - c_hpos = wait_finish; - } else - c_hpos = until_hpos; - } + if (vp == cop_state.vcmp && hp < cop_state.hcmp) break; - } /* Now we know that the comparisons were successful. We might still have to wait for the blitter though. */ @@ -3825,12 +3671,6 @@ static void update_copper (int until_hpos) out: cop_state.hpos = c_hpos; - - /* The test against maxhpos also prevents us from calling predict_copper - when we are being called from hsync_handler, which would not only be - stupid, but actively harmful. */ - if (currprefs.fast_copper && FAST_COPPER && (regs.spcflags & SPCFLAG_COPPER) && c_hpos + 8 < maxhpos) - predict_copper (); } static void compute_spcflag_copper (void) @@ -3848,9 +3688,6 @@ static void compute_spcflag_copper (void) } copper_enabled_thisline = 1; - if (currprefs.fast_copper && FAST_COPPER) - predict_copper (); - if (! eventtab[ev_copper].active) set_special (SPCFLAG_COPPER); } @@ -3887,20 +3724,10 @@ void do_copper (void) the reason why we want to update the copper. This function is also used from hsync_handler to finish up the line; for this case, we check hpos against maxhpos. */ -STATIC_INLINE void sync_copper_with_cpu (int hpos, int do_schedule, unsigned int addr) +STATIC_INLINE void sync_copper_with_cpu (int hpos, int do_schedule) { /* Need to let the copper advance to the current position. */ if (eventtab[ev_copper].active) { - if (hpos != maxhpos) { - /* There might be reasons why we don't actually need to bother - updating the copper. */ - if (hpos < cop_state.first_sync) - return; - - if ((cop_state.regtypes_modified & regtypes[addr & 0x1FE]) == 0) - return; - } - eventtab[ev_copper].active = 0; if (do_schedule) events_schedule (); @@ -3914,7 +3741,7 @@ STATIC_INLINE uae_u16 sprite_fetch (struct sprite *s, int dma, int hpos, int cyc { uae_u16 data = last_custom_value; if (dma) { - data = last_custom_value = chipmem_agnus_wget (s->pt); + data = last_custom_value = chipmem_agnus_wget (s->pt); #ifdef CPUEMU_6 cycle_line[hpos] |= CYCLE_SPRITE; #endif @@ -3938,29 +3765,28 @@ STATIC_INLINE void do_sprites_1 (int num, int cycle, int hpos) #endif if (vpos == s->vstart) { #if SPRITE_DEBUG > 0 - if (!s->dmastate && vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) + if (!s->dmastate && vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) write_log ("%d:%d:SPR%d START\n", vpos, hpos, num); #endif - s->dmastate = 1; + s->dmastate = 1; } if (vpos == s->vstop || vpos == sprite_vblank_endline) { #if SPRITE_DEBUG > 0 - if (s->dmastate && vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) + if (s->dmastate && vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) write_log ("%d:%d:SPR%d STOP\n", vpos, hpos, num); #endif - s->dmastate = 0; + s->dmastate = 0; } if (!dmaen (DMA_SPRITE)) return; if (cycle && !s->dmacycle) - return; /* Superfrog intro flashing bee fix */ - + return; /* Superfrog intro flashing bee fix */ dma = hpos < plfstrt || diwstate != DIW_waiting_stop || !dmaen (DMA_BITPLANE); if (vpos == s->vstop || vpos == sprite_vblank_endline) { s->dmastate = 0; posctl = 1; - if (dma) { + if (dma) { data = sprite_fetch (s, dma, hpos, cycle, 0); switch (sprite_width) { @@ -3972,15 +3798,15 @@ STATIC_INLINE void do_sprites_1 (int num, int cycle, int hpos) break; } } else { - data = cycle == 0 ? sprpos[num] : sprctl[num]; + data = cycle == 0 ? sprpos[num] : sprctl[num]; } #if SPRITE_DEBUG > 1 - if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) { + if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) { write_log ("%d:%d:dma:P=%06.6X ", vpos, hpos, s->pt); } #endif //write_log ("%d:%d: %04.4X=%04.4X\n", vpos, hpos, 0x140 + cycle * 2 + num * 8, data); - if (cycle == 0) { + if (cycle == 0) { SPRxPOS_1 (data, num, hpos); s->dmacycle = 1; } else { @@ -3990,46 +3816,43 @@ STATIC_INLINE void do_sprites_1 (int num, int cycle, int hpos) } } if (s->dmastate && !posctl) { - uae_u16 data; - - data = sprite_fetch (s, dma, hpos, cycle, 1); - /* Hack for X mouse auto-calibration */ - if (num == 0 && cycle == 0) - mousehack_handle (sprctl[0], sprpos[0]); + uae_u16 data; + + data = sprite_fetch (s, dma, hpos, cycle, 1); #if SPRITE_DEBUG > 1 - if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) { + if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) { write_log ("%d:%d:dma:P=%06.6X ", vpos, hpos, s->pt); } #endif - if (cycle == 0) { - SPRxDATA_1 (dma ? data : sprdata[num][0], num, hpos); - s->dmacycle = 1; - } else { - SPRxDATB_1 (dma ? data : sprdatb[num][0], num, hpos); - spr_arm (num, 1); - } + if (cycle == 0) { + SPRxDATA_1 (dma ? data : sprdata[num][0], num, hpos); + s->dmacycle = 1; + } else { + SPRxDATB_1 (dma ? data : sprdatb[num][0], num, hpos); + spr_arm (num, 1); + } #ifdef AGA - switch (sprite_width) - { - case 64: - { + switch (sprite_width) + { + case 64: + { uae_u16 data32 = sprite_fetch (s, dma, hpos, cycle, 1); - uae_u16 data641 = sprite_fetch (s, dma, hpos, cycle, 1); - uae_u16 data642 = sprite_fetch (s, dma, hpos, cycle, 1); + uae_u16 data641 = sprite_fetch (s, dma, hpos, cycle, 1); + uae_u16 data642 = sprite_fetch (s, dma, hpos, cycle, 1); if (dma) { - if (cycle == 0) { + if (cycle == 0) { sprdata[num][3] = data642; sprdata[num][2] = data641; sprdata[num][1] = data32; - } else { + } else { sprdatb[num][3] = data642; sprdatb[num][2] = data641; sprdatb[num][1] = data32; } } } - break; - case 32: + break; + case 32: { uae_u16 data32 = sprite_fetch (s, dma, hpos, cycle, 1); if (dma) { @@ -4080,12 +3903,12 @@ static void do_sprites (int hpos) if (maxspr > SPR0_HPOS + MAX_SPRITES * 4) maxspr = SPR0_HPOS + MAX_SPRITES * 4; if (minspr < SPR0_HPOS) - minspr = SPR0_HPOS; + minspr = SPR0_HPOS; for (i = minspr; i < maxspr; i++) { int cycle = -1; int num = (i - SPR0_HPOS) / 4; - switch ((i - SPR0_HPOS) & 3) + switch ((i - SPR0_HPOS) & 3) { case 0: cycle = 0; @@ -4208,10 +4031,10 @@ static void framewait (void) int start; for (;;) { - double v = rpt_vsync () / (syncbase / 1000.0); + double v = rpt_vsync () / (syncbase / 1000.0); if (v >= -4) break; - sleep_millis_busy (2); + sleep_millis_busy (2); } curr_time = start = read_processor_time(); if (!isvsync()) { @@ -4323,7 +4146,7 @@ static void vsync_handler (void) if (quit_program > 0) { /* prevent possible infinite loop at wait_cycles().. */ framecnt = 0; - reset_decisions (); + reset_decisions (); return; } @@ -4412,9 +4235,7 @@ static void hsync_handler (void) static int ciahsync; int hpos = current_hpos (); - /* Using 0x8A makes sure that we don't accidentally trip over the - modified_regtypes check. */ - sync_copper_with_cpu (maxhpos, 0, 0x8A); + sync_copper_with_cpu (maxhpos, 0); //copper_check (1); @@ -4440,13 +4261,13 @@ static void hsync_handler (void) ciahsync++; if (ciahsync >= (currprefs.ntscmode ? MAXVPOS_NTSC : MAXVPOS_PAL) * MAXHPOS_PAL / maxhpos) { /* not so perfect.. */ - CIA_vsync_handler (); + CIA_vsync_handler (); ciahsync = 0; } #ifdef CPUEMU_6 if (currprefs.cpu_cycle_exact || currprefs.blitter_cycle_exact) { - decide_blitter (hpos); + decide_blitter (hpos); memset (cycle_line, 0, MAXHPOS); #if 1 { @@ -4536,7 +4357,7 @@ static void hsync_handler (void) next_lineno = lineno; reset_decisions (); } -#ifdef FILESYS +#ifdef FILESYS if (uae_int_requested) { set_uae_int_flag (); INTREQ (0x8000 | 0x0008); @@ -4554,57 +4375,6 @@ static void hsync_handler (void) //copper_check (2); } -static void init_regtypes (void) -{ - int i; - for (i = 0; i < 512; i += 2) { - regtypes[i] = REGTYPE_ALL; - if ((i >= 0x20 && i < 0x28) || i == 0x08 || i == 0x7E) - regtypes[i] = REGTYPE_DISK; - else if (i >= 0x68 && i < 0x70) - regtypes[i] = REGTYPE_NONE; - else if (i >= 0x40 && i < 0x78) - regtypes[i] = REGTYPE_BLITTER; - else if (i >= 0xA0 && i < 0xE0 && (i & 0xF) < 0xE) - regtypes[i] = REGTYPE_AUDIO; - else if (i >= 0xA0 && i < 0xE0) - regtypes[i] = REGTYPE_NONE; - else if (i >= 0xE0 && i < 0x100) - regtypes[i] = REGTYPE_PLANE; - else if (i >= 0x120 && i < 0x180) - regtypes[i] = REGTYPE_SPRITE; - else if (i >= 0x180 && i < 0x1C0) - regtypes[i] = REGTYPE_COLOR; - else switch (i) { - case 0x02: - /* DMACONR - setting this to REGTYPE_BLITTER will cause it to - conflict with DMACON (since that is REGTYPE_ALL), and the - blitter registers (for the BBUSY bit), but nothing else, - which is (I think) what we want. */ - regtypes[i] = REGTYPE_BLITTER; - break; - case 0x04: case 0x06: case 0x2A: case 0x2C: - regtypes[i] = REGTYPE_POS; - break; - case 0x0A: case 0x0C: - case 0x12: case 0x14: case 0x16: - case 0x36: - regtypes[i] = REGTYPE_JOYPORT; - break; - case 0x104: - case 0x102: - regtypes[i] = REGTYPE_PLANE; - break; - case 0x88: case 0x8A: - case 0x8E: case 0x90: case 0x92: case 0x94: - case 0x96: - case 0x100: - regtypes[i] |= REGTYPE_FORCE; - break; - } - } -} - void init_eventtab (void) { int i; @@ -4647,7 +4417,7 @@ void customreset (void) } #ifdef AGA } else { - for (i = 0; i < 256; i++) { + for (i = 0; i < 256; i++) { current_colors.color_regs_aga[i] = 0; current_colors.acolors[i] = CONVERT_RGB (zero); } @@ -4725,8 +4495,6 @@ void customreset (void) bogusframe = 1; - init_regtypes (); - sprite_buffer_res = currprefs.chipset_mask & CSMASK_AGA ? RES_HIRES : RES_LORES; if (savestate_state == STATE_RESTORE) { uae_u16 v; @@ -4755,7 +4523,7 @@ void customreset (void) #ifdef AGA } else { for(i = 0 ; i < 256 ; i++) { - vv = current_colors.color_regs_aga[i]; + vv = current_colors.color_regs_aga[i]; current_colors.color_regs_aga[i] = -1; record_color_change (0, i, vv); remembered_color_entry = -1; @@ -4786,14 +4554,14 @@ void customreset (void) void dumpcustom (void) { write_log ("DMACON: %x INTENA: %x INTREQ: %x VPOS: %x HPOS: %x\n", DMACONR(), - (unsigned int)intena, (unsigned int)intreq, (unsigned int)vpos, (unsigned int)current_hpos()); + (unsigned int)intena, (unsigned int)intreq, (unsigned int)vpos, (unsigned int)current_hpos()); write_log ("COP1LC: %08lx, COP2LC: %08lx COPPTR: %08lx\n", (unsigned long)cop1lc, (unsigned long)cop2lc, cop_state.ip); write_log ("DIWSTRT: %04x DIWSTOP: %04x DDFSTRT: %04x DDFSTOP: %04x\n", - (unsigned int)diwstrt, (unsigned int)diwstop, (unsigned int)ddfstrt, (unsigned int)ddfstop); + (unsigned int)diwstrt, (unsigned int)diwstop, (unsigned int)ddfstrt, (unsigned int)ddfstop); write_log ("BPLCON 0: %04x 1: %04x 2: %04x 3: %04x 4: %04x\n", bplcon0, bplcon1, bplcon2, bplcon3, bplcon4); if (timeframes) { write_log ("Average frame time: %f ms [frames: %d time: %d]\n", - (double)frametime / timeframes, timeframes, frametime); + (double)frametime / timeframes, timeframes, frametime); if (total_skipped) write_log ("Skipped frames: %d\n", total_skipped); } @@ -4864,10 +4632,6 @@ void custom_init (void) drawing_init (); - mousehack_set (mousehack_unknown); - if (needmousehack ()) - mousehack_set (mousehack_follow); - create_cycle_diagram_table (); } @@ -4930,14 +4694,14 @@ STATIC_INLINE uae_u32 REGPARAM2 custom_wget_1 (uaecptr addr, int noput) default: /* reading write-only register causes write with last value in bus */ - v = last_custom_value; + v = last_custom_value; if (!noput) { int r; int hpos = current_hpos (); - decide_line (hpos); + decide_line (hpos); decide_fetch (hpos); decide_blitter (hpos); - v = last_custom_value; + v = last_custom_value; r = custom_wput_1 (hpos, addr, v, 1); } return v; @@ -4948,7 +4712,7 @@ STATIC_INLINE uae_u32 REGPARAM2 custom_wget_1 (uaecptr addr, int noput) STATIC_INLINE custom_wget2 (uaecptr addr) { uae_u32 v; - sync_copper_with_cpu (current_hpos (), 1, addr); + sync_copper_with_cpu (current_hpos (), 1); if (currprefs.cpu_level >= 2) { if(addr >= 0xde0000 && addr <= 0xdeffff) { return 0x7f7f; @@ -4974,8 +4738,8 @@ uae_u32 REGPARAM2 custom_wget (uaecptr addr) if (addr & 1) { /* think about move.w $dff005,d0.. (68020+ only) */ - addr &= ~1; - v = custom_wget2 (addr) << 8; + addr &= ~1; + v = custom_wget2 (addr) << 8; v |= custom_wget2 (addr + 2) >> 8; return v; } @@ -5203,7 +4967,7 @@ int REGPARAM2 custom_wput_1 (int hpos, uaecptr addr, uae_u32 value, int noget) default: if (!noget) custom_wget_1 (addr, 1); - if (!(currprefs.chipset_mask & CSMASK_AGA) && (currprefs.chipset_mask & CSMASK_ECS_AGNUS)) + if (!(currprefs.chipset_mask & CSMASK_AGA) && (currprefs.chipset_mask & CSMASK_ECS_AGNUS)) last_custom_value = 0xffff; return 1; } @@ -5219,7 +4983,7 @@ void REGPARAM2 custom_wput (uaecptr addr, uae_u32 value) #ifdef CUSTOM_DEBUG write_log ("%d:%d:wput: %04.4X %04.4X pc=%p\n", hpos, vpos, addr & 0x01fe, value & 0xffff, m68k_getpc()); #endif - sync_copper_with_cpu (hpos, 1, addr); + sync_copper_with_cpu (hpos, 1); custom_wput_1 (hpos, addr, value, 0); } @@ -5411,7 +5175,7 @@ uae_u8 *save_custom (int *len, uae_u8 *dstptr, int full) if (dstptr) dstbak = dst = dstptr; else - dstbak = dst = malloc (8+256*2); + dstbak = dst = malloc (8+256*2); SL (currprefs.chipset_mask); SW (0); /* 000 ? */ @@ -5570,9 +5334,9 @@ uae_u8 *save_custom_agacolors (int *len, uae_u8 *dstptr) if (dstptr) dstbak = dst = dstptr; else - dstbak = dst = malloc (256*4); + dstbak = dst = malloc (256*4); for (i = 0; i < 256; i++) -#ifdef AGA +#ifdef AGA SL (current_colors.color_regs_aga[i]); #else SL (0); @@ -5678,19 +5442,19 @@ STATIC_INLINE int dma_cycle(void) for (;;) { int bpldma; int blitpri = dmaen (DMA_BLITPRI); - do_cycles (1 * CYCLE_UNIT); + do_cycles (1 * CYCLE_UNIT); cycles += CYCLE_UNIT; - hpos = current_hpos (); + hpos = current_hpos (); sync_copper (hpos); decide_line (hpos); - decide_fetch_ce (hpos); + decide_fetch_ce (hpos); bpldma = is_bitplane_dma (hpos); if (cycle_line[hpos] == 0 && !bpldma) { if (bltstate == BLT_done || bnasty >= 3) - break; + break; decide_blitter (hpos); if (cycle_line[hpos] == 0) - break; + break; if (!blitpri || blit_singlechannel) bnasty++; } else if (bpldma && (blit_singlechannel || !blitpri)) { @@ -5740,12 +5504,12 @@ void do_cycles_ce (long cycles) { int hpos, bpldma; while (cycles > 0) { - do_cycles (1 * CYCLE_UNIT); + do_cycles (1 * CYCLE_UNIT); cycles -= CYCLE_UNIT; - hpos = current_hpos (); + hpos = current_hpos (); sync_copper (hpos); decide_line (hpos); - decide_fetch_ce (hpos); + decide_fetch_ce (hpos); bpldma = is_bitplane_dma (hpos); if (cycle_line[hpos] == 0 && !bpldma) decide_blitter (hpos); diff --git a/debug.c b/debug.c index d92da773..de67bd23 100755 --- a/debug.c +++ b/debug.c @@ -254,75 +254,6 @@ static void dumpmem (uaecptr addr, uaecptr *nxmem, int lines) *nxmem = addr; } -static void foundmod (uae_u32 ptr, char *type) -{ - char name[21]; - uae_u8 *ptr2 = chipmemory + ptr; - int i,length; - - console_out ("Found possible %s module at 0x%lx.\n", type, ptr); - memcpy (name, ptr2, 20); - name[20] = '\0'; - - /* Browse playlist */ - length = 0; - for (i = 0x3b8; i < 0x438; i++) - if (ptr2[i] > length) - length = ptr2[i]; - - length = (length+1)*1024 + 0x43c; - - /* Add sample lengths */ - ptr2 += 0x2A; - for (i = 0; i < 31; i++, ptr2 += 30) - length += 2*((ptr2[0]<<8)+ptr2[1]); - - console_out ("Name \"%s\", Length 0x%lx bytes.\n", name, length); -} - -static void modulesearch (void) -{ - uae_u8 *p = get_real_address (0); - uae_u32 ptr; - - for (ptr = 0; ptr < allocated_chipmem - 40; ptr += 2, p += 2) { - /* Check for Mahoney & Kaktus */ - /* Anyone got the format of old 15 Sample (SoundTracker)modules? */ - if (ptr >= 0x438 && p[0] == 'M' && p[1] == '.' && p[2] == 'K' && p[3] == '.') - foundmod (ptr - 0x438, "ProTracker (31 samples)"); - - if (ptr >= 0x438 && p[0] == 'F' && p[1] == 'L' && p[2] == 'T' && p[3] == '4') - foundmod (ptr - 0x438, "Startrekker"); - - if (strncmp ((char *)p, "SMOD", 4) == 0) { - console_out ("Found possible FutureComposer 1.3 module at 0x%lx, length unknown.\n", ptr); - } - if (strncmp ((char *)p, "FC14", 4) == 0) { - console_out ("Found possible FutureComposer 1.4 module at 0x%lx, length unknown.\n", ptr); - } - if (p[0] == 0x48 && p[1] == 0xe7 && p[4] == 0x61 && p[5] == 0 - && p[8] == 0x4c && p[9] == 0xdf && p[12] == 0x4e && p[13] == 0x75 - && p[14] == 0x48 && p[15] == 0xe7 && p[18] == 0x61 && p[19] == 0 - && p[22] == 0x4c && p[23] == 0xdf && p[26] == 0x4e && p[27] == 0x75) { - console_out ("Found possible Whittaker module at 0x%lx, length unknown.\n", ptr); - } - if (p[4] == 0x41 && p[5] == 0xFA) { - int i; - - for (i = 0; i < 0x240; i += 2) - if (p[i] == 0xE7 && p[i + 1] == 0x42 && p[i + 2] == 0x41 && p[i + 3] == 0xFA) - break; - if (i < 0x240) { - uae_u8 *p2 = p + i + 4; - for (i = 0; i < 0x30; i += 2) - if (p2[i] == 0xD1 && p2[i + 1] == 0xFA) { - console_out ("Found possible MarkII module at %lx, length unknown.\n", ptr); - } - } - } - } -} - static void dump_custom_regs (void) { int len, i, j, end; @@ -1305,11 +1236,10 @@ static void debug_1 (void) case 'i': dump_vectors (); break; case 'e': dump_custom_regs (); break; case 'r': if (more_params(&inptr)) - m68k_modify (&inptr); + m68k_modify (&inptr); else - m68k_dumpstate (stdout, &nextpc); + m68k_dumpstate (stdout, &nextpc); break; - case 'M': modulesearch (); break; case 'C': cheatsearch (&inptr); break; case 'W': writeintomem (&inptr); break; case 'w': memwatch (&inptr); break; diff --git a/disk.c b/disk.c index 6d8ec58d..929b299b 100755 --- a/disk.c +++ b/disk.c @@ -67,13 +67,13 @@ #undef DEBUG_DRIVE_ID /* UAE-1ADF (ADF_EXT2) - * W reserved - * W number of tracks (default 2*80=160) + * W reserved + * W number of tracks (default 2*80=160) * - * W reserved - * W type, 0=normal AmigaDOS track, 1 = raw MFM - * L available space for track in bytes (must be even) - * L track length in bits + * W reserved + * W type, 0=normal AmigaDOS track, 1 = raw MFM + * L available space for track in bytes (must be even) + * L track length in bits */ static int side, direction; @@ -355,13 +355,13 @@ static int createfileheaderblock (struct zfile *z,uae_u8 *sector, int parent, ch extensioncounter = 0; extensionblock = getblock (bitmap); if (datasec > FS_EXTENSION_BLOCKS + 1) { - pl (sector3, 8, FS_EXTENSION_BLOCKS); - pl (sector3, FS_FLOPPY_BLOCKSIZE - 8, extensionblock); - pl (sector3, 4, extensionblock2); - disk_checksum(sector3, sector3 + 20); - writeimageblock (z, sector3, extensionblock2 * FS_FLOPPY_BLOCKSIZE); + pl (sector3, 8, FS_EXTENSION_BLOCKS); + pl (sector3, FS_FLOPPY_BLOCKSIZE - 8, extensionblock); + pl (sector3, 4, extensionblock2); + disk_checksum(sector3, sector3 + 20); + writeimageblock (z, sector3, extensionblock2 * FS_FLOPPY_BLOCKSIZE); } else { - pl (sector, 512 - 8, extensionblock); + pl (sector, 512 - 8, extensionblock); } memset (sector3, 0, FS_FLOPPY_BLOCKSIZE); pl (sector3, 0, 16); @@ -378,8 +378,8 @@ static int createfileheaderblock (struct zfile *z,uae_u8 *sector, int parent, ch datablock = 0; if (size > 0) datablock = getblock (bitmap); pl (sector2, 16, datablock); - disk_checksum(sector2, sector2 + 20); - writeimageblock (z, sector2, datablock2 * FS_FLOPPY_BLOCKSIZE); + disk_checksum(sector2, sector2 + 20); + writeimageblock (z, sector2, datablock2 * FS_FLOPPY_BLOCKSIZE); if (datasec <= FS_EXTENSION_BLOCKS + 1) pl (sector, 512 - 204 - extensioncounter * 4, datablock2); else @@ -388,8 +388,8 @@ static int createfileheaderblock (struct zfile *z,uae_u8 *sector, int parent, ch } if (datasec > FS_EXTENSION_BLOCKS) { pl (sector3, 8, extensioncounter); - disk_checksum(sector3, sector3 + 20); - writeimageblock (z, sector3, extensionblock * FS_FLOPPY_BLOCKSIZE); + disk_checksum(sector3, sector3 + 20); + writeimageblock (z, sector3, extensionblock * FS_FLOPPY_BLOCKSIZE); } disk_checksum(sector, sector + 20); writeimageblock (z, sector, block * FS_FLOPPY_BLOCKSIZE); @@ -503,12 +503,12 @@ static void drive_settype_id(drive *drv) else drv->drive_id = DRIVE_ID_35HD; #else - drv->drive_id = DRIVE_ID_35DD; + drv->drive_id = DRIVE_ID_35DD; #endif break; case DRV_35_DD: default: - drv->drive_id = DRIVE_ID_35DD; + drv->drive_id = DRIVE_ID_35DD; break; case DRV_525_SD: drv->drive_id = DRIVE_ID_525SD; @@ -523,17 +523,17 @@ static void drive_image_free (drive *drv) { switch (drv->filetype) { - case ADF_IPF: + case ADF_IPF: #ifdef CAPS - caps_unloadimage (drv - floppy); + caps_unloadimage (drv - floppy); #endif - break; - case ADF_FDI: + break; + case ADF_FDI: #ifdef FDI2RAW fdi2raw_header_free (drv->fdi); - drv->fdi = 0; + drv->fdi = 0; #endif - break; + break; } drv->filetype = -1; zfile_fclose (drv->diskfile); @@ -554,8 +554,8 @@ static void reset_drive(int i) gui_data.df[i][0] = 0; gui_data.crc32[i] = 0; if (currprefs.dfxtype[i] < 0) { - disabled |= 1 << i; - gui_data.drive_disabled[i] = 1; + disabled |= 1 << i; + gui_data.drive_disabled[i] = 1; } /* most internal Amiga floppy drives won't enable * diskready until motor is running at full speed @@ -570,9 +570,9 @@ static void reset_drive(int i) gui_led (i + 1, 0); drive_settype_id (drv); if (strlen (drv->newname) > 0) - strcpy (currprefs.df[i], drv->newname); + strcpy (currprefs.df[i], drv->newname); if (!drive_insert (drv, &currprefs, i, currprefs.df[i])) - disk_eject (i); + disk_eject (i); } /* code for track display */ @@ -672,13 +672,13 @@ static int read_header_ext2 (struct zfile *diskfile, trackid *trackdata, int *nu offs = 8 + 2 + 2 + (*num_tracks) * (2 + 2 + 4 + 4); for (i = 0; i < (*num_tracks); i++) { - tid = trackdata + i; - zfile_fread (buffer, 2 + 2 + 4 + 4, 1, diskfile); - tid->type = buffer[2] * 256 + buffer[3]; - tid->len = buffer[5] * 65536 + buffer[6] * 256 + buffer[7]; - tid->bitlen = buffer[9] * 65536 + buffer[10] * 256 + buffer[11]; - tid->offs = offs; - if (tid->len > 20000 && ddhd) + tid = trackdata + i; + zfile_fread (buffer, 2 + 2 + 4 + 4, 1, diskfile); + tid->type = buffer[2] * 256 + buffer[3]; + tid->len = buffer[5] * 65536 + buffer[6] * 256 + buffer[7]; + tid->bitlen = buffer[9] * 65536 + buffer[10] * 256 + buffer[11]; + tid->offs = offs; + if (tid->len > 20000 && ddhd) *ddhd = 2; tid->track = i; offs += tid->len; @@ -748,7 +748,7 @@ static int openwritefile (drive *drv, int create) drv->writediskfile = getwritefile (currprefs.df[drv - &floppy[0]], &wrprot); if (drv->writediskfile) { - drv->wrprot = wrprot; + drv->wrprot = wrprot; if (!read_header_ext2 (drv->writediskfile, drv->writetrackdata, &drv->write_num_tracks, 0)) { zfile_fclose (drv->writediskfile); drv->writediskfile = 0; @@ -842,7 +842,7 @@ static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const char if (drv->catweasel) { - drv->wrprot = 1; + drv->wrprot = 1; drv->filetype = ADF_CATWEASEL; drv->num_tracks = 80; drv->ddhd = 1; @@ -850,19 +850,19 @@ static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const char #ifdef CAPS } else if (strncmp ((char *) buffer, "CAPS", 4) == 0) { - drv->wrprot = 1; + drv->wrprot = 1; if (!caps_loadimage (drv->diskfile, drv - floppy, &num_tracks)) { zfile_fclose (drv->diskfile); drv->diskfile = 0; return 0; } - drv->num_tracks = num_tracks; - drv->filetype = ADF_IPF; + drv->num_tracks = num_tracks; + drv->filetype = ADF_IPF; #endif #ifdef FDI2RAW } else if (drv->fdi = fdi2raw_header (drv->diskfile)) { - drv->wrprot = 1; + drv->wrprot = 1; drv->num_tracks = fdi2raw_get_last_track (drv->fdi); drv->num_secs = fdi2raw_get_num_sector (drv->fdi); drv->filetype = ADF_FDI; @@ -879,7 +879,7 @@ static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const char int offs = 160 * 4 + 8; int i; - drv->wrprot = 1; + drv->wrprot = 1; drv->filetype = ADF_EXT1; drv->num_tracks = 160; drv->num_secs = 11; @@ -946,7 +946,7 @@ static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const char } } openwritefile (drv, 0); - drive_settype_id(drv); /* Set DD or HD drive */ + drive_settype_id(drv); /* Set DD or HD drive */ drive_fill_bigbuf (drv, 1); drv->mfmpos = (rand () | (rand () << 16)) % drv->tracklen; drv->prevtracklen = 0; @@ -997,7 +997,7 @@ static void drive_step (drive * drv) #endif if (drv->steplimit && get_cycles() - drv->steplimitcycle < MIN_STEPLIMIT_CYCLE) { #ifdef DISK_DEBUG2 - write_dlog (" step ignored %d", (get_cycles() - drv->steplimitcycle) / CYCLE_UNIT); + write_dlog (" step ignored %d", (get_cycles() - drv->steplimitcycle) / CYCLE_UNIT); #endif return; } @@ -1068,7 +1068,7 @@ static void drive_motor (drive * drv, int off) { if (drv->motoroff && !off) { drv->dskready_time = DSKREADY_TIME; - rand_shifter (drv); + rand_shifter (drv); #ifdef DRIVESOUND driveclick_motor (drv - floppy, drv->dskready_down_time == 0 ? 2 : 1); #endif @@ -1190,8 +1190,8 @@ static void drive_fill_bigbuf (drive * drv, int force) /* Normal AmigaDOS format track */ int sec; int dstmfmoffset = 0; - uae_u16 *dstmfmbuf = drv->bigmfmbuf; - int len = drv->num_secs * 544 + FLOPPY_GAP_LEN; + uae_u16 *dstmfmbuf = drv->bigmfmbuf; + int len = drv->num_secs * 544 + FLOPPY_GAP_LEN; memset (dstmfmbuf, 0xaa, len * 2); dstmfmoffset += FLOPPY_GAP_LEN; @@ -1357,7 +1357,7 @@ static int decode_buffer (uae_u16 *mbuf, int cyl, int drvsec, int ddhd, int file while (getmfmword (mbuf, shift) != 0x4489) { if (mbuf >= mend) - return 1; + return 1; shift++; if (shift == 16) { shift = 0; @@ -1366,7 +1366,7 @@ static int decode_buffer (uae_u16 *mbuf, int cyl, int drvsec, int ddhd, int file } while (getmfmword (mbuf, shift) == 0x4489) { if (mbuf >= mend) - return 1; + return 1; mbuf++; } @@ -1696,7 +1696,7 @@ int disk_setwriteprotect (int num, const char *name, int protect) } if (!needwritefile) - diskfile_readonly (name, protect); + diskfile_readonly (name, protect); diskfile_readonly (name2, protect); DISK_reinsert (num); return 1; @@ -2022,7 +2022,7 @@ static void disk_dmafinished (void) #ifdef DISK_DEBUG { int dr, mfmpos = -1; - write_dlog("disk dma finished %08.8X MFMpos=", dskpt); + write_dlog("disk dma finished %08.8X MFMpos=", dskpt); for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) write_log ("%d%s", floppy[dr].mfmpos, dr < MAX_FLOPPY_DRIVES - 1 ? "," : ""); write_log ("\n"); @@ -2039,7 +2039,7 @@ static void fetchnextrevolution (drive *drv) { case ADF_IPF: #ifdef CAPS - caps_loadrevolution (drv->bigmfmbuf, drv - floppy, drv->cyl * 2 + side, &drv->tracklen); + caps_loadrevolution (drv->bigmfmbuf, drv - floppy, drv->cyl * 2 + side, &drv->tracklen); #endif break; case ADF_FDI: @@ -2094,11 +2094,11 @@ static void disk_doupdate_write (drive * drv, int floppybits) int drives[4]; for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) { - drive *drv2 = &floppy[dr]; - drives[dr] = 0; - if (drv2->motoroff) + drive *drv2 = &floppy[dr]; + drives[dr] = 0; + if (drv2->motoroff) continue; - if (selected & (1 << dr)) + if (selected & (1 << dr)) continue; drives[dr] = 1; } @@ -2164,7 +2164,7 @@ static void disk_doupdate_predict (drive * drv, int startcycle) if (dskdmaen != 3) { tword <<= 1; if (unformatted (drv)) - tword |= (rand() & 0x1000) ? 1 : 0; + tword |= (rand() & 0x1000) ? 1 : 0; else tword |= getonebit (drv->bigmfmbuf, mfmpos); if ((tword & 0xffff) == dsksync) @@ -2179,7 +2179,7 @@ static void disk_doupdate_predict (drive * drv, int startcycle) indexhack = 0; } if (dskdmaen != 3 && mfmpos == drv->skipoffset) { - int skipcnt = disk_jitter; + int skipcnt = disk_jitter; while (skipcnt-- > 0) { mfmpos++; mfmpos %= drv->tracklen; @@ -2194,11 +2194,11 @@ static void disk_doupdate_predict (drive * drv, int startcycle) startcycle += drv->trackspeed; } if (drv->tracktiming[0]) - updatetrackspeed (drv, drv->mfmpos); + updatetrackspeed (drv, drv->mfmpos); if (diskevent_flag) { disk_sync_cycle = startcycle >> 8; - eventtab[ev_disk].oldcycles = get_cycles (); - eventtab[ev_disk].evtime = get_cycles () + startcycle - firstcycle; + eventtab[ev_disk].oldcycles = get_cycles (); + eventtab[ev_disk].evtime = get_cycles () + startcycle - firstcycle; eventtab[ev_disk].active = 1; events_schedule (); } @@ -2231,10 +2231,10 @@ static void disk_doupdate_read (drive * drv, int floppybits) mfmbuf[7] = 0x4444; */ while (floppybits >= drv->trackspeed) { - if (drv->tracktiming[0]) + if (drv->tracktiming[0]) updatetrackspeed (drv, drv->mfmpos); word <<= 1; - if (unformatted (drv)) + if (unformatted (drv)) word |= (rand() & 0x1000) ? 1 : 0; else word |= getonebit (drv->bigmfmbuf, drv->mfmpos); @@ -2254,23 +2254,23 @@ static void disk_doupdate_read (drive * drv, int floppybits) } if (bitoffset == 15 && dma_enable && dskdmaen == 2 && dsklength >= 0) { if (dsklength > 0) { - put_word (dskpt, word); - dskpt += 2; + put_word (dskpt, word); + dskpt += 2; #ifdef CPUEMU_6 - cycle_line[7] |= CYCLE_MISC; - cycle_line[9] |= CYCLE_MISC; + cycle_line[7] |= CYCLE_MISC; + cycle_line[9] |= CYCLE_MISC; #endif } #if 0 dma_tab[j++] = word; if (j == MAX_DISK_WORDS_PER_LINE - 1) { - write_log ("Bug: Disk DMA buffer overflow!\n"); - j--; + write_log ("Bug: Disk DMA buffer overflow!\n"); + j--; } #endif dsklength--; if (dsklength <= 0) - disk_dmafinished (); + disk_dmafinished (); } if ((bitoffset & 7) == 7) { dskbytr_val = word & 0xff; @@ -2278,7 +2278,7 @@ static void disk_doupdate_read (drive * drv, int floppybits) } if (word == dsksync) { if (adkcon & 0x400) - bitoffset = 15; + bitoffset = 15; if (dskdmaen) { #ifdef DISK_DEBUG if (dma_enable == 0) @@ -2313,8 +2313,8 @@ static void dodmafetch (void) i = 0; while (dma_tab[i] != 0xffffffff && dskdmaen != 3 && (dmacon & 0x210) == 0x210) { - put_word (dskpt, dma_tab[i++]); - dskpt += 2; + put_word (dskpt, dma_tab[i++]); + dskpt += 2; } dma_tab[0] = 0xffffffff; } @@ -2340,12 +2340,12 @@ uae_u16 DSKBYTR (int hpos) #endif if (disk_debug_mode & DISK_DEBUG_PIO) { int dr; - for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) { + for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) { drive *drv = &floppy[dr]; if (drv->motoroff) continue; if (!(selected & (1 << dr))) { - if (disk_debug_track < 0 || disk_debug_track == 2 * drv->cyl + side) { + if (disk_debug_track < 0 || disk_debug_track == 2 * drv->cyl + side) { disk_dma_debugmsg(); write_log ("DSKBYTR=%04.4X\n", v); activate_debugger(); @@ -2380,7 +2380,7 @@ static void DISK_start (void) if (drv->catweasel) drive_fill_bigbuf (drv, 1); } - drv->floppybitcounter = 0; + drv->floppybitcounter = 0; } dma_enable = (adkcon & 0x400) ? 0 : 1; } @@ -2429,11 +2429,11 @@ void DISK_update (int tohpos) if (drv->motoroff) continue; - drv->floppybitcounter += cycles; + drv->floppybitcounter += cycles; if (selected & (1 << dr)) { drv->mfmpos += drv->floppybitcounter / drv->trackspeed; drv->mfmpos %= drv->tracklen; - drv->floppybitcounter %= drv->trackspeed; + drv->floppybitcounter %= drv->trackspeed; continue; } drive_fill_bigbuf (drv, 0); @@ -2450,7 +2450,7 @@ void DISK_update (int tohpos) else disk_doupdate_read (drv, drv->floppybitcounter); disk_doupdate_predict (drv, disk_hpos); - drv->floppybitcounter %= drv->trackspeed; + drv->floppybitcounter %= drv->trackspeed; break; } } @@ -2462,7 +2462,7 @@ void DSKLEN (uae_u16 v, int hpos) DISK_update (hpos); if ((v & 0x8000) && (dsklen & 0x8000)) { dskdmaen = 2; - DISK_start (); + DISK_start (); } if (!(v & 0x8000)) { if (dskdmaen) { @@ -2494,12 +2494,12 @@ void DSKLEN (uae_u16 v, int hpos) if (((disk_debug_mode & DISK_DEBUG_DMA_READ) && dskdmaen == 2) || ((disk_debug_mode & DISK_DEBUG_DMA_WRITE) && dskdmaen == 3)) { - for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) { + for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) { drive *drv = &floppy[dr]; if (drv->motoroff) continue; if (!(selected & (1 << dr))) { - if (disk_debug_track < 0 || disk_debug_track == 2 * drv->cyl + side) { + if (disk_debug_track < 0 || disk_debug_track == 2 * drv->cyl + side) { disk_dma_debugmsg(); activate_debugger(); break; @@ -2510,17 +2510,17 @@ void DSKLEN (uae_u16 v, int hpos) #ifdef DISK_DEBUG for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) { - drive *drv = &floppy[dr]; - if (drv->motoroff) + drive *drv = &floppy[dr]; + if (drv->motoroff) continue; if ((selected & (1 << dr)) == 0) break; } if (dr == 4) { - write_log ("disk %s DMA started but no drive selected!\n", - dskdmaen == 3 ? "write" : "read"); + write_log ("disk %s DMA started but no drive selected!\n", + dskdmaen == 3 ? "write" : "read"); } else { - write_log ("disk %s DMA started, drv=%x track %d mfmpos %d\n", + write_log ("disk %s DMA started, drv=%x track %d mfmpos %d\n", dskdmaen == 3 ? "write" : "read", selected ^ 15, floppy[dr].cyl * 2 + side, floppy[dr].mfmpos); update_drive_gui (dr); @@ -2535,8 +2535,8 @@ void DSKLEN (uae_u16 v, int hpos) if (dskdmaen != 2 && dskdmaen != 3) return; for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) { - drive *drv = &floppy[dr]; - if (selected & (1 << dr)) + drive *drv = &floppy[dr]; + if (selected & (1 << dr)) continue; if (drv->filetype != ADF_NORMAL) break; @@ -2561,26 +2561,26 @@ void DSKLEN (uae_u16 v, int hpos) if (dskdmaen == 2) { /* TURBO read */ - if (adkcon & 0x400) { + if (adkcon & 0x400) { for (i = 0; i < drv->tracklen; i += 16) { - pos += 16; - pos %= drv->tracklen; - if (drv->bigmfmbuf[pos >> 4] == dsksync) { + pos += 16; + pos %= drv->tracklen; + if (drv->bigmfmbuf[pos >> 4] == dsksync) { /* must skip first disk sync marker */ pos += 16; pos %= drv->tracklen; break; - } + } } if (i >= drv->tracklen) - return; - } - while (dsklength-- > 0) { + return; + } + while (dsklength-- > 0) { put_word (dskpt, drv->bigmfmbuf[pos >> 4]); dskpt += 2; pos += 16; pos %= drv->tracklen; - } + } INTREQ (0x9000); done = 1; @@ -2822,7 +2822,7 @@ uae_u8 *save_disk(int num, int *len, uae_u8 *dstptr) if (dstptr) dstbak = dst = dstptr; else - dstbak = dst = malloc (2+1+1+1+1+4+4+256); + dstbak = dst = malloc (2+1+1+1+1+4+4+256); save_u32 (drv->drive_id); /* drive type ID */ save_u8 ((drv->motoroff ? 0:1) | ((disabled & (1 << num)) ? 2 : 0) | (drv->idbit ? 4 : 0)); save_u8 (drv->cyl); /* cylinder */ @@ -2863,7 +2863,7 @@ uae_u8 *save_floppy(int *len, uae_u8 *dstptr) if (dstptr) dstbak = dst = dstptr; else - dstbak = dst = malloc(2+1+1+1+1+2); + dstbak = dst = malloc(2+1+1+1+1+2); save_u16 (word); /* current fifo (low word) */ save_u8 (bitoffset); /* dma bit offset */ save_u8 (dma_enable); /* disk sync found */ diff --git a/drawing.c b/drawing.c index 53034fe3..9348bc33 100755 --- a/drawing.c +++ b/drawing.c @@ -113,7 +113,7 @@ union { } pixdata; uae_u16 spixels[2 * MAX_SPR_PIXELS]; -/* Eight bits for every pixel. */ +/* Eight bits for every pixel. */ union sps_union spixstate; static uae_u32 ham_linebuf[MAX_PIXELS_PER_LINE * 2]; @@ -307,8 +307,8 @@ static void pfield_init_linetoscr (void) real_playfield_start = playfield_start; #ifdef AGA if (brdsprt && dip_for_drawing->nr_sprites) { - int min = visible_right_border, max = visible_left_border, i; - for (i = 0; i < dip_for_drawing->nr_sprites; i++) { + int min = visible_right_border, max = visible_left_border, i; + for (i = 0; i < dip_for_drawing->nr_sprites; i++) { int x; x = curr_sprite_entries[dip_for_drawing->first_sprite_entry + i].pos; if (x < min) min = x; @@ -319,11 +319,11 @@ static void pfield_init_linetoscr (void) max += (DIW_DDF_OFFSET - DISPLAY_LEFT_SHIFT) << (2 - lores_shift); if (min < playfield_start) playfield_start = min; - if (playfield_start < visible_left_border) + if (playfield_start < visible_left_border) playfield_start = visible_left_border; if (max > playfield_end) playfield_end = max; - if (playfield_end > visible_right_border) + if (playfield_end > visible_right_border) playfield_end = visible_right_border; } #endif @@ -514,7 +514,7 @@ STATIC_INLINE void fill_line (void) val = colors_for_drawing.acolors[0]; #endif if (gfxvidinfo.pixbytes == 2) - val |= val << 16; + val |= val << 16; for (; nints > 0; nints -= 8, start += 8) { *start = val; *(start+1) = val; @@ -550,7 +550,7 @@ static void pfield_do_linetoscr (int start, int stop) { #ifdef AGA if (currprefs.chipset_mask & CSMASK_AGA) { - if (res_shift == 0) + if (res_shift == 0) switch (gfxvidinfo.pixbytes) { case 1: src_pixel = linetoscr_8_aga (src_pixel, start, stop); break; case 2: src_pixel = linetoscr_16_aga (src_pixel, start, stop); break; @@ -570,7 +570,7 @@ static void pfield_do_linetoscr (int start, int stop) } } else { #endif - if (res_shift == 0) + if (res_shift == 0) switch (gfxvidinfo.pixbytes) { case 1: src_pixel = linetoscr_8 (src_pixel, start, stop); break; case 2: src_pixel = linetoscr_16 (src_pixel, start, stop); break; @@ -656,7 +656,7 @@ static void init_ham_decoding (void) } } else if (bplplanecnt == 6) { /* AGA mode HAM6 */ while (unpainted_amiga-- > 0) { - int pv = pixdata.apixels[ham_decode_pixel++]; + int pv = pixdata.apixels[ham_decode_pixel++]; switch (pv & 0x30) { case 0x00: ham_lastcolor = colors_for_drawing.color_regs_aga[pv]; break; case 0x10: ham_lastcolor &= 0xFFFF00; ham_lastcolor |= (pv & 0xF) << 4; break; @@ -667,7 +667,7 @@ static void init_ham_decoding (void) } #endif } else { - if (bplplanecnt == 6) { /* OCS/ECS mode HAM6 */ + if (bplplanecnt == 6) { /* OCS/ECS mode HAM6 */ while (unpainted_amiga-- > 0) { int pv = pixdata.apixels[ham_decode_pixel++]; switch (pv & 0x30) { @@ -724,9 +724,9 @@ static void decode_ham (int pix, int stoppos) } #endif } else { - if (bplplanecnt == 6) { /* OCS/ECS mode HAM6 */ + if (bplplanecnt == 6) { /* OCS/ECS mode HAM6 */ while (todraw_amiga-- > 0) { - int pv = pixdata.apixels[ham_decode_pixel]; + int pv = pixdata.apixels[ham_decode_pixel]; switch (pv & 0x30) { case 0x00: ham_lastcolor = colors_for_drawing.color_regs_ecs[pv]; break; case 0x10: ham_lastcolor &= 0xFF0; ham_lastcolor |= (pv & 0xF); break; @@ -787,7 +787,7 @@ static void gen_pfield_tables (void) function only pass in constant arguments (except for E). This means that many of the if statements will go away completely after inlining. */ STATIC_INLINE void draw_sprites_1 (struct sprite_entry *e, int ham, int dualpf, - int doubling, int skip, int has_attach, int aga) + int doubling, int skip, int has_attach, int aga) { int *shift_lookup = dualpf ? (bpldualpfpri ? dblpf_ms2 : dblpf_ms1) : dblpf_ms; uae_u16 *buf = spixels + e->first_pixel; @@ -907,22 +907,22 @@ STATIC_INLINE void draw_sprites_1 (struct sprite_entry *e, int ham, int dualpf, } } -/* See comments above. Do not touch if you don't know what's going on. +/* See comments above. Do not touch if you don't know what's going on. * (We do _not_ want the following to be inlined themselves). */ /* lores bitplane, lores sprites */ -static void draw_sprites_normal_sp_lo_nat (struct sprite_entry *e) { draw_sprites_1 (e, 0, 0, 0, 0, 0, 0); } -static void draw_sprites_normal_dp_lo_nat (struct sprite_entry *e) { draw_sprites_1 (e, 0, 1, 0, 0, 0, 0); } -static void draw_sprites_ham_sp_lo_nat (struct sprite_entry *e) { draw_sprites_1 (e, 1, 0, 0, 0, 0, 0); } -static void draw_sprites_normal_sp_lo_at (struct sprite_entry *e) { draw_sprites_1 (e, 0, 0, 0, 0, 1, 0); } -static void draw_sprites_normal_dp_lo_at (struct sprite_entry *e) { draw_sprites_1 (e, 0, 1, 0, 0, 1, 0); } -static void draw_sprites_ham_sp_lo_at (struct sprite_entry *e) { draw_sprites_1 (e, 1, 0, 0, 0, 1, 0); } +static void NOINLINE draw_sprites_normal_sp_lo_nat (struct sprite_entry *e) { draw_sprites_1 (e, 0, 0, 0, 0, 0, 0); } +static void NOINLINE draw_sprites_normal_dp_lo_nat (struct sprite_entry *e) { draw_sprites_1 (e, 0, 1, 0, 0, 0, 0); } +static void NOINLINE draw_sprites_ham_sp_lo_nat (struct sprite_entry *e) { draw_sprites_1 (e, 1, 0, 0, 0, 0, 0); } +static void NOINLINE draw_sprites_normal_sp_lo_at (struct sprite_entry *e) { draw_sprites_1 (e, 0, 0, 0, 0, 1, 0); } +static void NOINLINE draw_sprites_normal_dp_lo_at (struct sprite_entry *e) { draw_sprites_1 (e, 0, 1, 0, 0, 1, 0); } +static void NOINLINE draw_sprites_ham_sp_lo_at (struct sprite_entry *e) { draw_sprites_1 (e, 1, 0, 0, 0, 1, 0); } /* hires bitplane, lores sprites */ -static void draw_sprites_normal_sp_hi_nat (struct sprite_entry *e) { draw_sprites_1 (e, 0, 0, 1, 0, 0, 0); } -static void draw_sprites_normal_dp_hi_nat (struct sprite_entry *e) { draw_sprites_1 (e, 0, 1, 1, 0, 0, 0); } -static void draw_sprites_ham_sp_hi_nat (struct sprite_entry *e) { draw_sprites_1 (e, 1, 0, 1, 0, 0, 0); } -static void draw_sprites_normal_sp_hi_at (struct sprite_entry *e) { draw_sprites_1 (e, 0, 0, 1, 0, 1, 0); } -static void draw_sprites_normal_dp_hi_at (struct sprite_entry *e) { draw_sprites_1 (e, 0, 1, 1, 0, 1, 0); } -static void draw_sprites_ham_sp_hi_at (struct sprite_entry *e) { draw_sprites_1 (e, 1, 0, 1, 0, 1, 0); } +static void NOINLINE draw_sprites_normal_sp_hi_nat (struct sprite_entry *e) { draw_sprites_1 (e, 0, 0, 1, 0, 0, 0); } +static void NOINLINE draw_sprites_normal_dp_hi_nat (struct sprite_entry *e) { draw_sprites_1 (e, 0, 1, 1, 0, 0, 0); } +static void NOINLINE draw_sprites_ham_sp_hi_nat (struct sprite_entry *e) { draw_sprites_1 (e, 1, 0, 1, 0, 0, 0); } +static void NOINLINE draw_sprites_normal_sp_hi_at (struct sprite_entry *e) { draw_sprites_1 (e, 0, 0, 1, 0, 1, 0); } +static void NOINLINE draw_sprites_normal_dp_hi_at (struct sprite_entry *e) { draw_sprites_1 (e, 0, 1, 1, 0, 1, 0); } +static void NOINLINE draw_sprites_ham_sp_hi_at (struct sprite_entry *e) { draw_sprites_1 (e, 1, 0, 1, 0, 1, 0); } #ifdef AGA /* not very optimized */ @@ -1080,17 +1080,17 @@ STATIC_INLINE void pfield_doline_1 (uae_u32 *pixels, int wordcount, int planes) } } -/* See above for comments on inlining. These functions should _not_ +/* See above for comments on inlining. These functions should _not_ be inlined themselves. */ -static void pfield_doline_n1 (uae_u32 *data, int count) { pfield_doline_1 (data, count, 1); } -static void pfield_doline_n2 (uae_u32 *data, int count) { pfield_doline_1 (data, count, 2); } -static void pfield_doline_n3 (uae_u32 *data, int count) { pfield_doline_1 (data, count, 3); } -static void pfield_doline_n4 (uae_u32 *data, int count) { pfield_doline_1 (data, count, 4); } -static void pfield_doline_n5 (uae_u32 *data, int count) { pfield_doline_1 (data, count, 5); } -static void pfield_doline_n6 (uae_u32 *data, int count) { pfield_doline_1 (data, count, 6); } +static void NOINLINE pfield_doline_n1 (uae_u32 *data, int count) { pfield_doline_1 (data, count, 1); } +static void NOINLINE pfield_doline_n2 (uae_u32 *data, int count) { pfield_doline_1 (data, count, 2); } +static void NOINLINE pfield_doline_n3 (uae_u32 *data, int count) { pfield_doline_1 (data, count, 3); } +static void NOINLINE pfield_doline_n4 (uae_u32 *data, int count) { pfield_doline_1 (data, count, 4); } +static void NOINLINE pfield_doline_n5 (uae_u32 *data, int count) { pfield_doline_1 (data, count, 5); } +static void NOINLINE pfield_doline_n6 (uae_u32 *data, int count) { pfield_doline_1 (data, count, 6); } #ifdef AGA -static void pfield_doline_n7 (uae_u32 *data, int count) { pfield_doline_1 (data, count, 7); } -static void pfield_doline_n8 (uae_u32 *data, int count) { pfield_doline_1 (data, count, 8); } +static void NOINLINE pfield_doline_n7 (uae_u32 *data, int count) { pfield_doline_1 (data, count, 7); } +static void NOINLINE pfield_doline_n8 (uae_u32 *data, int count) { pfield_doline_1 (data, count, 8); } #endif static void pfield_doline (int lineno) @@ -1156,9 +1156,9 @@ static void init_aspect_maps (void) if (currprefs.gfx_correct_aspect) native_lines_per_amiga_line = ((double)gfxvidinfo.height - * (currprefs.gfx_lores ? 320 : 640) - / (currprefs.gfx_linedbl ? 512 : 256) - / gfxvidinfo.width); + * (currprefs.gfx_lores ? 320 : 640) + / (currprefs.gfx_linedbl ? 512 : 256) + / gfxvidinfo.width); else native_lines_per_amiga_line = 1; @@ -1278,7 +1278,7 @@ static void adjust_drawing_colors (int ctable, int need_full) color_match_type = color_match_full; } else { memcpy (colors_for_drawing.acolors, curr_color_tables[ctable].acolors, - sizeof colors_for_drawing.acolors); + sizeof colors_for_drawing.acolors); color_match_type = color_match_acolors; } drawing_color_matches = ctable; @@ -1472,12 +1472,12 @@ STATIC_INLINE void pfield_draw_line (int lineno, int gfx_ypos, int follow_ypos) } bplham = dp_for_drawing->ham_at_start; } - if (plf2pri > 5 && bplplanecnt == 5 && !(currprefs.chipset_mask & CSMASK_AGA)) + if (plf2pri > 5 && bplplanecnt == 5 && !(currprefs.chipset_mask & CSMASK_AGA)) weird_bitplane_fix (); { if (dip_for_drawing->nr_sprites) { - int i; + int i; #ifdef AGA if (brdsprt) clear_bitplane_border_aga (); @@ -1564,7 +1564,7 @@ static void center_image (void) int prev_y_adjust = thisframe_y_adjust; if (currprefs.gfx_xcenter) { - int w = gfxvidinfo.width; + int w = gfxvidinfo.width; if (max_diwstop - min_diwstart < w && currprefs.gfx_xcenter == 2) /* Try to center. */ @@ -1637,7 +1637,7 @@ static void init_drawing_frame (void) int i, maxline; if (can_use_lores > AUTO_LORES_FRAMES && 0) { - lores_factor = 1; + lores_factor = 1; lores_shift = 0; } else { can_use_lores++; @@ -1762,9 +1762,9 @@ static void draw_status_line (int line) int x_start, y, j, led; if (td_pos & TD_RIGHT) - x_start = gfxvidinfo.width - TD_PADX - NUM_LEDS * TD_WIDTH; + x_start = gfxvidinfo.width - TD_PADX - NUM_LEDS * TD_WIDTH; else - x_start = TD_PADX; + x_start = TD_PADX; y = line - (gfxvidinfo.height - TD_TOTAL_HEIGHT); xlinebuffer = gfxvidinfo.linemem; @@ -1785,8 +1785,8 @@ static void draw_status_line (int line) num1 = -1; num2 = track / 10; num3 = track % 10; - on = gui_data.drive_motor[pled]; - if (gui_data.drive_writing[pled]) + on = gui_data.drive_motor[pled]; + if (gui_data.drive_writing[pled]) on_rgb = 0xc00; } side = gui_data.drive_side; @@ -1844,7 +1844,7 @@ static void draw_status_line (int line) write_tdnumber (x + offs, y - TD_PADY, num1); offs += TD_NUM_WIDTH; } - write_tdnumber (x + offs, y - TD_PADY, num2); + write_tdnumber (x + offs, y - TD_PADY, num2); write_tdnumber (x + offs + TD_NUM_WIDTH, y - TD_PADY, num3); if (num4 > 0) write_tdnumber (x + offs + 2 * TD_NUM_WIDTH, y - TD_PADY, num4); diff --git a/driveclick.c b/driveclick.c index e60a5298..8dee75a2 100755 --- a/driveclick.c +++ b/driveclick.c @@ -94,7 +94,7 @@ static void freesample (struct drvsample *s) s->p = 0; } -static void processclicks(struct drvsample *ds) +static void processclicks(struct drvsample *ds) { unsigned int n = 0; unsigned int nClick = 0; @@ -113,21 +113,21 @@ static void processclicks(struct drvsample *ds) } } if (nClick == 0) { - for(n = 0; n < CLICK_TRACKS; n++) { - ds->indexes[n] = 0; - ds->lengths[n] = ds->len; - } + for(n = 0; n < CLICK_TRACKS; n++) { + ds->indexes[n] = 0; + ds->lengths[n] = ds->len; + } } else { - if (nClick == 1) { + if (nClick == 1) { ds->lengths[0] = ds->len - ds->indexes[0]; for(n = 1; n < CLICK_TRACKS; n++) { - ds->indexes[n] = ds->indexes[0]; - ds->lengths[n] = ds->lengths[0]; + ds->indexes[n] = ds->indexes[0]; + ds->lengths[n] = ds->lengths[0]; } } else { for(n = nClick; n < CLICK_TRACKS; n++) { - ds->indexes[n] = ds->indexes[nClick-1]; - ds->lengths[n] = ds->lengths[nClick-1]; + ds->indexes[n] = ds->indexes[nClick-1]; + ds->lengths[n] = ds->lengths[nClick-1]; } } } @@ -141,7 +141,7 @@ void driveclick_init(void) vv = 0; for (i = 0; i < 4; i++) { for (j = 0; j < CLICK_TRACKS; j++) { - drvs[i][DS_CLICK].indexes[j] = 0; + drvs[i][DS_CLICK].indexes[j] = 0; drvs[i][DS_CLICK].lengths[j] = 0; } if (currprefs.dfxclick[i]) { @@ -296,14 +296,14 @@ void driveclick_mix (uae_s16 *sndbuffer, int size) mix(); clickcnt = 0; if (currprefs.sound_stereo) { - for (i = 0; i < size / 2; i++) { + for (i = 0; i < size / 2; i++) { uae_s16 s = clickbuffer[i]; sndbuffer[0] = limit(((sndbuffer[0] + s) * 2) / 3); sndbuffer[1] = limit(((sndbuffer[1] + s) * 2) / 3); sndbuffer += 2; - } + } } else { - for (i = 0; i < size; i++) { + for (i = 0; i < size; i++) { sndbuffer[0] = limit(((sndbuffer[0] + clickbuffer[i]) * 2) / 3); sndbuffer++; } @@ -336,7 +336,7 @@ void driveclick_motor (int drive, int running) drv_starting[drive] = 0; drv_spinning[drive] = 0; } else { - if (drv_spinning[drive] == 0) { + if (drv_spinning[drive] == 0) { drv_starting[drive] = 1; drv_spinning[drive] = 1; if (drv_has_disk[drive] && drv_has_spun[drive] == 0 && drvs[drive][DS_SNATCH].pos >= drvs[drive][DS_SNATCH].len) @@ -382,4 +382,4 @@ void driveclick_check_prefs (void) } } -#endif \ No newline at end of file +#endif diff --git a/enforcer.c b/enforcer.c index 23a105a1..f3d2e6f2 100755 --- a/enforcer.c +++ b/enforcer.c @@ -45,21 +45,21 @@ static int enforcer_hit = 0; /* set to 1 if displaying the hit */ #define ENFORCER_BUF_SIZE 4096 static char enforcer_buf[ENFORCER_BUF_SIZE]; -uae_u32 REGPARAM2 (*saved_chipmem_lget) (uaecptr addr); -uae_u32 REGPARAM2 (*saved_chipmem_wget) (uaecptr addr); -uae_u32 REGPARAM2 (*saved_chipmem_bget) (uaecptr addr); -void REGPARAM2 (*saved_chipmem_lput) (uaecptr addr, uae_u32 l); -void REGPARAM2 (*saved_chipmem_wput) (uaecptr addr, uae_u32 w); -void REGPARAM2 (*saved_chipmem_bput) (uaecptr addr, uae_u32 b); -int REGPARAM2 (*saved_chipmem_check) (uaecptr addr, uae_u32 size); -uae_u8 * REGPARAM2 (*saved_chipmem_xlate) (uaecptr addr); -uae_u32 REGPARAM2 (*saved_dummy_lget) (uaecptr addr); -uae_u32 REGPARAM2 (*saved_dummy_wget) (uaecptr addr); -uae_u32 REGPARAM2 (*saved_dummy_bget) (uaecptr addr); -void REGPARAM2 (*saved_dummy_lput) (uaecptr addr, uae_u32 l); -void REGPARAM2 (*saved_dummy_wput) (uaecptr addr, uae_u32 w); -void REGPARAM2 (*saved_dummy_bput) (uaecptr addr, uae_u32 b); -int REGPARAM2 (*saved_dummy_check) (uaecptr addr, uae_u32 size); +uae_u32 REGPARAM2 (*saved_chipmem_lget) (uaecptr addr); +uae_u32 REGPARAM2 (*saved_chipmem_wget) (uaecptr addr); +uae_u32 REGPARAM2 (*saved_chipmem_bget) (uaecptr addr); +void REGPARAM2 (*saved_chipmem_lput) (uaecptr addr, uae_u32 l); +void REGPARAM2 (*saved_chipmem_wput) (uaecptr addr, uae_u32 w); +void REGPARAM2 (*saved_chipmem_bput) (uaecptr addr, uae_u32 b); +int REGPARAM2 (*saved_chipmem_check) (uaecptr addr, uae_u32 size); +uae_u8 * REGPARAM2 (*saved_chipmem_xlate) (uaecptr addr); +uae_u32 REGPARAM2 (*saved_dummy_lget) (uaecptr addr); +uae_u32 REGPARAM2 (*saved_dummy_wget) (uaecptr addr); +uae_u32 REGPARAM2 (*saved_dummy_bget) (uaecptr addr); +void REGPARAM2 (*saved_dummy_lput) (uaecptr addr, uae_u32 l); +void REGPARAM2 (*saved_dummy_wput) (uaecptr addr, uae_u32 w); +void REGPARAM2 (*saved_dummy_bput) (uaecptr addr, uae_u32 b); +int REGPARAM2 (*saved_dummy_check) (uaecptr addr, uae_u32 size); /************************************************************* Returns the first node entry of an exec list or 0 if @@ -385,7 +385,7 @@ uae_u32 REGPARAM2 chipmem_lget2 (uaecptr addr) if (ISILLEGAL(addr)) { enforcer_display_hit("LONG READ from",(uae_u32)(regs.pc_p - NMEM_OFFSET),addr); - if (enforcermode==1) + if (enforcermode==1) { set_special (SPCFLAG_TRAP); } @@ -404,7 +404,7 @@ uae_u32 REGPARAM2 chipmem_wget2(uaecptr addr) if (ISILLEGAL(addr)) { enforcer_display_hit("WORD READ from",(uae_u32)(regs.pc_p - NMEM_OFFSET),addr); - if (enforcermode==1) + if (enforcermode==1) { set_special (SPCFLAG_TRAP); } @@ -467,7 +467,6 @@ void REGPARAM2 chipmem_wput2 (uaecptr addr, uae_u32 w) do_put_mem_word (m, w); } - void REGPARAM2 chipmem_bput2 (uaecptr addr, uae_u32 b) { addr -= chipmem_start & chipmem_mask; @@ -539,7 +538,7 @@ uae_u32 REGPARAM2 dummy_wget2 (uaecptr addr) return 0xbadf; } -uae_u32 REGPARAM2 dummy_bget2 (uaecptr addr) +uae_u32 REGPARAM2 dummy_bget2 (uaecptr addr) { special_mem_r; enforcer_display_hit("BYTE READ from",(uae_u32)(regs.pc_p - NMEM_OFFSET),addr); @@ -645,24 +644,24 @@ int enforcer_disable(void) { if (enforcer_installed) { - dummy_bank.lget = saved_dummy_lget; + dummy_bank.lget = saved_dummy_lget; dummy_bank.wget = saved_dummy_wget; - dummy_bank.bget = saved_dummy_bget; - dummy_bank.lput = saved_dummy_lput; + dummy_bank.bget = saved_dummy_bget; + dummy_bank.lput = saved_dummy_lput; dummy_bank.wput = saved_dummy_wput; - dummy_bank.bput = saved_dummy_bput; + dummy_bank.bput = saved_dummy_bput; chipmem_bank.lget = saved_chipmem_lget; chipmem_bank.wget = saved_chipmem_wget; chipmem_bank.bget = saved_chipmem_bget; chipmem_bank.lput = saved_chipmem_lput; chipmem_bank.wput = saved_chipmem_wput; chipmem_bank.bput = saved_chipmem_bput; - chipmem_bank.xlateaddr = saved_chipmem_xlate; - chipmem_bank.check = saved_chipmem_check; + chipmem_bank.xlateaddr = saved_chipmem_xlate; + chipmem_bank.check = saved_chipmem_check; - enforcer_installed = 0; + enforcer_installed = 0; } return 1; } -#endif \ No newline at end of file +#endif diff --git a/ersatz.c b/ersatz.c index f68a44c2..31fc1a15 100755 --- a/ersatz.c +++ b/ersatz.c @@ -22,7 +22,7 @@ #include "ersatz.h" #include "gui.h" -#define EOP_INIT 0 +#define EOP_INIT 0 #define EOP_NIMP 1 #define EOP_SERVEINT 2 #define EOP_DOIO 3 diff --git a/expansion.c b/expansion.c index 92393127..d73dda46 100755 --- a/expansion.c +++ b/expansion.c @@ -26,7 +26,7 @@ #include "cdtv.h" #include "arcadia.h" -#define MAX_EXPANSION_BOARDS 8 +#define MAX_EXPANSION_BOARDS 8 /* ********************************************************** */ /* 00 / 02 */ @@ -67,10 +67,10 @@ #define hackers_id 2011 /* Special ID for test cards */ /* Card Type */ -#define commodore_a2091 3 /* A2091 / A590 Card from C= */ +#define commodore_a2091 3 /* A2091 / A590 Card from C= */ #define commodore_a2091_ram 10 /* A2091 / A590 Ram on HD-Card */ #define commodore_a2232 70 /* A2232 Multiport Expansion */ -#define ass_nexus_scsi 1 /* Nexus SCSI Controller */ +#define ass_nexus_scsi 1 /* Nexus SCSI Controller */ #define gvp_series_2_scsi 11 #define gvp_iv_24_gfx 32 @@ -897,9 +897,9 @@ static void expamem_init_filesys (void) { /* struct DiagArea - the size has to be large enough to store several device ROMTags */ uae_u8 diagarea[] = { 0x90, 0x00, /* da_Config, da_Flags */ - 0x02, 0x00, /* da_Size */ - 0x01, 0x00, /* da_DiagPoint */ - 0x01, 0x06 /* da_BootPoint */ + 0x02, 0x00, /* da_Size */ + 0x01, 0x00, /* da_DiagPoint */ + 0x01, 0x06 /* da_BootPoint */ }; expamem_init_clear(); @@ -993,7 +993,7 @@ static void expamem_init_z3fastmem (void) z3fastmem_start = 0x10000000; map_banks (&z3fastmem_bank, z3fastmem_start >> 16, currprefs.z3fastmem_size >> 16, - allocated_z3fastmem); + allocated_z3fastmem); } @@ -1012,13 +1012,13 @@ static void expamem_map_gfxcard (void) static void expamem_init_gfxcard (void) { int code = (allocated_gfxmem == 0x100000 ? Z2_MEM_1MB - : allocated_gfxmem == 0x200000 ? Z2_MEM_2MB - : allocated_gfxmem == 0x400000 ? Z2_MEM_4MB - : allocated_gfxmem == 0x800000 ? Z2_MEM_8MB - : allocated_gfxmem == 0x1000000 ? Z2_MEM_16MB - : allocated_gfxmem == 0x2000000 ? Z2_MEM_32MB - : allocated_gfxmem == 0x4000000 ? Z2_MEM_64MB - : Z2_MEM_128MB); + : allocated_gfxmem == 0x200000 ? Z2_MEM_2MB + : allocated_gfxmem == 0x400000 ? Z2_MEM_4MB + : allocated_gfxmem == 0x800000 ? Z2_MEM_8MB + : allocated_gfxmem == 0x1000000 ? Z2_MEM_16MB + : allocated_gfxmem == 0x2000000 ? Z2_MEM_32MB + : allocated_gfxmem == 0x4000000 ? Z2_MEM_64MB + : Z2_MEM_128MB); expamem_init_clear(); expamem_write (0x00, zorroIII | code); @@ -1139,8 +1139,8 @@ void expamem_reset (void) #ifdef CDTV #if 0 if (cdtv_enabled) { - map_banks (&dmac_bank, DMAC_START >> 16, 0x10000 >> 16, 0x10000); - dmac_init (); + map_banks (&dmac_bank, DMAC_START >> 16, 0x10000 >> 16, 0x10000); + dmac_init (); } #endif #endif @@ -1188,8 +1188,8 @@ void expamem_reset (void) } #ifdef CATWEASEL if (currprefs.catweasel && catweasel_init ()) { - card_init[cardno] = expamem_init_catweasel; - card_map[cardno++] = expamem_map_catweasel; + card_init[cardno] = expamem_init_catweasel; + card_map[cardno++] = expamem_map_catweasel; } #endif while (cardno < MAX_EXPANSION_BOARDS) { @@ -1214,7 +1214,9 @@ void expansion_init (void) gfxmem_mask = gfxmem_start = 0; gfxmemory = 0; #endif +#if defined(CATWEASEL) catweasel_mask = catweasel_start = 0; +#endif filesys_start = 0; filesysory = 0; z3fastmem_mask = z3fastmem_start = 0; @@ -1244,7 +1246,7 @@ void expansion_cleanup (void) z3fastmem = 0; gfxmemory = 0; filesysory = 0; -#ifdef CATWEASEL +#if defined(CATWEASEL) catweasel_free (); #endif } diff --git a/fdi2raw.c b/fdi2raw.c index 19b27deb..09fd2ba6 100755 --- a/fdi2raw.c +++ b/fdi2raw.c @@ -1,30 +1,30 @@ /* - FDI to raw bit stream converter - Copyright (c) 2001 by Toni Wilen + FDI to raw bit stream converter + Copyright (c) 2001 by Toni Wilen FDI 2.0 support - Copyright (c) 2003-2004 by Toni Wilen - and Vincent Joguin + Copyright (c) 2003-2004 by Toni Wilen + and Vincent Joguin - FDI format created by Vincent "ApH" Joguin + FDI format created by Vincent "ApH" Joguin - Tiny changes - function type fixes, multiple drives, addition of - get_last_head and C++ callability - by Thomas Harte, 2001, + Tiny changes - function type fixes, multiple drives, addition of + get_last_head and C++ callability - by Thomas Harte, 2001, T.Harte@excite.co.uk - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the Free - Software Foundation; either version 2 of the License, or (at your option) + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., + with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ @@ -37,13 +37,13 @@ #include "sysconfig.h" #include "sysdeps.h" #include "zfile.h" -/* ELSE */ +/* ELSE */ //#include "types.h" #include "fdi2raw.h" #undef DEBUG -#define VERBOSE +#define VERBOSE #undef VERBOSE #include @@ -53,34 +53,34 @@ static char *datalog(uae_u8 *src, int len) { static char buf[1000]; static int offset; - int i = 0, offset2; + int i = 0, offset2; - offset2 = offset; + offset2 = offset; buf[offset++]='\''; while(len--) { - sprintf (buf + offset, "%02.2X", src[i]); + sprintf (buf + offset, "%02.2X", src[i]); offset += 2; i++; - if (i > 10) break; + if (i > 10) break; } buf[offset++]='\''; - buf[offset++] = 0; + buf[offset++] = 0; if (offset >= 900) offset = 0; return buf + offset2; } #else -static char *datalog(uae_u8 *src, int len) { return ""; } +static char *datalog(uae_u8 *src, int len) { return ""; } #endif #ifdef DEBUG -#define debuglog write_log +#define debuglog write_log #else -#define debuglog +#define debuglog #endif #ifdef VERBOSE -#define outlog write_log +#define outlog write_log #else -#define outlog +#define outlog #endif static int fdi_allocated; @@ -88,31 +88,31 @@ static int fdi_allocated; static void fdi_free (void *p) { int size; - if (!p) - return; + if (!p) + return; size = ((int*)p)[-1]; fdi_allocated -= size; write_log ("%d freed (%d)\n", size, fdi_allocated); - free ((int*)p - 1); + free ((int*)p - 1); } -static void *fdi_malloc (int size) +static void *fdi_malloc (int size) { - void *p = xmalloc (size + sizeof (int)); + void *p = xmalloc (size + sizeof (int)); ((int*)p)[0] = size; fdi_allocated += size; - write_log ("%d allocated (%d)\n", size, fdi_allocated); + write_log ("%d allocated (%d)\n", size, fdi_allocated); return (int*)p + 1; } #else -#define fdi_free free -#define fdi_malloc xmalloc +#define fdi_free free +#define fdi_malloc xmalloc #endif -#define MAX_SRC_BUFFER 4194304 -#define MAX_DST_BUFFER 40000 -#define MAX_MFM_SYNC_BUFFER 60000 -#define MAX_TIMING_BUFFER 400000 -#define MAX_TRACKS 166 +#define MAX_SRC_BUFFER 4194304 +#define MAX_DST_BUFFER 40000 +#define MAX_MFM_SYNC_BUFFER 60000 +#define MAX_TIMING_BUFFER 400000 +#define MAX_TRACKS 166 struct fdi_cache { uae_u32 *avgp, *minp, *maxp; @@ -129,11 +129,11 @@ struct fdi { int track_src_len; uae_u8 *track_dst_buffer; uae_u8 *track_dst; - uae_u16 *track_dst_buffer_timing; + uae_u16 *track_dst_buffer_timing; uae_u8 track_len; uae_u8 track_type; int current_track; - int last_track; + int last_track; int last_head; int rotation_speed; int bit_rate; @@ -149,41 +149,41 @@ struct fdi { /* sector described only */ int index_offset; int encoding_type; - /* bit handling */ + /* bit handling */ int nextdrop; struct fdi_cache cache[MAX_TRACKS]; }; -#define get_u32(x) ((((x)[0])<<24)|(((x)[1])<<16)|(((x)[2])<<8)|((x)[3])) -#define get_u24(x) ((((x)[0])<<16)|(((x)[1])<<8)|((x)[2])) +#define get_u32(x) ((((x)[0])<<24)|(((x)[1])<<16)|(((x)[2])<<8)|((x)[3])) +#define get_u24(x) ((((x)[0])<<16)|(((x)[1])<<8)|((x)[2])) STATIC_INLINE put_u32 (uae_u8 *d, uae_u32 v) { - d[0] = v >> 24; - d[1] = v >> 16; + d[0] = v >> 24; + d[1] = v >> 16; d[2] = v >> 8; d[3] = v; } struct node { - uae_u16 v; + uae_u16 v; struct node *left; struct node *right; }; -typedef struct node NODE; +typedef struct node NODE; static uae_u8 temp, temp2; -static uae_u8 *expand_tree (uae_u8 *stream, NODE *node) +static uae_u8 *expand_tree (uae_u8 *stream, NODE *node) { if (temp & temp2) { fdi_free (node->left); - node->left = 0; - fdi_free (node->right); + node->left = 0; + fdi_free (node->right); node->right = 0; temp2 >>= 1; if (!temp2) { temp = *stream++; - temp2 = 0x80; + temp2 = 0x80; } return stream; } else { @@ -191,13 +191,13 @@ static uae_u8 *expand_tree (uae_u8 *stream, NODE *node) temp2 >>= 1; if (!temp2) { temp = *stream++; - temp2 = 0x80; + temp2 = 0x80; } - node->left = fdi_malloc (sizeof (NODE)); + node->left = fdi_malloc (sizeof (NODE)); memset (node->left, 0, sizeof (NODE)); - stream_temp = expand_tree (stream, node->left); + stream_temp = expand_tree (stream, node->left); node->right = fdi_malloc (sizeof (NODE)); - memset (node->right, 0, sizeof (NODE)); + memset (node->right, 0, sizeof (NODE)); return expand_tree (stream_temp, node->right); } } @@ -205,19 +205,19 @@ static uae_u8 *expand_tree (uae_u8 *stream, NODE *node) static uae_u8 *values_tree8 (uae_u8 *stream, NODE *node) { if (node->left == 0) { - node->v = *stream++; + node->v = *stream++; return stream; } else { uae_u8 *stream_temp = values_tree8 (stream, node->left); - return values_tree8 (stream_temp, node->right); + return values_tree8 (stream_temp, node->right); } } static uae_u8 *values_tree16 (uae_u8 *stream, NODE *node) { if (node->left == 0) { - uae_u16 high_8_bits = (*stream++) << 8; - node->v = high_8_bits | (*stream++); + uae_u16 high_8_bits = (*stream++) << 8; + node->v = high_8_bits | (*stream++); return stream; } else { uae_u8 *stream_temp = values_tree16 (stream, node->left); @@ -236,26 +236,26 @@ static void free_nodes (NODE *node) static uae_u32 sign_extend16 (uae_u32 v) { - if (v & 0x8000) + if (v & 0x8000) v |= 0xffff0000; return v; } -static uae_u32 sign_extend8 (uae_u32 v) +static uae_u32 sign_extend8 (uae_u32 v) { - if (v & 0x80) + if (v & 0x80) v |= 0xffffff00; return v; } -static void fdi_decode (uae_u8 *stream, int size, uae_u8 *out) +static void fdi_decode (uae_u8 *stream, int size, uae_u8 *out) { int i; uae_u8 sign_extend, sixteen_bit, sub_stream_shift; NODE root; NODE *current_node; - memset (out, 0, size * 4); + memset (out, 0, size * 4); sub_stream_shift = 1; while (sub_stream_shift) { @@ -274,15 +274,15 @@ static void fdi_decode (uae_u8 *stream, int size, uae_u8 *out) //huffman output values decode if (sixteen_bit) - stream = values_tree16 (stream, &root); + stream = values_tree16 (stream, &root); else stream = values_tree8 (stream, &root); //sub-stream data decode temp2 = 0; - for (i = 0; i < size; i++) { - uae_u32 v; - uae_u8 decode = 1; + for (i = 0; i < size; i++) { + uae_u32 v; + uae_u8 decode = 1; current_node = &root; while (decode) { if (current_node->left == 0) { @@ -290,7 +290,7 @@ static void fdi_decode (uae_u8 *stream, int size, uae_u8 *out) } else { temp2 >>= 1; if (!temp2) { - temp2 = 0x80; + temp2 = 0x80; temp = *stream++; } if (temp & temp2) @@ -299,18 +299,18 @@ static void fdi_decode (uae_u8 *stream, int size, uae_u8 *out) current_node = current_node->left; } } - v = ((uae_u32*)out)[i]; + v = ((uae_u32*)out)[i]; if (sign_extend) { if (sixteen_bit) - v |= sign_extend16 (current_node->v) << sub_stream_shift; + v |= sign_extend16 (current_node->v) << sub_stream_shift; else v |= sign_extend8 (current_node->v) << sub_stream_shift; } else { - v |= current_node->v << sub_stream_shift; + v |= current_node->v << sub_stream_shift; } - ((uae_u32*)out)[i] = v; + ((uae_u32*)out)[i] = v; } - free_nodes (root.left); + free_nodes (root.left); free_nodes (root.right); } } @@ -319,99 +319,99 @@ static void fdi_decode (uae_u8 *stream, int size, uae_u8 *out) static int decode_raw_track (FDI *fdi) { int size = get_u32(fdi->track_src); - memcpy (fdi->track_dst, fdi->track_src, (size + 7) >> 3); - fdi->track_src += (size + 7) >> 3; + memcpy (fdi->track_dst, fdi->track_src, (size + 7) >> 3); + fdi->track_src += (size + 7) >> 3; return size; } /* unknown track */ -static void zxx (FDI *fdi) +static void zxx (FDI *fdi) { outlog ("track %d: unknown track type 0x%02.2X\n", fdi->current_track, fdi->track_type); // return -1; } -/* unsupported track */ -static void zyy (FDI *fdi) +/* unsupported track */ +static void zyy (FDI *fdi) { outlog ("track %d: unsupported track type 0x%02.2X\n", fdi->current_track, fdi->track_type); // return -1; } /* empty track */ -static void track_empty (FDI *fdi) +static void track_empty (FDI *fdi) { // return 0; } /* unknown sector described type */ -static void dxx (FDI *fdi) +static void dxx (FDI *fdi) { - outlog ("\ntrack %d: unknown sector described type 0x%02.2X\n", fdi->current_track, fdi->track_type); + outlog ("\ntrack %d: unknown sector described type 0x%02.2X\n", fdi->current_track, fdi->track_type); fdi->err = 1; } -/* unsupported sector described type */ -static void dyy (FDI *fdi) +/* unsupported sector described type */ +static void dyy (FDI *fdi) { - outlog ("\ntrack %d: unsupported sector described 0x%02.2X\n", fdi->current_track, fdi->track_type); + outlog ("\ntrack %d: unsupported sector described 0x%02.2X\n", fdi->current_track, fdi->track_type); fdi->err = 1; } -/* add position of mfm sync bit */ -static void add_mfm_sync_bit (FDI *fdi) +/* add position of mfm sync bit */ +static void add_mfm_sync_bit (FDI *fdi) { if (fdi->nextdrop) { - fdi->nextdrop = 0; - return; + fdi->nextdrop = 0; + return; } fdi->mfmsync_buffer[fdi->mfmsync_offset++] = fdi->out; - if (fdi->out == 0) { + if (fdi->out == 0) { outlog ("illegal position for mfm sync bit, offset=%d\n",fdi->out); fdi->err = 1; } - if (fdi->mfmsync_offset >= MAX_MFM_SYNC_BUFFER) { + if (fdi->mfmsync_offset >= MAX_MFM_SYNC_BUFFER) { fdi->mfmsync_offset = 0; - outlog ("mfmsync buffer overflow\n"); + outlog ("mfmsync buffer overflow\n"); fdi->err = 1; } fdi->out++; } -#define BIT_BYTEOFFSET ((fdi->out) >> 3) -#define BIT_BITOFFSET (7-((fdi->out)&7)) +#define BIT_BYTEOFFSET ((fdi->out) >> 3) +#define BIT_BITOFFSET (7-((fdi->out)&7)) /* add one bit */ -static void bit_add (FDI *fdi, int bit) +static void bit_add (FDI *fdi, int bit) { if (fdi->nextdrop) { - fdi->nextdrop = 0; - return; + fdi->nextdrop = 0; + return; } fdi->track_dst[BIT_BYTEOFFSET] &= ~(1 << BIT_BITOFFSET); if (bit) - fdi->track_dst[BIT_BYTEOFFSET] |= (1 << BIT_BITOFFSET); + fdi->track_dst[BIT_BYTEOFFSET] |= (1 << BIT_BITOFFSET); fdi->out++; - if (fdi->out >= MAX_DST_BUFFER * 8) { + if (fdi->out >= MAX_DST_BUFFER * 8) { outlog ("destination buffer overflow\n"); fdi->err = 1; fdi->out = 1; } } -/* add bit and mfm sync bit */ -static void bit_mfm_add (FDI *fdi, int bit) +/* add bit and mfm sync bit */ +static void bit_mfm_add (FDI *fdi, int bit) { - add_mfm_sync_bit (fdi); - bit_add (fdi, bit); + add_mfm_sync_bit (fdi); + bit_add (fdi, bit); } -/* remove following bit */ +/* remove following bit */ static void bit_drop_next (FDI *fdi) { if (fdi->nextdrop > 0) { outlog("multiple bit_drop_next() called"); - } else if (fdi->nextdrop < 0) { - fdi->nextdrop = 0; + } else if (fdi->nextdrop < 0) { + fdi->nextdrop = 0; debuglog(":DNN:"); - return; + return; } debuglog(":DN:"); - fdi->nextdrop = 1; + fdi->nextdrop = 1; } /* ignore next bit_drop_next() */ @@ -420,37 +420,37 @@ static void bit_dedrop (FDI *fdi) if (fdi->nextdrop) { outlog("bit_drop_next called before bit_dedrop"); } - fdi->nextdrop = -1; + fdi->nextdrop = -1; debuglog(":BDD:"); } -/* add one byte */ -static void byte_add (FDI *fdi, uae_u8 v) +/* add one byte */ +static void byte_add (FDI *fdi, uae_u8 v) { int i; for (i = 7; i >= 0; i--) - bit_add (fdi, v & (1 << i)); + bit_add (fdi, v & (1 << i)); } -/* add one word */ -static void word_add (FDI *fdi, uae_u16 v) +/* add one word */ +static void word_add (FDI *fdi, uae_u16 v) { byte_add (fdi, (uae_u8)(v >> 8)); byte_add (fdi, (uae_u8)v); } -/* add one byte and mfm encode it */ +/* add one byte and mfm encode it */ static void byte_mfm_add (FDI *fdi, uae_u8 v) { int i; for (i = 7; i >= 0; i--) bit_mfm_add (fdi, v & (1 << i)); } -/* add multiple bytes and mfm encode them */ -static void bytes_mfm_add (FDI *fdi, uae_u8 v, int len) +/* add multiple bytes and mfm encode them */ +static void bytes_mfm_add (FDI *fdi, uae_u8 v, int len) { int i; - for (i = 0; i < len; i++) byte_mfm_add (fdi, v); + for (i = 0; i < len; i++) byte_mfm_add (fdi, v); } -/* add one mfm encoded word and re-mfm encode it */ +/* add one mfm encoded word and re-mfm encode it */ static void word_post_mfm_add (FDI *fdi, uae_u16 v) { int i; @@ -459,32 +459,32 @@ static void word_post_mfm_add (FDI *fdi, uae_u16 v) } /* bit 0 */ -static void s00(FDI *fdi) { bit_add (fdi, 0); } +static void s00(FDI *fdi) { bit_add (fdi, 0); } /* bit 1*/ -static void s01(FDI *fdi) { bit_add (fdi, 1); } -/* 4489 */ +static void s01(FDI *fdi) { bit_add (fdi, 1); } +/* 4489 */ static void s02(FDI *fdi) { word_add (fdi, 0x4489); } -/* 5224 */ +/* 5224 */ static void s03(FDI *fdi) { word_add (fdi, 0x5224); } -/* mfm sync bit */ +/* mfm sync bit */ static void s04(FDI *fdi) { add_mfm_sync_bit (fdi); } -/* RLE MFM-encoded data */ +/* RLE MFM-encoded data */ static void s08(FDI *fdi) { int bytes = *fdi->track_src++; uae_u8 byte = *fdi->track_src++; - if (bytes == 0) bytes = 256; - debuglog ("s08:len=%d,data=%02.2X",bytes,byte); - while(bytes--) byte_add (fdi, byte); + if (bytes == 0) bytes = 256; + debuglog ("s08:len=%d,data=%02.2X",bytes,byte); + while(bytes--) byte_add (fdi, byte); } -/* RLE MFM-decoded data */ +/* RLE MFM-decoded data */ static void s09(FDI *fdi) { int bytes = *fdi->track_src++; uae_u8 byte = *fdi->track_src++; - if (bytes == 0) bytes = 256; + if (bytes == 0) bytes = 256; bit_drop_next (fdi); - debuglog ("s09:len=%d,data=%02.2X",bytes,byte); + debuglog ("s09:len=%d,data=%02.2X",bytes,byte); while(bytes--) byte_mfm_add (fdi, byte); } /* MFM-encoded data */ @@ -496,13 +496,13 @@ static void s0a(FDI *fdi) debuglog ("s0a:bits=%d,data=%s", bits, datalog(fdi->track_src, (bits + 7) / 8)); while (bits >= 8) { byte_add (fdi, *fdi->track_src++); - bits -= 8; + bits -= 8; } - if (bits > 0) { + if (bits > 0) { i = 7; b = *fdi->track_src++; while (bits--) { - bit_add (fdi, b & (1 << i)); + bit_add (fdi, b & (1 << i)); i--; } } @@ -510,19 +510,19 @@ static void s0a(FDI *fdi) /* MFM-encoded data */ static void s0b(FDI *fdi) { - int i, bits = ((fdi->track_src[0] << 8) | fdi->track_src[1]) + 65536; + int i, bits = ((fdi->track_src[0] << 8) | fdi->track_src[1]) + 65536; uae_u8 b; fdi->track_src += 2; debuglog ("s0b:bits=%d,data=%s", bits, datalog(fdi->track_src, (bits + 7) / 8)); while (bits >= 8) { byte_add (fdi, *fdi->track_src++); - bits -= 8; + bits -= 8; } - if (bits > 0) { + if (bits > 0) { i = 7; b = *fdi->track_src++; while (bits--) { - bit_add (fdi, b & (1 << i)); + bit_add (fdi, b & (1 << i)); i--; } } @@ -537,12 +537,12 @@ static void s0c(FDI *fdi) debuglog ("s0c:bits=%d,data=%s", bits, datalog(fdi->track_src, (bits + 7) / 8)); while (bits >= 8) { byte_mfm_add (fdi, *fdi->track_src++); - bits -= 8; + bits -= 8; } - if (bits > 0) { + if (bits > 0) { i = 7; b = *fdi->track_src++; - while(bits--) { + while(bits--) { bit_mfm_add (fdi, b & (1 << i)); i--; } @@ -551,19 +551,19 @@ static void s0c(FDI *fdi) /* MFM-decoded data */ static void s0d(FDI *fdi) { - int i, bits = ((fdi->track_src[0] << 8) | fdi->track_src[1]) + 65536; + int i, bits = ((fdi->track_src[0] << 8) | fdi->track_src[1]) + 65536; uae_u8 b; fdi->track_src += 2; bit_drop_next (fdi); debuglog ("s0d:bits=%d,data=%s", bits, datalog(fdi->track_src, (bits + 7) / 8)); while (bits >= 8) { byte_mfm_add (fdi, *fdi->track_src++); - bits -= 8; + bits -= 8; } - if (bits > 0) { + if (bits > 0) { i = 7; b = *fdi->track_src++; - while(bits--) { + while(bits--) { bit_mfm_add (fdi, b & (1 << i)); i--; } @@ -574,15 +574,15 @@ static void s0d(FDI *fdi) /* AMIGA */ /* ***** */ -/* just for testing integrity of Amiga sectors */ +/* just for testing integrity of Amiga sectors */ -static void rotateonebit (uae_u8 *start, uae_u8 *end, int shift) +static void rotateonebit (uae_u8 *start, uae_u8 *end, int shift) { - if (shift == 0) - return; - while (start <= end) { + if (shift == 0) + return; + while (start <= end) { start[0] <<= shift; - start[0] |= start[1] >> (8 - shift); + start[0] |= start[1] >> (8 - shift); start++; } } @@ -590,9 +590,9 @@ static void rotateonebit (uae_u8 *start, uae_u8 *end, int shift) static int check_offset; static uae_u16 getmfmword (uae_u8 *mbuf) { - uae_u32 v; + uae_u32 v; - v = (mbuf[0] << 8) | (mbuf[1] << 0); + v = (mbuf[0] << 8) | (mbuf[1] << 0); if (check_offset == 0) return v; v <<= 8; @@ -601,19 +601,19 @@ static uae_u16 getmfmword (uae_u8 *mbuf) return v; } -#define MFMMASK 0x55555555 +#define MFMMASK 0x55555555 static uae_u32 getmfmlong (uae_u8 * mbuf) { return ((getmfmword (mbuf) << 16) | getmfmword (mbuf + 2)) & MFMMASK; } -static int amiga_check_track (FDI *fdi) +static int amiga_check_track (FDI *fdi) { int i, j, secwritten = 0; int fwlen = fdi->out / 8; - int length = 2 * fwlen; + int length = 2 * fwlen; int drvsec = 11; - uae_u32 odd, even, chksum, id, dlong; + uae_u32 odd, even, chksum, id, dlong; uae_u8 *secdata; uae_u8 secbuf[544]; uae_u8 bigmfmbuf[60000]; @@ -626,17 +626,17 @@ static int amiga_check_track (FDI *fdi) memset (bigmfmbuf, 0, sizeof (bigmfmbuf)); mbuf = bigmfmbuf; check_offset = 0; - for (i = 0; i < (fdi->out + 7) / 8; i++) - *mbuf++ = raw[i]; + for (i = 0; i < (fdi->out + 7) / 8; i++) + *mbuf++ = raw[i]; off = fdi->out & 7; #if 1 - if (off > 0) { - mbuf--; + if (off > 0) { + mbuf--; *mbuf &= ~((1 << (8 - off)) - 1); } j = 0; - while (i < (fdi->out + 7) / 8 + 600) { - *mbuf++ |= (raw[j] >> off) | ((raw[j + 1]) << (8 - off)); + while (i < (fdi->out + 7) / 8 + 600) { + *mbuf++ |= (raw[j] >> off) | ((raw[j + 1]) << (8 - off)); j++; i++; } @@ -644,9 +644,9 @@ static int amiga_check_track (FDI *fdi) mbuf = bigmfmbuf; memset (sectable, 0, sizeof (sectable)); - //memcpy (mbuf + fwlen, mbuf, fwlen * sizeof (uae_u16)); + //memcpy (mbuf + fwlen, mbuf, fwlen * sizeof (uae_u16)); mend = bigmfmbuf + length; - mend -= (4 + 16 + 8 + 512); + mend -= (4 + 16 + 8 + 512); while (secwritten < drvsec) { int trackoffs; @@ -655,21 +655,21 @@ static int amiga_check_track (FDI *fdi) rotateonebit (bigmfmbuf, mend, 1); if (getmfmword (mbuf) == 0) break; - if (secwritten == 10) { - mbuf[0] = 0x44; - mbuf[1] = 0x89; + if (secwritten == 10) { + mbuf[0] = 0x44; + mbuf[1] = 0x89; } -// check_offset++; - if (check_offset > 7) { +// check_offset++; + if (check_offset > 7) { check_offset = 0; - mbuf++; - if (mbuf >= mend || *mbuf == 0) + mbuf++; + if (mbuf >= mend || *mbuf == 0) break; } if (getmfmword (mbuf) == 0x4489) break; } - if (mbuf >= mend || *mbuf == 0) + if (mbuf >= mend || *mbuf == 0) break; rotateonebit (bigmfmbuf, mend, check_offset); @@ -680,70 +680,70 @@ static int amiga_check_track (FDI *fdi) mbuf2 = mbuf + 8; odd = getmfmlong (mbuf); - even = getmfmlong (mbuf + 2 * 2); + even = getmfmlong (mbuf + 2 * 2); mbuf += 4 * 2; - id = (odd << 1) | even; + id = (odd << 1) | even; - trackoffs = (id & 0xff00) >> 8; - if (trackoffs + 1 > drvsec) { + trackoffs = (id & 0xff00) >> 8; + if (trackoffs + 1 > drvsec) { outlog("illegal sector offset %d\n",trackoffs); - ok = 0; + ok = 0; mbuf = mbuf2; continue; } - if ((id >> 24) != 0xff) { + if ((id >> 24) != 0xff) { outlog ("sector %d format type %02.2X?\n", trackoffs, id >> 24); - ok = 0; + ok = 0; } chksum = odd ^ even; slabel = 0; - for (i = 0; i < 4; i++) { + for (i = 0; i < 4; i++) { odd = getmfmlong (mbuf); - even = getmfmlong (mbuf + 8 * 2); - mbuf += 2* 2; + even = getmfmlong (mbuf + 8 * 2); + mbuf += 2* 2; - dlong = (odd << 1) | even; + dlong = (odd << 1) | even; if (dlong) slabel = 1; - chksum ^= odd ^ even; + chksum ^= odd ^ even; } - mbuf += 8 * 2; + mbuf += 8 * 2; odd = getmfmlong (mbuf); - even = getmfmlong (mbuf + 2 * 2); - mbuf += 4 * 2; - if (((odd << 1) | even) != chksum) { + even = getmfmlong (mbuf + 2 * 2); + mbuf += 4 * 2; + if (((odd << 1) | even) != chksum) { outlog("sector %d header crc error\n", trackoffs); - ok = 0; + ok = 0; mbuf = mbuf2; continue; } outlog("sector %d header crc ok\n", trackoffs); - if (((id & 0x00ff0000) >> 16) != (uae_u32)fdi->current_track) { - outlog("illegal track number %d <> %d\n",fdi->current_track,(id & 0x00ff0000) >> 16); + if (((id & 0x00ff0000) >> 16) != (uae_u32)fdi->current_track) { + outlog("illegal track number %d <> %d\n",fdi->current_track,(id & 0x00ff0000) >> 16); ok++; mbuf = mbuf2; continue; } odd = getmfmlong (mbuf); - even = getmfmlong (mbuf + 2 * 2); - mbuf += 4 * 2; + even = getmfmlong (mbuf + 2 * 2); + mbuf += 4 * 2; chksum = (odd << 1) | even; - secdata = secbuf + 32; - for (i = 0; i < 128; i++) { + secdata = secbuf + 32; + for (i = 0; i < 128; i++) { odd = getmfmlong (mbuf); - even = getmfmlong (mbuf + 256 * 2); - mbuf += 2 * 2; - dlong = (odd << 1) | even; - *secdata++ = (uae_u8) (dlong >> 24); - *secdata++ = (uae_u8) (dlong >> 16); - *secdata++ = (uae_u8) (dlong >> 8); + even = getmfmlong (mbuf + 256 * 2); + mbuf += 2 * 2; + dlong = (odd << 1) | even; + *secdata++ = (uae_u8) (dlong >> 24); + *secdata++ = (uae_u8) (dlong >> 16); + *secdata++ = (uae_u8) (dlong >> 8); *secdata++ = (uae_u8) dlong; - chksum ^= odd ^ even; + chksum ^= odd ^ even; } - mbuf += 256 * 2; + mbuf += 256 * 2; if (chksum) { outlog("sector %d data checksum error\n",trackoffs); - ok = 0; - } else if (sectable[trackoffs]) { + ok = 0; + } else if (sectable[trackoffs]) { outlog("sector %d already found?\n", trackoffs); mbuf = mbuf2; } else { @@ -752,78 +752,78 @@ static int amiga_check_track (FDI *fdi) sectable[trackoffs] = 1; secwritten++; if (trackoffs == 9) - mbuf += 0x228; + mbuf += 0x228; } } - for (i = 0; i < drvsec; i++) { + for (i = 0; i < drvsec; i++) { if (!sectable[i]) { outlog ("sector %d missing\n", i); - ok = 0; + ok = 0; } } return ok; } -static void amiga_data_raw (FDI *fdi, uae_u8 *secbuf, uae_u8 *crc, int len) +static void amiga_data_raw (FDI *fdi, uae_u8 *secbuf, uae_u8 *crc, int len) { int i; uae_u8 crcbuf[4]; if (!crc) { - memset (crcbuf, 0, 4); + memset (crcbuf, 0, 4); } else { - memcpy (crcbuf, crc ,4); + memcpy (crcbuf, crc ,4); } - for (i = 0; i < 4; i++) + for (i = 0; i < 4; i++) byte_mfm_add (fdi, crcbuf[i]); - for (i = 0; i < len; i++) + for (i = 0; i < len; i++) byte_mfm_add (fdi, secbuf[i]); } static void amiga_data (FDI *fdi, uae_u8 *secbuf) { - uae_u16 mfmbuf[4 + 512]; - uae_u32 dodd, deven, dck; + uae_u16 mfmbuf[4 + 512]; + uae_u32 dodd, deven, dck; int i; - for (i = 0; i < 512; i += 4) { - deven = ((secbuf[i + 0] << 24) | (secbuf[i + 1] << 16) - | (secbuf[i + 2] << 8) | (secbuf[i + 3])); - dodd = deven >> 1; + for (i = 0; i < 512; i += 4) { + deven = ((secbuf[i + 0] << 24) | (secbuf[i + 1] << 16) + | (secbuf[i + 2] << 8) | (secbuf[i + 3])); + dodd = deven >> 1; deven &= 0x55555555; - dodd &= 0x55555555; - mfmbuf[(i >> 1) + 4] = (uae_u16) (dodd >> 16); - mfmbuf[(i >> 1) + 5] = (uae_u16) dodd; - mfmbuf[(i >> 1) + 256 + 4] = (uae_u16) (deven >> 16); - mfmbuf[(i >> 1) + 256 + 5] = (uae_u16) deven; + dodd &= 0x55555555; + mfmbuf[(i >> 1) + 4] = (uae_u16) (dodd >> 16); + mfmbuf[(i >> 1) + 5] = (uae_u16) dodd; + mfmbuf[(i >> 1) + 256 + 4] = (uae_u16) (deven >> 16); + mfmbuf[(i >> 1) + 256 + 5] = (uae_u16) deven; } dck = 0; - for (i = 4; i < 4 + 512; i += 2) + for (i = 4; i < 4 + 512; i += 2) dck ^= (mfmbuf[i] << 16) | mfmbuf[i + 1]; - deven = dodd = dck; + deven = dodd = dck; dodd >>= 1; deven &= 0x55555555; - dodd &= 0x55555555; + dodd &= 0x55555555; mfmbuf[0] = (uae_u16) (dodd >> 16); mfmbuf[1] = (uae_u16) dodd; - mfmbuf[2] = (uae_u16) (deven >> 16); + mfmbuf[2] = (uae_u16) (deven >> 16); mfmbuf[3] = (uae_u16) deven; - for (i = 0; i < 4 + 512; i ++) - word_post_mfm_add (fdi, mfmbuf[i]); + for (i = 0; i < 4 + 512; i ++) + word_post_mfm_add (fdi, mfmbuf[i]); } static void amiga_sector_header (FDI *fdi, uae_u8 *header, uae_u8 *data, int sector, int untilgap) { uae_u8 headerbuf[4], databuf[16]; - uae_u32 deven, dodd, hck; - uae_u16 mfmbuf[24]; + uae_u32 deven, dodd, hck; + uae_u16 mfmbuf[24]; int i; byte_mfm_add (fdi, 0); byte_mfm_add (fdi, 0); - word_add (fdi, 0x4489); - word_add (fdi, 0x4489); + word_add (fdi, 0x4489); + word_add (fdi, 0x4489); if (header) { memcpy (headerbuf, header, 4); } else { @@ -837,47 +837,47 @@ static void amiga_sector_header (FDI *fdi, uae_u8 *header, uae_u8 *data, int sec else memset (databuf, 0, 16); - deven = ((headerbuf[0] << 24) | (headerbuf[1] << 16) - | (headerbuf[2] << 8) | (headerbuf[3])); - dodd = deven >> 1; + deven = ((headerbuf[0] << 24) | (headerbuf[1] << 16) + | (headerbuf[2] << 8) | (headerbuf[3])); + dodd = deven >> 1; deven &= 0x55555555; - dodd &= 0x55555555; + dodd &= 0x55555555; mfmbuf[0] = (uae_u16) (dodd >> 16); mfmbuf[1] = (uae_u16) dodd; - mfmbuf[2] = (uae_u16) (deven >> 16); + mfmbuf[2] = (uae_u16) (deven >> 16); mfmbuf[3] = (uae_u16) deven; - for (i = 0; i < 16; i += 4) { - deven = ((databuf[i] << 24) | (databuf[i + 1] << 16) - | (databuf[i + 2] << 8) | (databuf[i + 3])); - dodd = deven >> 1; + for (i = 0; i < 16; i += 4) { + deven = ((databuf[i] << 24) | (databuf[i + 1] << 16) + | (databuf[i + 2] << 8) | (databuf[i + 3])); + dodd = deven >> 1; deven &= 0x55555555; - dodd &= 0x55555555; - mfmbuf[(i >> 1) + 0 + 4] = (uae_u16) (dodd >> 16); - mfmbuf[(i >> 1) + 0 + 5] = (uae_u16) dodd; - mfmbuf[(i >> 1) + 8 + 4] = (uae_u16) (deven >> 16); - mfmbuf[(i >> 1) + 8 + 5] = (uae_u16) deven; + dodd &= 0x55555555; + mfmbuf[(i >> 1) + 0 + 4] = (uae_u16) (dodd >> 16); + mfmbuf[(i >> 1) + 0 + 5] = (uae_u16) dodd; + mfmbuf[(i >> 1) + 8 + 4] = (uae_u16) (deven >> 16); + mfmbuf[(i >> 1) + 8 + 5] = (uae_u16) deven; } hck = 0; - for (i = 0; i < 4 + 16; i += 2) + for (i = 0; i < 4 + 16; i += 2) hck ^= (mfmbuf[i] << 16) | mfmbuf[i + 1]; - deven = dodd = hck; + deven = dodd = hck; dodd >>= 1; deven &= 0x55555555; - dodd &= 0x55555555; - mfmbuf[20] = (uae_u16) (dodd >> 16); + dodd &= 0x55555555; + mfmbuf[20] = (uae_u16) (dodd >> 16); mfmbuf[21] = (uae_u16) dodd; mfmbuf[22] = (uae_u16) (deven >> 16); mfmbuf[23] = (uae_u16) deven; - for (i = 0; i < 4 + 16 + 4; i ++) - word_post_mfm_add (fdi, mfmbuf[i]); + for (i = 0; i < 4 + 16 + 4; i ++) + word_post_mfm_add (fdi, mfmbuf[i]); } -/* standard super-extended Amiga sector header */ +/* standard super-extended Amiga sector header */ static void s20(FDI *fdi) { bit_drop_next (fdi); - debuglog ("s20:header=%s,data=%s", datalog(fdi->track_src, 4), datalog(fdi->track_src + 4, 16)); + debuglog ("s20:header=%s,data=%s", datalog(fdi->track_src, 4), datalog(fdi->track_src + 4, 16)); amiga_sector_header (fdi, fdi->track_src, fdi->track_src + 4, 0, 0); fdi->track_src += 4 + 16; } @@ -885,54 +885,54 @@ static void s20(FDI *fdi) static void s21(FDI *fdi) { bit_drop_next (fdi); - debuglog ("s21:header=%s", datalog(fdi->track_src, 4)); - amiga_sector_header (fdi, fdi->track_src, 0, 0, 0); + debuglog ("s21:header=%s", datalog(fdi->track_src, 4)); + amiga_sector_header (fdi, fdi->track_src, 0, 0, 0); fdi->track_src += 4; } -/* standard Amiga sector header */ +/* standard Amiga sector header */ static void s22(FDI *fdi) { bit_drop_next (fdi); debuglog("s22:sector=%d,untilgap=%d", fdi->track_src[0], fdi->track_src[1]); - amiga_sector_header (fdi, 0, 0, fdi->track_src[0], fdi->track_src[1]); + amiga_sector_header (fdi, 0, 0, fdi->track_src[0], fdi->track_src[1]); fdi->track_src += 2; } -/* standard 512-byte, CRC-correct Amiga data */ +/* standard 512-byte, CRC-correct Amiga data */ static void s23(FDI *fdi) { - debuglog("s23:data=%s", datalog (fdi->track_src, 512)); + debuglog("s23:data=%s", datalog (fdi->track_src, 512)); amiga_data (fdi, fdi->track_src); fdi->track_src += 512; } -/* not-decoded, 128*2^x-byte, CRC-correct Amiga data */ +/* not-decoded, 128*2^x-byte, CRC-correct Amiga data */ static void s24(FDI *fdi) { int shift = *fdi->track_src++; - debuglog("s24:shift=%d,data=%s", shift, datalog (fdi->track_src, 128 << shift)); - amiga_data_raw (fdi, fdi->track_src, 0, 128 << shift); - fdi->track_src += 128 << shift; + debuglog("s24:shift=%d,data=%s", shift, datalog (fdi->track_src, 128 << shift)); + amiga_data_raw (fdi, fdi->track_src, 0, 128 << shift); + fdi->track_src += 128 << shift; } -/* not-decoded, 128*2^x-byte, CRC-incorrect Amiga data */ +/* not-decoded, 128*2^x-byte, CRC-incorrect Amiga data */ static void s25(FDI *fdi) { int shift = *fdi->track_src++; - debuglog("s25:shift=%d,crc=%s,data=%s", shift, datalog (fdi->track_src, 4), datalog (fdi->track_src + 4, 128 << shift)); - amiga_data_raw (fdi, fdi->track_src + 4, fdi->track_src, 128 << shift); + debuglog("s25:shift=%d,crc=%s,data=%s", shift, datalog (fdi->track_src, 4), datalog (fdi->track_src + 4, 128 << shift)); + amiga_data_raw (fdi, fdi->track_src + 4, fdi->track_src, 128 << shift); fdi->track_src += 4 + (128 << shift); } /* standard extended Amiga sector */ static void s26(FDI *fdi) { s21 (fdi); - debuglog("s26:data=%s", datalog (fdi->track_src, 512)); + debuglog("s26:data=%s", datalog (fdi->track_src, 512)); amiga_data (fdi, fdi->track_src); fdi->track_src += 512; } -/* standard short Amiga sector */ +/* standard short Amiga sector */ static void s27(FDI *fdi) { s22 (fdi); - debuglog("s27:data=%s", datalog (fdi->track_src, 512)); + debuglog("s27:data=%s", datalog (fdi->track_src, 512)); amiga_data (fdi, fdi->track_src); fdi->track_src += 512; } @@ -941,37 +941,37 @@ static void s27(FDI *fdi) /* IBM */ /* *** */ -static uae_u16 ibm_crc (uae_u8 byte, int reset) +static uae_u16 ibm_crc (uae_u8 byte, int reset) { static uae_u16 crc; int i; if (reset) crc = 0xcdb4; - for (i = 0; i < 8; i++) { - if (crc & 0x8000) { - crc <<= 1; - if (!(byte & 0x80)) crc ^= 0x1021; + for (i = 0; i < 8; i++) { + if (crc & 0x8000) { + crc <<= 1; + if (!(byte & 0x80)) crc ^= 0x1021; } else { - crc <<= 1; - if (byte & 0x80) crc ^= 0x1021; + crc <<= 1; + if (byte & 0x80) crc ^= 0x1021; } byte <<= 1; } return crc; } -static void ibm_data (FDI *fdi, uae_u8 *data, uae_u8 *crc, int len) +static void ibm_data (FDI *fdi, uae_u8 *data, uae_u8 *crc, int len) { int i; uae_u8 crcbuf[2]; - uae_u16 crcv; + uae_u16 crcv; - word_add (fdi, 0x4489); - word_add (fdi, 0x4489); - word_add (fdi, 0x4489); + word_add (fdi, 0x4489); + word_add (fdi, 0x4489); + word_add (fdi, 0x4489); byte_mfm_add (fdi, 0xfb); - ibm_crc (0xfb, 1); - for (i = 0; i < len; i++) { + ibm_crc (0xfb, 1); + for (i = 0; i < len; i++) { byte_mfm_add (fdi, data[i]); crcv = ibm_crc (data[i], 0); } @@ -984,18 +984,18 @@ static void ibm_data (FDI *fdi, uae_u8 *data, uae_u8 *crc, int len) byte_mfm_add (fdi, crc[1]); } -static void ibm_sector_header (FDI *fdi, uae_u8 *data, uae_u8 *crc, int secnum, int pre) +static void ibm_sector_header (FDI *fdi, uae_u8 *data, uae_u8 *crc, int secnum, int pre) { uae_u8 secbuf[5]; uae_u8 crcbuf[2]; - uae_u16 crcv; + uae_u16 crcv; int i; if (pre) bytes_mfm_add (fdi, 0, 12); - word_add (fdi, 0x4489); - word_add (fdi, 0x4489); - word_add (fdi, 0x4489); + word_add (fdi, 0x4489); + word_add (fdi, 0x4489); + word_add (fdi, 0x4489); secbuf[0] = 0xfe; if (secnum >= 0) { secbuf[1] = (uae_u8)(fdi->current_track/2); @@ -1005,18 +1005,18 @@ static void ibm_sector_header (FDI *fdi, uae_u8 *data, uae_u8 *crc, int secnum, } else { memcpy (secbuf + 1, data, 4); } - ibm_crc (secbuf[0], 1); - ibm_crc (secbuf[1], 0); - ibm_crc (secbuf[2], 0); - ibm_crc (secbuf[3], 0); + ibm_crc (secbuf[0], 1); + ibm_crc (secbuf[1], 0); + ibm_crc (secbuf[2], 0); + ibm_crc (secbuf[3], 0); crcv = ibm_crc (secbuf[4], 0); if (crc) { - memcpy (crcbuf, crc, 2); + memcpy (crcbuf, crc, 2); } else { crcbuf[0] = (uae_u8)(crcv >> 8); crcbuf[1] = (uae_u8)crcv; } - /* data */ + /* data */ for (i = 0;i < 5; i++) byte_mfm_add (fdi, secbuf[i]); /* crc */ @@ -1024,17 +1024,17 @@ static void ibm_sector_header (FDI *fdi, uae_u8 *data, uae_u8 *crc, int secnum, byte_mfm_add (fdi, crcbuf[1]); } -/* standard IBM index address mark */ +/* standard IBM index address mark */ static void s10(FDI *fdi) { bit_drop_next (fdi); bytes_mfm_add (fdi, 0, 12); - word_add (fdi, 0x5224); - word_add (fdi, 0x5224); - word_add (fdi, 0x5224); + word_add (fdi, 0x5224); + word_add (fdi, 0x5224); + word_add (fdi, 0x5224); byte_mfm_add (fdi, 0xfc); } -/* standard IBM pre-gap */ +/* standard IBM pre-gap */ static void s11(FDI *fdi) { bit_drop_next (fdi); @@ -1049,19 +1049,19 @@ static void s12(FDI *fdi) bit_drop_next (fdi); bytes_mfm_add (fdi, 0x4e, 78); } -/* standard extended IBM sector header */ +/* standard extended IBM sector header */ static void s13(FDI *fdi) { bit_drop_next (fdi); debuglog ("s13:header=%s", datalog (fdi->track_src, 4)); - ibm_sector_header (fdi, fdi->track_src, 0, -1, 1); + ibm_sector_header (fdi, fdi->track_src, 0, -1, 1); fdi->track_src += 4; } /* standard mini-extended IBM sector header */ static void s14(FDI *fdi) { debuglog ("s14:header=%s", datalog (fdi->track_src, 4)); - ibm_sector_header (fdi, fdi->track_src, 0, -1, 0); + ibm_sector_header (fdi, fdi->track_src, 0, -1, 0); fdi->track_src += 4; } /* standard short IBM sector header */ @@ -1069,33 +1069,33 @@ static void s15(FDI *fdi) { bit_drop_next (fdi); debuglog ("s15:sector=%d", *fdi->track_src); - ibm_sector_header (fdi, 0, 0, *fdi->track_src++, 1); + ibm_sector_header (fdi, 0, 0, *fdi->track_src++, 1); } /* standard mini-short IBM sector header */ static void s16(FDI *fdi) { debuglog ("s16:track=%d", *fdi->track_src); - ibm_sector_header (fdi, 0, 0, *fdi->track_src++, 0); + ibm_sector_header (fdi, 0, 0, *fdi->track_src++, 0); } -/* standard CRC-incorrect mini-extended IBM sector header */ +/* standard CRC-incorrect mini-extended IBM sector header */ static void s17(FDI *fdi) { debuglog ("s17:header=%s,crc=%s", datalog (fdi->track_src, 4), datalog (fdi->track_src + 4, 2)); - ibm_sector_header (fdi, fdi->track_src, fdi->track_src + 4, -1, 0); + ibm_sector_header (fdi, fdi->track_src, fdi->track_src + 4, -1, 0); fdi->track_src += 4 + 2; } -/* standard CRC-incorrect mini-short IBM sector header */ +/* standard CRC-incorrect mini-short IBM sector header */ static void s18(FDI *fdi) { - debuglog ("s18:sector=%d,header=%s", *fdi->track_src, datalog (fdi->track_src + 1, 4)); - ibm_sector_header (fdi, 0, fdi->track_src + 1, *fdi->track_src, 0); + debuglog ("s18:sector=%d,header=%s", *fdi->track_src, datalog (fdi->track_src + 1, 4)); + ibm_sector_header (fdi, 0, fdi->track_src + 1, *fdi->track_src, 0); fdi->track_src += 1 + 4; } /* standard 512-byte CRC-correct IBM data */ static void s19(FDI *fdi) { debuglog ("s19:data=%s", datalog (fdi->track_src , 512)); - ibm_data (fdi, fdi->track_src, 0, 512); + ibm_data (fdi, fdi->track_src, 0, 512); fdi->track_src += 512; } /* standard 128*2^x-byte-byte CRC-correct IBM data */ @@ -1104,17 +1104,17 @@ static void s1a(FDI *fdi) int shift = *fdi->track_src++; debuglog ("s1a:shift=%d,data=%s", shift, datalog (fdi->track_src , 128 << shift)); ibm_data (fdi, fdi->track_src, 0, 128 << shift); - fdi->track_src += 128 << shift; + fdi->track_src += 128 << shift; } -/* standard 128*2^x-byte-byte CRC-incorrect IBM data */ +/* standard 128*2^x-byte-byte CRC-incorrect IBM data */ static void s1b(FDI *fdi) { int shift = *fdi->track_src++; - debuglog ("s1b:shift=%d,crc=%s,data=%s", shift, datalog (fdi->track_src + (128 << shift), 2), datalog (fdi->track_src , 128 << shift)); - ibm_data (fdi, fdi->track_src, fdi->track_src + (128 << shift), 128 << shift); + debuglog ("s1b:shift=%d,crc=%s,data=%s", shift, datalog (fdi->track_src + (128 << shift), 2), datalog (fdi->track_src , 128 << shift)); + ibm_data (fdi, fdi->track_src, fdi->track_src + (128 << shift), 128 << shift); fdi->track_src += (128 << shift) + 2; } -/* standard extended IBM sector */ +/* standard extended IBM sector */ static void s1c(FDI *fdi) { int shift = fdi->track_src[3]; @@ -1122,9 +1122,9 @@ static void s1c(FDI *fdi) bytes_mfm_add (fdi, 0x4e, 22); bytes_mfm_add (fdi, 0x00, 12); ibm_data (fdi, fdi->track_src, 0, 128 << shift); - fdi->track_src += 128 << shift; + fdi->track_src += 128 << shift; } -/* standard short IBM sector */ +/* standard short IBM sector */ static void s1d(FDI *fdi) { s15 (fdi); @@ -1138,7 +1138,7 @@ static void sff(FDI *fdi) { } -typedef void (*decode_described_track_func)(FDI*); +typedef void (*decode_described_track_func)(FDI*); static decode_described_track_func decode_sectors_described_track[] = { @@ -1157,22 +1157,22 @@ static decode_described_track_func decode_sectors_described_track[] = dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx, /* C0-CF */ dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx, /* D0-DF */ dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx, /* E0-EF */ - dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,sff /* F0-FF */ + dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,dxx,sff /* F0-FF */ }; -static void track_amiga (struct fdi *fdi, int first_sector, int max_sector) +static void track_amiga (struct fdi *fdi, int first_sector, int max_sector) { int i; - bit_add (fdi, 0); + bit_add (fdi, 0); bit_drop_next (fdi); - for (i = 0; i < max_sector; i++) { - amiga_sector_header (fdi, 0, 0, first_sector, max_sector - i); - amiga_data (fdi, fdi->track_src + first_sector * 512); - first_sector++; - if (first_sector >= max_sector) first_sector = 0; + for (i = 0; i < max_sector; i++) { + amiga_sector_header (fdi, 0, 0, first_sector, max_sector - i); + amiga_data (fdi, fdi->track_src + first_sector * 512); + first_sector++; + if (first_sector >= max_sector) first_sector = 0; } - bytes_mfm_add (fdi, 0, 260); /* gap */ + bytes_mfm_add (fdi, 0, 260); /* gap */ } static void track_atari_st (struct fdi *fdi, int max_sector) { @@ -1181,7 +1181,7 @@ static void track_atari_st (struct fdi *fdi, int max_sector) switch (max_sector) { - case 9: + case 9: gap3 = 40; break; case 10: @@ -1189,15 +1189,15 @@ static void track_atari_st (struct fdi *fdi, int max_sector) break; } s15 (fdi); - for (i = 0; i < max_sector; i++) { + for (i = 0; i < max_sector; i++) { byte_mfm_add (fdi, 0x4e); byte_mfm_add (fdi, 0x4e); - ibm_sector_header (fdi, 0, 0, fdi->current_track, 1); + ibm_sector_header (fdi, 0, 0, fdi->current_track, 1); ibm_data (fdi, p + i * 512, 0, 512); bytes_mfm_add (fdi, 0x4e, gap3); } - bytes_mfm_add (fdi, 0x4e, 660 - gap3); - fdi->track_src += fdi->track_len * 256; + bytes_mfm_add (fdi, 0x4e, 660 - gap3); + fdi->track_src += fdi->track_len * 256; } static void track_pc (struct fdi *fdi, int max_sector) { @@ -1206,26 +1206,26 @@ static void track_pc (struct fdi *fdi, int max_sector) switch (max_sector) { - case 8: + case 8: gap3 = 116; break; - case 9: + case 9: gap3 = 54; break; default: - gap3 = 100; /* fixme */ + gap3 = 100; /* fixme */ break; } s11 (fdi); - for (i = 0; i < max_sector; i++) { + for (i = 0; i < max_sector; i++) { byte_mfm_add (fdi, 0x4e); byte_mfm_add (fdi, 0x4e); - ibm_sector_header (fdi, 0, 0, fdi->current_track, 1); + ibm_sector_header (fdi, 0, 0, fdi->current_track, 1); ibm_data (fdi, p + i * 512, 0, 512); bytes_mfm_add (fdi, 0x4e, gap3); } - bytes_mfm_add (fdi, 0x4e, 600 - gap3); - fdi->track_src += fdi->track_len * 256; + bytes_mfm_add (fdi, 0x4e, 600 - gap3); + fdi->track_src += fdi->track_len * 256; } /* amiga dd */ @@ -1242,69 +1242,69 @@ static void track_amiga_hd (struct fdi *fdi) track_amiga (fdi, 0, 22); fdi->track_src = p + fdi->track_len * 256; } -/* atari st 9 sector */ +/* atari st 9 sector */ static void track_atari_st_9 (struct fdi *fdi) { track_atari_st (fdi, 9); } /* atari st 10 sector */ -static void track_atari_st_10 (struct fdi *fdi) +static void track_atari_st_10 (struct fdi *fdi) { track_atari_st (fdi, 10); } -/* pc 8 sector */ +/* pc 8 sector */ static void track_pc_8 (struct fdi *fdi) { track_pc (fdi, 8); } -/* pc 9 sector */ +/* pc 9 sector */ static void track_pc_9 (struct fdi *fdi) { track_pc (fdi, 9); } -/* pc 15 sector */ -static void track_pc_15 (struct fdi *fdi) +/* pc 15 sector */ +static void track_pc_15 (struct fdi *fdi) { track_pc (fdi, 15); } -/* pc 18 sector */ -static void track_pc_18 (struct fdi *fdi) +/* pc 18 sector */ +static void track_pc_18 (struct fdi *fdi) { track_pc (fdi, 18); } -/* pc 36 sector */ -static void track_pc_36 (struct fdi *fdi) +/* pc 36 sector */ +static void track_pc_36 (struct fdi *fdi) { track_pc (fdi, 36); } -typedef void (*decode_normal_track_func)(FDI*); +typedef void (*decode_normal_track_func)(FDI*); -static decode_normal_track_func decode_normal_track[] = +static decode_normal_track_func decode_normal_track[] = { - track_empty, /* 0 */ - track_amiga_dd, track_amiga_hd, /* 1-2 */ - track_atari_st_9, track_atari_st_10, /* 3-4 */ - track_pc_8, track_pc_9, track_pc_15, track_pc_18, track_pc_36, /* 5-9 */ + track_empty, /* 0 */ + track_amiga_dd, track_amiga_hd, /* 1-2 */ + track_atari_st_9, track_atari_st_10, /* 3-4 */ + track_pc_8, track_pc_9, track_pc_15, track_pc_18, track_pc_36, /* 5-9 */ zxx,zxx,zxx,zxx,zxx /* A-F */ }; static void fix_mfm_sync (FDI *fdi) { - int i, pos, off1, off2, off3, mask1, mask2, mask3; + int i, pos, off1, off2, off3, mask1, mask2, mask3; - for (i = 0; i < fdi->mfmsync_offset; i++) { + for (i = 0; i < fdi->mfmsync_offset; i++) { pos = fdi->mfmsync_buffer[i]; off1 = (pos - 1) >> 3; off2 = (pos + 1) >> 3; off3 = pos >> 3; - mask1 = 1 << (7 - ((pos - 1) & 7)); - mask2 = 1 << (7 - ((pos + 1) & 7)); - mask3 = 1 << (7 - (pos & 7)); - if (!(fdi->track_dst[off1] & mask1) && !(fdi->track_dst[off2] & mask2)) - fdi->track_dst[off3] |= mask3; + mask1 = 1 << (7 - ((pos - 1) & 7)); + mask2 = 1 << (7 - ((pos + 1) & 7)); + mask3 = 1 << (7 - (pos & 7)); + if (!(fdi->track_dst[off1] & mask1) && !(fdi->track_dst[off2] & mask2)) + fdi->track_dst[off3] |= mask3; else - fdi->track_dst[off3] &= ~mask3; + fdi->track_dst[off3] &= ~mask3; } } @@ -1312,28 +1312,28 @@ static int handle_sectors_described_track (FDI *fdi) { int oldout; uae_u8 *start_src = fdi->track_src ; - fdi->encoding_type = *fdi->track_src++; + fdi->encoding_type = *fdi->track_src++; fdi->index_offset = get_u32(fdi->track_src); fdi->index_offset >>= 8; fdi->track_src += 3; outlog ("sectors_described, index offset: %d\n",fdi->index_offset); do { - fdi->track_type = *fdi->track_src++; - outlog ("%06.6X %06.6X %02.2X:",fdi->track_src - start_src + 0x200, fdi->out/8, fdi->track_type); + fdi->track_type = *fdi->track_src++; + outlog ("%06.6X %06.6X %02.2X:",fdi->track_src - start_src + 0x200, fdi->out/8, fdi->track_type); oldout = fdi->out; decode_sectors_described_track[fdi->track_type](fdi); - outlog(" %d\n", fdi->out - oldout); + outlog(" %d\n", fdi->out - oldout); oldout = fdi->out; - if (fdi->out < 0 || fdi->err) { - outlog ("\nin %d bytes, out %d bits\n", fdi->track_src - fdi->track_src_buffer, fdi->out); + if (fdi->out < 0 || fdi->err) { + outlog ("\nin %d bytes, out %d bits\n", fdi->track_src - fdi->track_src_buffer, fdi->out); return -1; } if (fdi->track_src - fdi->track_src_buffer >= fdi->track_src_len) { - outlog ("source buffer overrun, previous type: %02.2X\n", fdi->track_type); + outlog ("source buffer overrun, previous type: %02.2X\n", fdi->track_type); return -1; } - } while (fdi->track_type != 0xff); + } while (fdi->track_type != 0xff); outlog("\n"); fix_mfm_sync (fdi); return fdi->out; @@ -1341,25 +1341,25 @@ static int handle_sectors_described_track (FDI *fdi) static uae_u8 *fdi_decompress (int pulses, uae_u8 *sizep, uae_u8 *src, int *dofree) { - uae_u32 size = get_u24 (sizep); - uae_u32 *dst2; - int len = size & 0x3fffff; + uae_u32 size = get_u24 (sizep); + uae_u32 *dst2; + int len = size & 0x3fffff; uae_u8 *dst; - int mode = size >> 22, i; + int mode = size >> 22, i; - *dofree = 0; - if (mode == 0 && pulses * 2 > len) + *dofree = 0; + if (mode == 0 && pulses * 2 > len) mode = 1; if (mode == 0) { dst2 = (uae_u32*)src; dst = src; - for (i = 0; i < pulses; i++) { - *dst2++ = get_u32 (src); + for (i = 0; i < pulses; i++) { + *dst2++ = get_u32 (src); src += 4; } - } else if (mode == 1) { + } else if (mode == 1) { dst = fdi_malloc (pulses *4); - *dofree = 1; + *dofree = 1; fdi_decode (src, pulses, dst); } else { dst = 0; @@ -1374,9 +1374,9 @@ static void dumpstream(int track, uae_u8 *stream, int len) FILE *f; sprintf (name, "track_%d.raw", track); - f = fopen(name, "wb"); - fwrite (stream, 1, len * 4, f); - fclose (f); + f = fopen(name, "wb"); + fwrite (stream, 1, len * 4, f); + fclose (f); #endif } @@ -1386,7 +1386,7 @@ STATIC_INLINE void addbit (uae_u8 *p, int bit) { int off1 = bitoffset / 8; int off2 = bitoffset % 8; - p[off1] |= bit << (7 - off2); + p[off1] |= bit << (7 - off2); bitoffset++; } @@ -1397,21 +1397,21 @@ struct pulse_sample { }; -#define FDI_MAX_ARRAY 10 /* change this value as you want */ +#define FDI_MAX_ARRAY 10 /* change this value as you want */ static int pulse_limitval = 15; /* tolerance of 15% */ static struct pulse_sample psarray[FDI_MAX_ARRAY]; -static int array_index; +static int array_index; static unsigned long total; static int totaldiv; -static void init_array(unsigned long standard_MFM_2_bit_cell_size, int nb_of_bits) +static void init_array(unsigned long standard_MFM_2_bit_cell_size, int nb_of_bits) { int i; - for (i = 0; i < FDI_MAX_ARRAY; i++) { - psarray[i].size = standard_MFM_2_bit_cell_size; // That is (total track length / 50000) for Amiga double density + for (i = 0; i < FDI_MAX_ARRAY; i++) { + psarray[i].size = standard_MFM_2_bit_cell_size; // That is (total track length / 50000) for Amiga double density total += psarray[i].size; - psarray[i].number_of_bits = nb_of_bits; + psarray[i].number_of_bits = nb_of_bits; totaldiv += psarray[i].number_of_bits; } array_index = 0; @@ -1423,12 +1423,12 @@ static void fdi2_decode (FDI *fdi, unsigned long totalavg, uae_u32 *avgp, uae_u3 { unsigned long adjust; unsigned long adjusted_pulse; - unsigned long standard_MFM_2_bit_cell_size = totalavg / 50000; - unsigned long standard_MFM_8_bit_cell_size = totalavg / 12500; + unsigned long standard_MFM_2_bit_cell_size = totalavg / 50000; + unsigned long standard_MFM_8_bit_cell_size = totalavg / 12500; int real_size, i, j, eodat, outstep; int indexoffset = *indexoffsetp; uae_u8 *d = fdi->track_dst_buffer; - uae_u16 *pt = fdi->track_dst_buffer_timing; + uae_u16 *pt = fdi->track_dst_buffer_timing; uae_u32 ref_pulse, pulse; /* detects a long-enough stable pulse coming just after another stable pulse */ @@ -1444,7 +1444,7 @@ static void fdi2_decode (FDI *fdi, unsigned long totalavg, uae_u32 *avgp, uae_u3 i--; eodat = i; adjust = 0; - total = 0; + total = 0; totaldiv = 0; init_array(standard_MFM_2_bit_cell_size, 2); bitoffset = 0; @@ -1453,17 +1453,17 @@ static void fdi2_decode (FDI *fdi, unsigned long totalavg, uae_u32 *avgp, uae_u3 while (outstep < 2) { /* calculates the current average bitrate from previous decoded data */ - uae_u32 avg_size = (total << 3) / totaldiv; /* this is the new average size for one MFM bit */ + uae_u32 avg_size = (total << 3) / totaldiv; /* this is the new average size for one MFM bit */ /* uae_u32 avg_size = (uae_u32)((((float)total)*8.0) / ((float)totaldiv)); */ - /* you can try tighter ranges than 25%, or wider ranges. I would probably go for tighter... */ - if ((avg_size < (standard_MFM_8_bit_cell_size - (pulse_limitval * standard_MFM_8_bit_cell_size / 100))) || + /* you can try tighter ranges than 25%, or wider ranges. I would probably go for tighter... */ + if ((avg_size < (standard_MFM_8_bit_cell_size - (pulse_limitval * standard_MFM_8_bit_cell_size / 100))) || (avg_size > (standard_MFM_8_bit_cell_size + (pulse_limitval * standard_MFM_8_bit_cell_size / 100)))) { //init_array(standard_MFM_2_bit_cell_size, 2); avg_size = standard_MFM_8_bit_cell_size; } - /* this is to prevent the average value from going too far - * from the theoretical value, otherwise it could progressively go to (2 * - * real value), or (real value / 2), etc. */ + /* this is to prevent the average value from going too far + * from the theoretical value, otherwise it could progressively go to (2 * + * real value), or (real value / 2), etc. */ /* gets the next long-enough pulse (this may require more than one pulse) */ pulse = 0; @@ -1524,8 +1524,8 @@ static void fdi2_decode (FDI *fdi, unsigned long totalavg, uae_u32 *avgp, uae_u3 for (j = real_size; j > 1; j--) addbit (d, 0); addbit (d, 1); - for (j = 0; j < real_size; j++) - *pt++ = (uae_u16)(pulse / real_size); + for (j = 0; j < real_size; j++) + *pt++ = (uae_u16)(pulse / real_size); } /* prepares for the next pulse */ @@ -1534,7 +1534,7 @@ static void fdi2_decode (FDI *fdi, unsigned long totalavg, uae_u32 *avgp, uae_u3 totaldiv -= psarray[array_index].number_of_bits; psarray[array_index].size = pulse; psarray[array_index].number_of_bits = real_size; - total += pulse; + total += pulse; totaldiv += real_size; array_index++; if (array_index >= FDI_MAX_ARRAY) @@ -1550,8 +1550,8 @@ static void fdi2_decode (FDI *fdi, unsigned long totalavg, uae_u32 *avgp, uae_u3 { unsigned long adjust; unsigned long adjusted_pulse; - unsigned long standard_MFM_2_bit_cell_size = totalavg / 50000; - unsigned long standard_MFM_8_bit_cell_size = totalavg / 12500; + unsigned long standard_MFM_2_bit_cell_size = totalavg / 50000; + unsigned long standard_MFM_8_bit_cell_size = totalavg / 12500; int real_size, i, j, nexti, eodat, outstep, randval; int indexoffset = *indexoffsetp; uae_u8 *d = fdi->track_dst_buffer; @@ -1573,7 +1573,7 @@ static void fdi2_decode (FDI *fdi, unsigned long totalavg, uae_u32 *avgp, uae_u3 eodat = i; i--; adjust = 0; - total = 0; + total = 0; totaldiv = 0; init_array(standard_MFM_2_bit_cell_size, 1 + mfm); bitoffset = 0; @@ -1583,17 +1583,17 @@ static void fdi2_decode (FDI *fdi, unsigned long totalavg, uae_u32 *avgp, uae_u3 while (outstep < 2) { /* calculates the current average bitrate from previous decoded data */ - uae_u32 avg_size = (total << (2 + mfm)) / totaldiv; /* this is the new average size for one MFM bit */ + uae_u32 avg_size = (total << (2 + mfm)) / totaldiv; /* this is the new average size for one MFM bit */ /* uae_u32 avg_size = (uae_u32)((((float)total)*((float)(mfm+1))*4.0) / ((float)totaldiv)); */ - /* you can try tighter ranges than 25%, or wider ranges. I would probably go for tighter... */ - if ((avg_size < (standard_MFM_8_bit_cell_size - (pulse_limitval * standard_MFM_8_bit_cell_size / 100))) || + /* you can try tighter ranges than 25%, or wider ranges. I would probably go for tighter... */ + if ((avg_size < (standard_MFM_8_bit_cell_size - (pulse_limitval * standard_MFM_8_bit_cell_size / 100))) || (avg_size > (standard_MFM_8_bit_cell_size + (pulse_limitval * standard_MFM_8_bit_cell_size / 100)))) { //init_array(standard_MFM_2_bit_cell_size, mfm + 1); avg_size = standard_MFM_8_bit_cell_size; } - /* this is to prevent the average value from going too far - * from the theoretical value, otherwise it could progressively go to (2 * - * real value), or (real value / 2), etc. */ + /* this is to prevent the average value from going too far + * from the theoretical value, otherwise it could progressively go to (2 * + * real value), or (real value / 2), etc. */ /* gets the next long-enough pulse (this may require more than one pulse) */ pulse = 0; @@ -1768,8 +1768,8 @@ static void fdi2_decode (FDI *fdi, unsigned long totalavg, uae_u32 *avgp, uae_u3 for (j = real_size; j > 1; j--) addbit (d, 0); addbit (d, 1); - for (j = 0; j < real_size; j++) - *pt++ = (uae_u16)(pulse / real_size); + for (j = 0; j < real_size; j++) + *pt++ = (uae_u16)(pulse / real_size); } /* prepares for the next pulse */ @@ -1778,10 +1778,10 @@ static void fdi2_decode (FDI *fdi, unsigned long totalavg, uae_u32 *avgp, uae_u3 totaldiv -= psarray[array_index].number_of_bits; psarray[array_index].size = pulse; psarray[array_index].number_of_bits = real_size; - total += pulse; + total += pulse; totaldiv += real_size; array_index++; - if (array_index >= FDI_MAX_ARRAY) + if (array_index >= FDI_MAX_ARRAY) array_index = 0; } @@ -1790,17 +1790,17 @@ static void fdi2_decode (FDI *fdi, unsigned long totalavg, uae_u32 *avgp, uae_u3 #endif -static void fdi2_celltiming (FDI *fdi, unsigned long totalavg, int bitoffset, uae_u16 *out) +static void fdi2_celltiming (FDI *fdi, unsigned long totalavg, int bitoffset, uae_u16 *out) { - uae_u16 *pt2, *pt; + uae_u16 *pt2, *pt; double avg_bit_len; int i; avg_bit_len = (double)totalavg / (double)bitoffset; pt2 = fdi->track_dst_buffer_timing; pt = out; - for (i = 0; i < bitoffset / 8; i++) { - double v = (pt2[0] + pt2[1] + pt2[2] + pt2[3] + pt2[4] + pt2[5] + pt2[6] + pt2[7]) / 8.0; + for (i = 0; i < bitoffset / 8; i++) { + double v = (pt2[0] + pt2[1] + pt2[2] + pt2[3] + pt2[4] + pt2[5] + pt2[6] + pt2[7]) / 8.0; v = 1000.0 * v / avg_bit_len; *pt++ = (uae_u16)v; pt2 += 8; @@ -1811,14 +1811,14 @@ static void fdi2_celltiming (FDI *fdi, unsigned long totalavg, int bitoffset, ua static int decode_lowlevel_track (FDI *fdi, int track, struct fdi_cache *cache) { - uae_u8 *p1, *d; - uae_u32 *p2; - uae_u32 *avgp, *minp = 0, *maxp = 0; + uae_u8 *p1, *d; + uae_u32 *p2; + uae_u32 *avgp, *minp = 0, *maxp = 0; uae_u8 *idxp = 0; - uae_u32 maxidx, totalavg, weakbits; + uae_u32 maxidx, totalavg, weakbits; int i, j, len, pulses, indexoffset; int avg_free, min_free = 0, max_free = 0, idx_free; - int idx_off1, idx_off2, idx_off3; + int idx_off1, idx_off2, idx_off3; d = fdi->track_dst; p1 = fdi->track_src; @@ -1827,16 +1827,16 @@ static int decode_lowlevel_track (FDI *fdi, int track, struct fdi_cache *cache) return -1; p1 += 4; len = 12; - avgp = (uae_u32*)fdi_decompress (pulses, p1 + 0, p1 + len, &avg_free); + avgp = (uae_u32*)fdi_decompress (pulses, p1 + 0, p1 + len, &avg_free); dumpstream(track, (uae_u8*)avgp, pulses); - len += get_u24 (p1 + 0) & 0x3fffff; + len += get_u24 (p1 + 0) & 0x3fffff; if (!avgp) return -1; - if (get_u24 (p1 + 3) && get_u24 (p1 + 6)) { - minp = (uae_u32*)fdi_decompress (pulses, p1 + 3, p1 + len, &min_free); - len += get_u24 (p1 + 3) & 0x3fffff; - maxp = (uae_u32*)fdi_decompress (pulses, p1 + 6, p1 + len, &max_free); - len += get_u24 (p1 + 6) & 0x3fffff; + if (get_u24 (p1 + 3) && get_u24 (p1 + 6)) { + minp = (uae_u32*)fdi_decompress (pulses, p1 + 3, p1 + len, &min_free); + len += get_u24 (p1 + 3) & 0x3fffff; + maxp = (uae_u32*)fdi_decompress (pulses, p1 + 6, p1 + len, &max_free); + len += get_u24 (p1 + 6) & 0x3fffff; /* Computes the real min and max values */ for (i = 0; i < pulses; i++) { maxp[i] = avgp[i] + minp[i] - maxp[i]; @@ -1846,12 +1846,12 @@ static int decode_lowlevel_track (FDI *fdi, int track, struct fdi_cache *cache) minp = avgp; maxp = avgp; } - if (get_u24 (p1 + 9)) { + if (get_u24 (p1 + 9)) { idx_off1 = 0; idx_off2 = 1; idx_off3 = 2; idxp = fdi_decompress (pulses, p1 + 9, p1 + len, &idx_free); - if (idx_free) { + if (idx_free) { if (idxp[0] == 0 && idxp[1] == 0) { idx_off1 = 2; idx_off2 = 3; @@ -1862,23 +1862,23 @@ static int decode_lowlevel_track (FDI *fdi, int track, struct fdi_cache *cache) idx_off3 = 4; } } else { - idxp = fdi_malloc (pulses * 2); + idxp = fdi_malloc (pulses * 2); idx_free = 1; - for (i = 0; i < pulses; i++) { - idxp[i * 2 + 0] = 2; - idxp[i * 2 + 1] = 0; + for (i = 0; i < pulses; i++) { + idxp[i * 2 + 0] = 2; + idxp[i * 2 + 1] = 0; } - idxp[0] = 1; - idxp[1] = 1; + idxp[0] = 1; + idxp[1] = 1; } maxidx = 0; indexoffset = 0; p1 = idxp; - for (i = 0; i < pulses; i++) { - if (p1[idx_off1] + p1[idx_off2] > maxidx) - maxidx = p1[idx_off1] + p1[idx_off2]; - p1 += idx_off3; + for (i = 0; i < pulses; i++) { + if (p1[idx_off1] + p1[idx_off2] > maxidx) + maxidx = p1[idx_off1] + p1[idx_off2]; + p1 += idx_off3; } p1 = idxp; for (i = 0; (i < pulses) && (p1[idx_off2] != 0); i++) /* falling edge, replace with idx_off1 for rising edge */ @@ -1897,7 +1897,7 @@ static int decode_lowlevel_track (FDI *fdi, int track, struct fdi_cache *cache) { while ((i != j) && (p1[idx_off1] > p1[idx_off2])) { /* falling edge, replace with "<" for rising edge */ i++; - p1 += idx_off3; + p1 += idx_off3; if (i >= pulses) { i = 0; p1 = idxp; @@ -1911,7 +1911,7 @@ static int decode_lowlevel_track (FDI *fdi, int track, struct fdi_cache *cache) p2 = avgp; totalavg = 0; weakbits = 0; - for (i = 0; i < pulses; i++) { + for (i = 0; i < pulses; i++) { int sum = p1[idx_off1] + p1[idx_off2]; if (sum >= maxidx) { totalavg += *p2; @@ -1919,7 +1919,7 @@ static int decode_lowlevel_track (FDI *fdi, int track, struct fdi_cache *cache) weakbits++; } p2++; - p1 += idx_off3; + p1 += idx_off3; idxp[i] = sum; } len = totalavg / 100000; @@ -1943,14 +1943,14 @@ static int decode_lowlevel_track (FDI *fdi, int track, struct fdi_cache *cache) return 1; } -static unsigned char fdiid[]={"Formatted Disk Image file"}; -static int bit_rate_table[16] = { 125,150,250,300,500,1000 }; +static unsigned char fdiid[]={"Formatted Disk Image file"}; +static int bit_rate_table[16] = { 125,150,250,300,500,1000 }; void fdi2raw_header_free (FDI *fdi) { int i; - fdi_free (fdi->mfmsync_buffer); + fdi_free (fdi->mfmsync_buffer); fdi_free (fdi->track_src_buffer); fdi_free (fdi->track_dst_buffer); fdi_free (fdi->track_dst_buffer_timing); @@ -1965,18 +1965,18 @@ void fdi2raw_header_free (FDI *fdi) if (c->max_free) fdi_free (c->maxp); } - fdi_free (fdi); + fdi_free (fdi); debuglog ("FREE: memory allocated %d\n", fdi_allocated); } -int fdi2raw_get_last_track (FDI *fdi) +int fdi2raw_get_last_track (FDI *fdi) { - return fdi->last_track; + return fdi->last_track; } -int fdi2raw_get_num_sector (FDI *fdi) +int fdi2raw_get_num_sector (FDI *fdi) { - if (fdi->header[152] == 0x02) + if (fdi->header[152] == 0x02) return 22; return 11; } @@ -1996,7 +1996,7 @@ int fdi2raw_get_bit_rate (FDI *fdi) return fdi->bit_rate; } -int fdi2raw_get_type (FDI *fdi) +int fdi2raw_get_type (FDI *fdi) { return fdi->disk_type; } @@ -2008,65 +2008,65 @@ int fdi2raw_get_write_protect (FDI *fdi) FDI *fdi2raw_header(struct zfile *f) { - int i, offset, oldseek; + int i, offset, oldseek; uae_u8 type, size; FDI *fdi; debuglog ("ALLOC: memory allocated %d\n", fdi_allocated); fdi = fdi_malloc(sizeof(FDI)); - memset (fdi, 0, sizeof (FDI)); + memset (fdi, 0, sizeof (FDI)); fdi->file = f; - oldseek = zfile_ftell (fdi->file); - zfile_fseek (fdi->file, 0, SEEK_SET); - zfile_fread (fdi->header, 2048, 1, fdi->file); - zfile_fseek (fdi->file, oldseek, SEEK_SET); - if (memcmp (fdiid, fdi->header, strlen (fdiid)) ) { + oldseek = zfile_ftell (fdi->file); + zfile_fseek (fdi->file, 0, SEEK_SET); + zfile_fread (fdi->header, 2048, 1, fdi->file); + zfile_fseek (fdi->file, oldseek, SEEK_SET); + if (memcmp (fdiid, fdi->header, strlen (fdiid)) ) { fdi_free(fdi); return NULL; } - if ((fdi->header[140] != 1 && fdi->header[140] != 2) || fdi->header[141] != 0) { + if ((fdi->header[140] != 1 && fdi->header[140] != 2) || fdi->header[141] != 0) { fdi_free(fdi); return NULL; } - fdi->mfmsync_buffer = fdi_malloc (MAX_MFM_SYNC_BUFFER * sizeof(int)); - fdi->track_src_buffer = fdi_malloc (MAX_SRC_BUFFER); - fdi->track_dst_buffer = fdi_malloc (MAX_DST_BUFFER); + fdi->mfmsync_buffer = fdi_malloc (MAX_MFM_SYNC_BUFFER * sizeof(int)); + fdi->track_src_buffer = fdi_malloc (MAX_SRC_BUFFER); + fdi->track_dst_buffer = fdi_malloc (MAX_DST_BUFFER); fdi->track_dst_buffer_timing = fdi_malloc (MAX_TIMING_BUFFER); - fdi->last_track = ((fdi->header[142] << 8) + fdi->header[143]) + 1; - fdi->last_track *= fdi->header[144] + 1; + fdi->last_track = ((fdi->header[142] << 8) + fdi->header[143]) + 1; + fdi->last_track *= fdi->header[144] + 1; if (fdi->last_track > MAX_TRACKS) - fdi->last_track = MAX_TRACKS; + fdi->last_track = MAX_TRACKS; fdi->last_head = fdi->header[144]; fdi->disk_type = fdi->header[145]; fdi->rotation_speed = fdi->header[146] + 128; - fdi->write_protect = fdi->header[147] & 1; + fdi->write_protect = fdi->header[147] & 1; outlog ("FDI version %d.%d\n", fdi->header[140], fdi->header[141]); outlog ("last_track=%d rotation_speed=%d\n",fdi->last_track,fdi->rotation_speed); offset = 512; i = fdi->last_track; - if (i > 180) { + if (i > 180) { offset += 512; i -= 180; - while (i > 256) { + while (i > 256) { offset += 512; i -= 256; } } - for (i = 0; i < fdi->last_track; i++) { - fdi->track_offsets[i] = offset; + for (i = 0; i < fdi->last_track; i++) { + fdi->track_offsets[i] = offset; type = fdi->header[152 + i * 2]; size = fdi->header[152 + i * 2 + 1]; if (type == 1) - offset += (size & 15) * 512; - else if ((type & 0xc0) == 0x80) - offset += (((type & 0x3f) << 8) | size) * 256; + offset += (size & 15) * 512; + else if ((type & 0xc0) == 0x80) + offset += (((type & 0x3f) << 8) | size) * 256; else offset += size * 256; } - fdi->track_offsets[i] = offset; + fdi->track_offsets[i] = offset; return fdi; } @@ -2090,13 +2090,13 @@ int fdi2raw_loadrevolution_2 (FDI *fdi, uae_u16 *mfmbuf, uae_u16 *tracktiming, i *multirev = 1; *tracklength = len; - for (i = 0; i < (len + 15) / (2 * 8); i++) { + for (i = 0; i < (len + 15) / (2 * 8); i++) { uae_u8 *data = fdi->track_dst_buffer + i * 2; - *mfmbuf++ = 256 * *data + *(data + 1); - } - fdi2_celltiming (fdi, cache->totalavg, len, tracktiming); + *mfmbuf++ = 256 * *data + *(data + 1); + } + fdi2_celltiming (fdi, cache->totalavg, len, tracktiming); if (indexoffsetp) - *indexoffsetp = idx; + *indexoffsetp = idx; return 1; } @@ -2115,31 +2115,31 @@ int fdi2raw_loadtrack (FDI *fdi, uae_u16 *mfmbuf, uae_u16 *tracktiming, int trac return fdi2raw_loadrevolution_2 (fdi, mfmbuf, tracktiming, track, tracklength, indexoffsetp, multirev, mfm); fdi->err = 0; - fdi->track_src_len = fdi->track_offsets[track + 1] - fdi->track_offsets[track]; - zfile_fseek (fdi->file, fdi->track_offsets[track], SEEK_SET); - zfile_fread (fdi->track_src_buffer, fdi->track_src_len, 1, fdi->file); + fdi->track_src_len = fdi->track_offsets[track + 1] - fdi->track_offsets[track]; + zfile_fseek (fdi->file, fdi->track_offsets[track], SEEK_SET); + zfile_fread (fdi->track_src_buffer, fdi->track_src_len, 1, fdi->file); memset (fdi->track_dst_buffer, 0, MAX_DST_BUFFER); - fdi->track_dst_buffer_timing[0] = 0; + fdi->track_dst_buffer_timing[0] = 0; fdi->current_track = track; - fdi->track_src = fdi->track_src_buffer; - fdi->track_dst = fdi->track_dst_buffer; - p = fdi->header + 152 + fdi->current_track * 2; - fdi->track_type = *p++; + fdi->track_src = fdi->track_src_buffer; + fdi->track_dst = fdi->track_dst_buffer; + p = fdi->header + 152 + fdi->current_track * 2; + fdi->track_type = *p++; fdi->track_len = *p++; - fdi->bit_rate = 0; + fdi->bit_rate = 0; fdi->out = 0; fdi->mfmsync_offset = 0; - if ((fdi->track_type & 0xf0) == 0xf0 || (fdi->track_type & 0xf0) == 0xe0) - fdi->bit_rate = bit_rate_table[fdi->track_type & 0x0f]; + if ((fdi->track_type & 0xf0) == 0xf0 || (fdi->track_type & 0xf0) == 0xe0) + fdi->bit_rate = bit_rate_table[fdi->track_type & 0x0f]; else - fdi->bit_rate = 250; + fdi->bit_rate = 250; outlog ("track %d: srclen: %d track_type: %02.2X, bitrate: %d\n", - fdi->current_track, fdi->track_src_len, fdi->track_type, fdi->bit_rate); + fdi->current_track, fdi->track_src_len, fdi->track_type, fdi->bit_rate); - if ((fdi->track_type & 0xc0) == 0x80) { + if ((fdi->track_type & 0xc0) == 0x80) { outlen = decode_lowlevel_track (fdi, track, cache); @@ -2149,7 +2149,7 @@ int fdi2raw_loadtrack (FDI *fdi, uae_u16 *mfmbuf, uae_u16 *tracktiming, int trac } else if ((fdi->track_type & 0xf0) == 0xe0) { - outlen = handle_sectors_described_track (fdi); + outlen = handle_sectors_described_track (fdi); } else if ((fdi->track_type & 0xf0)) { @@ -2178,9 +2178,9 @@ int fdi2raw_loadtrack (FDI *fdi, uae_u16 *mfmbuf, uae_u16 *tracktiming, int trac if (cache->lowlevel) return fdi2raw_loadrevolution_2 (fdi, mfmbuf, tracktiming, track, tracklength, indexoffsetp, multirev, mfm); *tracklength = fdi->out; - for (i = 0; i < ((*tracklength) + 15) / (2 * 8); i++) { + for (i = 0; i < ((*tracklength) + 15) / (2 * 8); i++) { uae_u8 *data = fdi->track_dst_buffer + i * 2; - *mfmbuf++ = 256 * *data + *(data + 1); + *mfmbuf++ = 256 * *data + *(data + 1); } } return outlen; diff --git a/filesys.c b/filesys.c index 40421242..6c2475f8 100755 --- a/filesys.c +++ b/filesys.c @@ -47,8 +47,8 @@ #define TRACING_ENABLED 0 #if TRACING_ENABLED -#define TRACE(x) do { write_log x; } while(0) -#define DUMPLOCK(u,x) dumplock(u,x) +#define TRACE(x) do { write_log x; } while(0) +#define DUMPLOCK(u,x) dumplock(u,x) #else #define TRACE(x) #define DUMPLOCK(u,x) @@ -59,7 +59,7 @@ static void aino_test (a_inode *aino) #ifdef AINO_DEBUG a_inode *aino2 = aino, *aino3; for (;;) { - if (!aino || !aino->next) + if (!aino || !aino->next) return; if ((aino->checksum1 ^ aino->checksum2) != 0xaaaa5555) { write_log ("PANIC: corrupted or freed but used aino detected!", aino); @@ -252,7 +252,7 @@ static char *set_filesys_unit_1 (struct uaedev_mount_info *mountinfo, int nr, ui->hf.readonly = readonly = 1; hdf_open (&ui->hf, rootdir); } - ui->hf.readonly = readonly; + ui->hf.readonly = readonly; if (ui->hf.handle == 0) return "Hardfile not found"; if ((ui->hf.blocksize & (ui->hf.blocksize - 1)) != 0 || ui->hf.blocksize == 0) @@ -450,11 +450,11 @@ struct hardfiledata *get_hardfile_data (int nr) return &uip[nr].hf; } -/* minimal AmigaDOS definitions */ +/* minimal AmigaDOS definitions */ /* field offsets in DosPacket */ #define dp_Type 8 -#define dp_Res1 12 +#define dp_Res1 12 #define dp_Res2 16 #define dp_Arg1 20 #define dp_Arg2 24 @@ -466,10 +466,10 @@ struct hardfiledata *get_hardfile_data (int nr) #define DOS_FALSE (0L) /* Passed as type to Lock() */ -#define SHARED_LOCK -2 /* File is readable by others */ -#define ACCESS_READ -2 /* Synonym */ -#define EXCLUSIVE_LOCK -1 /* No other access allowed */ -#define ACCESS_WRITE -1 /* Synonym */ +#define SHARED_LOCK -2 /* File is readable by others */ +#define ACCESS_READ -2 /* Synonym */ +#define EXCLUSIVE_LOCK -1 /* No other access allowed */ +#define ACCESS_WRITE -1 /* Synonym */ /* packet types */ #define ACTION_CURRENT_VOLUME 7 @@ -499,23 +499,23 @@ struct hardfiledata *get_hardfile_data (int nr) #define ACTION_WRITE 'W' /* 2.0+ packet types */ -#define ACTION_INHIBIT 31 -#define ACTION_SET_FILE_SIZE 1022 -#define ACTION_LOCK_RECORD 2008 -#define ACTION_FREE_RECORD 2009 -#define ACTION_SAME_LOCK 40 -#define ACTION_CHANGE_MODE 1028 -#define ACTION_FH_FROM_LOCK 1026 -#define ACTION_COPY_DIR_FH 1030 -#define ACTION_PARENT_FH 1031 -#define ACTION_EXAMINE_FH 1034 -#define ACTION_EXAMINE_ALL 1033 -#define ACTION_MAKE_LINK 1021 -#define ACTION_READ_LINK 1024 -#define ACTION_FORMAT 1020 -#define ACTION_IS_FILESYSTEM 1027 -#define ACTION_ADD_NOTIFY 4097 -#define ACTION_REMOVE_NOTIFY 4098 +#define ACTION_INHIBIT 31 +#define ACTION_SET_FILE_SIZE 1022 +#define ACTION_LOCK_RECORD 2008 +#define ACTION_FREE_RECORD 2009 +#define ACTION_SAME_LOCK 40 +#define ACTION_CHANGE_MODE 1028 +#define ACTION_FH_FROM_LOCK 1026 +#define ACTION_COPY_DIR_FH 1030 +#define ACTION_PARENT_FH 1031 +#define ACTION_EXAMINE_FH 1034 +#define ACTION_EXAMINE_ALL 1033 +#define ACTION_MAKE_LINK 1021 +#define ACTION_READ_LINK 1024 +#define ACTION_FORMAT 1020 +#define ACTION_IS_FILESYSTEM 1027 +#define ACTION_ADD_NOTIFY 4097 +#define ACTION_REMOVE_NOTIFY 4098 #define DISK_TYPE 0x444f5301 /* DOS\1 */ @@ -1628,7 +1628,7 @@ static void notify_check (Unit *unit, a_inode *a) uae_u32 err; a_inode *a2 = find_aino (unit, 0, n->fullname, &err); if (err == 0 && a == a2) - notify_send (unit, n); + notify_send (unit, n); } } if (a->parent) { @@ -1659,8 +1659,8 @@ action_add_notify (Unit *unit, dpacket packet) flags = get_long (nr + 12); if (!(flags & (NRF_SEND_MESSAGE | NRF_SEND_SIGNAL))) { - PUT_PCK_RES1 (packet, DOS_FALSE); - PUT_PCK_RES2 (packet, ERROR_BAD_NUMBER); + PUT_PCK_RES1 (packet, DOS_FALSE); + PUT_PCK_RES2 (packet, ERROR_BAD_NUMBER); return; } @@ -1704,7 +1704,7 @@ action_remove_notify (Unit *unit, dpacket packet) TRACE(("ACTION_REMOVE_NOTIFY\n")); for (hash = 0; hash < NOTIFY_HASH_SIZE; hash++) { - for (n = unit->notifyhash[hash]; n; n = n->next) { + for (n = unit->notifyhash[hash]; n; n = n->next) { if (n->notifyrequest == nr) { //write_log ("NotifyRequest %08.8X freed\n", n->notifyrequest); xfree (n->fullname); @@ -2849,7 +2849,7 @@ action_examine_fh (Unit *unit, dpacket packet) put_long (info, 0); } -/* For a nice example of just how contradictory documentation can be, see the +/* For a nice example of just how contradictory documentation can be, see the * Autodoc for DOS:SetFileSize and the Packets.txt description of this packet... * This implementation tries to mimic the behaviour of the Kick 3.1 ramdisk * (which seems to match the Autodoc description). */ @@ -2948,9 +2948,9 @@ action_delete_object (Unit *unit, dpacket packet) } } else { if (my_unlink (a->nname) == -1) { - PUT_PCK_RES1 (packet, DOS_FALSE); + PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, dos_errno()); - return; + return; } } notify_check (unit, a); @@ -2966,7 +2966,7 @@ action_delete_object (Unit *unit, dpacket packet) } static void -action_set_date (Unit *unit, dpacket packet) +action_set_date (Unit *unit, dpacket packet) { uaecptr lock = GET_PCK_ARG2 (packet) << 2; uaecptr name = GET_PCK_ARG3 (packet) << 2; @@ -2984,7 +2984,7 @@ action_set_date (Unit *unit, dpacket packet) } ut.actime = ut.modtime = put_time(get_long (date), get_long (date + 4), - get_long (date + 8)); + get_long (date + 8)); a = find_aino (unit, lock, bstr (unit, name), &err); if (err == 0 && utime (a->nname, &ut) == -1) err = dos_errno (); @@ -3027,7 +3027,7 @@ action_rename_object (Unit *unit, dpacket packet) /* rename always fails if file is open for writing */ for (k1 = unit->keys; k1; k1 = knext) { - knext = k1->next; + knext = k1->next; if (k1->aino == a1 && k1->fd >= 0 && k1->createmode == 2) { PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, ERROR_OBJECT_IN_USE); @@ -3069,10 +3069,10 @@ action_rename_object (Unit *unit, dpacket packet) knext = k1->next; if (k1->aino == a1 && k1->fd >= 0) { wehavekeys++; - my_close (k1->fd); + my_close (k1->fd); write_log ("handle %d freed\n", k1->fd); } - } + } /* try again... */ ret = my_rename (a1->nname, a2->nname); for (k1 = unit->keys; k1; k1 = knext) { @@ -3090,14 +3090,14 @@ action_rename_object (Unit *unit, dpacket packet) k1->fd = my_open (a2->nname, mode); write_log ("restoring new handle '%s' %d\n", a2->nname, k1->dosmode); } - if (k1->fd == NULL) { + if (k1->fd == NULL) { write_log ("relocking failed '%s' -> '%s'\n", a1->nname, a2->nname); free_key (unit, k1); } else { my_lseek (k1->fd, k1->file_pos, SEEK_SET); } } - } + } if (ret == -1) { delete_aino (unit, a2); PUT_PCK_RES1 (packet, DOS_FALSE); @@ -3503,7 +3503,7 @@ void filesys_start_threads (void) UnitInfo *ui = &uip[i]; ui->unit_pipe = 0; ui->back_pipe = 0; - ui->reset_state = FS_STARTUP; + ui->reset_state = FS_STARTUP; if (savestate_state != STATE_RESTORE) { ui->startup = 0; ui->self = 0; @@ -3699,15 +3699,15 @@ static uae_u32 filesys_dev_bootfilesys (void) dostype = get_long (parmpacket + 80); fsnode = get_long (fsres + 18); while (get_long (fsnode)) { - dostype2 = get_long (fsnode + 14); - if (dostype2 == dostype) { + dostype2 = get_long (fsnode + 14); + if (dostype2 == dostype) { if (get_long (fsnode + 22) & (1 << 7)) { - put_long (devicenode + 32, get_long (fsnode + 54)); /* dn_SegList */ - put_long (devicenode + 36, -1); /* dn_GlobalVec */ + put_long (devicenode + 32, get_long (fsnode + 54)); /* dn_SegList */ + put_long (devicenode + 36, -1); /* dn_GlobalVec */ } return 1; - } - fsnode = get_long (fsnode); + } + fsnode = get_long (fsnode); } return 0; } @@ -3733,7 +3733,7 @@ static uae_u32 filesys_dev_remember (void) uip->rdb_filesyssize = 0; } if (m68k_dreg (regs, 3) >= 0) - uip->startup = get_long (devicenode + 28); + uip->startup = get_long (devicenode + 28); return devicenode; } @@ -4040,7 +4040,7 @@ static void dofakefilesys (UnitInfo *uip, uaecptr parmpacket) addfakefilesys (parmpacket, dostype); return; } - fsnode = get_long (fsnode); + fsnode = get_long (fsnode); } tmp[0] = 0; @@ -4051,7 +4051,7 @@ static void dofakefilesys (UnitInfo *uip, uaecptr parmpacket) i = strlen (tmp); while (i > 0 && tmp[i - 1] != '/' && tmp[i - 1] != '\\') i--; - strcpy (tmp + i, "FastFileSystem"); + strcpy (tmp + i, "FastFileSystem"); } if (tmp[0] == 0) { write_log ("RDB: no filesystem for dostype 0x%08.8X\n", dostype); @@ -4061,7 +4061,7 @@ static void dofakefilesys (UnitInfo *uip, uaecptr parmpacket) zf = zfile_fopen (tmp,"rb"); if (!zf) { write_log ("RDB: filesys not found\n"); - return; + return; } zfile_fseek (zf, 0, SEEK_END); @@ -4081,7 +4081,7 @@ static void get_new_device (int type, uaecptr parmpacket, char **devname, uaecpt char buffer[80]; if (*devname == 0 || strlen(*devname) == 0) { - sprintf (buffer, "DH%d", unit_no); + sprintf (buffer, "DH%d", unit_no); } else { strcpy (buffer, *devname); } @@ -4107,11 +4107,11 @@ static uae_u32 filesys_dev_storeinfo (void) if (type == FILESYS_HARDFILE_RDB || type == FILESYS_HARDDRIVE) { /* RDB hardfile */ - uip[unit_no].devno = unit_no; + uip[unit_no].devno = unit_no; return rdb_mount (&uip[unit_no], unit_no, sub_no, parmpacket); } if (sub_no) - return -2; + return -2; write_log("Mounting uaehf.device %d (%d):\n", unit_no, sub_no); get_new_device (type, parmpacket, &uip[unit_no].devname, &uip[unit_no].devname_amiga, unit_no); uip[unit_no].devno = unit_no; diff --git a/fpp.c b/fpp.c index b7942f33..4e2b1f67 100755 --- a/fpp.c +++ b/fpp.c @@ -29,11 +29,11 @@ STATIC_INLINE int isinrom (void) return (munge24 (m68k_getpc ()) & 0xFFF80000) == 0xF80000; } -#define DEBUG_FPP 0 +#define DEBUG_FPP 0 -#define FFLAG_Z 0x4000 -#define FFLAG_N 0x0100 -#define FFLAG_NAN 0x0400 +#define FFLAG_Z 0x4000 +#define FFLAG_N 0x0100 +#define FFLAG_NAN 0x0400 #define MAKE_FPSR(r) regs.fp_result=(r) @@ -97,7 +97,7 @@ static __inline__ tointtype toint(fptype src) return (tointtype)src; /* Should never be reached */ } -uae_u32 get_fpsr (void) +uae_u32 get_fpsr (void) { uae_u32 answer = regs.fpsr & 0x00ffffff; #ifdef HAVE_ISNAN @@ -118,7 +118,7 @@ uae_u32 get_fpsr (void) return answer; } -STATIC_INLINE void set_fpsr (uae_u32 x) +STATIC_INLINE void set_fpsr (uae_u32 x) { regs.fpsr = x; @@ -389,11 +389,11 @@ STATIC_INLINE int put_fp_value (fptype value, uae_u32 opcode, uae_u16 extra) switch (size) { case 6: m68k_dreg (regs, reg) = (uae_u32)(((toint(value) & 0xff) - | (m68k_dreg (regs, reg) & ~0xff))); + | (m68k_dreg (regs, reg) & ~0xff))); break; case 4: m68k_dreg (regs, reg) = (uae_u32)(((toint(value) & 0xffff) - | (m68k_dreg (regs, reg) & ~0xffff))); + | (m68k_dreg (regs, reg) & ~0xffff))); break; case 0: m68k_dreg (regs, reg) = (uae_u32)toint(value); @@ -623,9 +623,9 @@ STATIC_INLINE int fpp_cond (uae_u32 opcode, int contition) return NotANumber || Z || !N; case 0x1c: #if 0 - return NotANumber || (Z && N); /* This is wrong, compare 0x0c */ + return NotANumber || (Z && N); /* This is wrong, compare 0x0c */ #else - return NotANumber || (N && !Z); + return NotANumber || (N && !Z); #endif case 0x1d: return NotANumber || Z || N; @@ -655,7 +655,7 @@ void fdbcc_opp (uae_u32 opcode, uae_u16 extra) int reg = opcode & 0x7; m68k_dreg (regs, reg) = ((m68k_dreg (regs, reg) & ~0xffff) - | ((m68k_dreg (regs, reg) - 1) & 0xffff)); + | ((m68k_dreg (regs, reg) - 1) & 0xffff)); if ((m68k_dreg (regs, reg) & 0xffff) == 0xffff) m68k_setpc (pc + disp); } @@ -1191,7 +1191,7 @@ void fpp_opp (uae_u32 opcode, uae_u16 extra) break; case 0x01: /* FINT */ /* need to take the current rounding mode into account */ - regs.fp[reg] = (fptype)toint(src); + regs.fp[reg] = (fptype)toint(src); break; case 0x02: /* FSINH */ regs.fp[reg] = sinh (src); @@ -1230,7 +1230,7 @@ void fpp_opp (uae_u32 opcode, uae_u16 extra) MAKE_FPSR (regs.fp[reg]); break; case 0x0d: /* FATANH */ -#if 1 /* The BeBox doesn't have atanh, and it isn't in the HPUX libm either */ +#if 1 /* The BeBox doesn't have atanh, and it isn't in the HPUX libm either */ regs.fp[reg] = log ((1 + src) / (1 - src)) / 2; #else regs.fp[reg] = atanh (src); @@ -1408,7 +1408,7 @@ uae_u8 *restore_fpu (uae_u8 *src) restore_u32 (); if (currprefs.cpu_level == 2) { currprefs.cpu_level++; - init_m68k_full (); + init_m68k_full (); } changed_prefs.cpu_level = currprefs.cpu_level; for (i = 0; i < 8; i++) { @@ -1446,7 +1446,7 @@ uae_u8 *save_fpu (int *len, uae_u8 *dstptr) if (dstptr) dstbak = dst = dstptr; else - dstbak = dst = malloc(4+4+8*10+4+4+4); + dstbak = dst = malloc(4+4+8*10+4+4+4); save_u32 (model); save_u32 (0); for (i = 0; i < 8; i++) { diff --git a/fsdb.c b/fsdb.c index 385c01bb..f001aecb 100755 --- a/fsdb.c +++ b/fsdb.c @@ -33,7 +33,7 @@ #define TRACING_ENABLED 0 #if TRACING_ENABLED -#define TRACE(x) do { write_log x; } while(0) +#define TRACE(x) do { write_log x; } while(0) #else #define TRACE(x) #endif diff --git a/gfxlib.c b/gfxlib.c index 8c821ad9..f4fac262 100755 --- a/gfxlib.c +++ b/gfxlib.c @@ -1186,9 +1186,9 @@ static void LY_UnlockLayers(uaecptr li) LY_UnlockLayerInfo(li); } -#define LAYER_CLUELESS 0x8000 /* Indicates we know nothing about the layer's regions. */ +#define LAYER_CLUELESS 0x8000 /* Indicates we know nothing about the layer's regions. */ #define LAYER_CR_CHANGED 0x4000 /* Indicates that the cliprects in Amiga memory need to be re-done */ -#define LAYER_REDO 0x2000 /* Indicates that we have regions, but they are bogus. */ +#define LAYER_REDO 0x2000 /* Indicates that we have regions, but they are bogus. */ static uae_u32 layer_uniq = 1; diff --git a/gfxutil.c b/gfxutil.c index 695d08de..193bb797 100755 --- a/gfxutil.c +++ b/gfxutil.c @@ -11,9 +11,9 @@ #include "custom.h" #include "xwin.h" -#define RED 0 -#define GRN 1 -#define BLU 2 +#define RED 0 +#define GRN 1 +#define BLU 2 /* * dither matrix @@ -312,7 +312,7 @@ void setup_greydither_maxcol (int maxcol, allocfunc_type allocfunc) p = (c * k) / 256; q = (c * k) % 256; if (q /*/ k*/> d /*/ k*/ && p < k) ++p; -/* sam: ^^^^^^^ */ +/* sam: ^^^^^^^ */ /* It seems that produces better output */ cidx[i][rgb + (j+4)*4096] = cidx[i][rgb + j*4096] = (uae_u8)map[p]; diff --git a/hardfile.c b/hardfile.c index ac7b7170..8026f0f0 100755 --- a/hardfile.c +++ b/hardfile.c @@ -116,15 +116,15 @@ static uae_u64 cmd_read (struct hardfiledata *hfd, uaecptr dataptr, uae_u64 offs gui_hd_led (1); hf_log2 ("cmd_read: %p %04.4x-%08.8x %08.8x\n", dataptr, (uae_u32)(offset >> 32), (uae_u32)offset, (uae_u32)len); while (len > 0) { - int got2; + int got2; got2 = hdf_read (hfd, buffer, offset, hfd->blocksize); - if (got2 != hfd->blocksize) + if (got2 != hfd->blocksize) break; for (i = 0; i < got2; i++) put_byte(dataptr + i, buffer[i]); - len -= got2; - got += got2; - dataptr += got2; + len -= got2; + got += got2; + dataptr += got2; offset += got2; } return got; @@ -139,8 +139,8 @@ static uae_u64 cmd_write (struct hardfiledata *hfd, uaecptr dataptr, uae_u64 off gui_hd_led (1); hf_log2 ("cmd_write: %p %04.4x-%08.8x %08.8x\n", dataptr, (uae_u32)(offset >> 32), (uae_u32)offset, (uae_u32)len); while (len > 0) { - int got2; - for (i = 0; i < hfd->blocksize; i++) + int got2; + for (i = 0; i < hfd->blocksize; i++) buffer[i] = get_byte (dataptr + i); got2 = hdf_write (hfd, buffer, offset, hfd->blocksize); if (got2 != hfd->blocksize) @@ -171,8 +171,8 @@ static int handle_scsi (uaecptr request, struct hardfiledata *hfd) uae_u64 len, offset; scsi_sense_len = (scsi_flags & 4) ? 4 : /* SCSIF_OLDAUTOSENSE */ - (scsi_flags & 2) ? scsi_sense_len : /* SCSIF_AUTOSENSE */ - 32; + (scsi_flags & 2) ? scsi_sense_len : /* SCSIF_AUTOSENSE */ + 32; status = 0; memset (r, 0, sizeof (r)); lr = 0; ls = 0; @@ -195,7 +195,7 @@ static int handle_scsi (uaecptr request, struct hardfiledata *hfd) if (!len) len = 256; len *= hfd->blocksize; scsi_len = (uae_u32)cmd_read (hfd, scsi_data, offset, len); - break; + break; case 0x0a: /* WRITE (6) */ offset = ((cmdbuf[1] & 31) << 16) | (cmdbuf[2] << 8) | cmdbuf[3]; offset *= hfd->blocksize; @@ -203,7 +203,7 @@ static int handle_scsi (uaecptr request, struct hardfiledata *hfd) if (!len) len = 256; len *= hfd->blocksize; scsi_len = (uae_u32)cmd_write (hfd, scsi_data, offset, len); - break; + break; case 0x12: /* INQUIRY */ len = cmdbuf[4]; r[2] = 2; /* supports SCSI-2 */ @@ -247,31 +247,31 @@ static int handle_scsi (uaecptr request, struct hardfiledata *hfd) case 0x28: /* READ (10) */ offset = rl (cmdbuf + 2); offset *= hfd->blocksize; - len = rl (cmdbuf + 7 - 2) & 0xffff; + len = rl (cmdbuf + 7 - 2) & 0xffff; len *= hfd->blocksize; scsi_len = (uae_u32)cmd_read (hfd, scsi_data, offset, len); break; case 0x2a: /* WRITE (10) */ offset = rl (cmdbuf + 2); offset *= hfd->blocksize; - len = rl (cmdbuf + 7 - 2) & 0xffff; + len = rl (cmdbuf + 7 - 2) & 0xffff; len *= hfd->blocksize; scsi_len = (uae_u32)cmd_write (hfd, scsi_data, offset, len); - break; + break; case 0xa8: /* READ (12) */ offset = rl (cmdbuf + 2); offset *= hfd->blocksize; - len = rl (cmdbuf + 6); + len = rl (cmdbuf + 6); len *= hfd->blocksize; scsi_len = (uae_u32)cmd_read (hfd, scsi_data, offset, len); break; case 0xaa: /* WRITE (12) */ offset = rl (cmdbuf + 2); offset *= hfd->blocksize; - len = rl (cmdbuf + 6); + len = rl (cmdbuf + 6); len *= hfd->blocksize; scsi_len = (uae_u32)cmd_write (hfd, scsi_data, offset, len); - break; + break; case 0x37: /* READ DEFECT DATA */ write_log ("UAEHF: READ DEFECT DATA\n"); status = 2; /* CHECK CONDITION */ @@ -396,7 +396,7 @@ static int start_thread (int unit) struct hardfileprivdata *hfpd = &hardfpd[unit]; if (hfpd->thread_running) - return 1; + return 1; memset (hfpd, 0, sizeof (struct hardfileprivdata)); init_comm_pipe (&hfpd->requests, 100, 1); uae_sem_init (&hfpd->sync_sem, 0, 0); @@ -468,8 +468,8 @@ static void getchs2 (struct hardfiledata *hfd, int *cyl, int *cylsec, int *head, *cyl = hfd->cylinders; *tracksec = hfd->sectors; *head = hfd->heads; - *cylsec = hfd->sectors * hfd->heads; - return; + *cylsec = hfd->sectors * hfd->heads; + return; } /* what about HDF settings? */ if (hfd->surfaces && hfd->secspertrack) { @@ -579,11 +579,11 @@ static uae_u32 hardfile_do_io (struct hardfiledata *hfd, struct hardfileprivdata offset = get_long (request + 44); len = get_long (request + 36); /* io_Length */ if ((offset & bmask) || (len & bmask)) { - unaligned (cmd, offset, len, hfd->blocksize); + unaligned (cmd, offset, len, hfd->blocksize); goto bad_command; } if (len + offset > hfd->size) { - outofbounds (cmd, offset, len, hfd->size); + outofbounds (cmd, offset, len, hfd->size); goto bad_command; } actual = (uae_u32)cmd_write (hfd, dataptr, offset, len); @@ -604,11 +604,11 @@ static uae_u32 hardfile_do_io (struct hardfiledata *hfd, struct hardfileprivdata offset64 = get_long (request + 44) | ((uae_u64)get_long (request + 32) << 32); len = get_long (request + 36); /* io_Length */ if ((offset64 & bmask) || (len & bmask)) { - unaligned (cmd, offset64, len, hfd->blocksize); + unaligned (cmd, offset64, len, hfd->blocksize); goto bad_command; } if (len + offset64 > hfd->size) { - outofbounds (cmd, offset64, len, hfd->size); + outofbounds (cmd, offset64, len, hfd->size); goto bad_command; } put_long (request + 32, (uae_u32)cmd_write (hfd, dataptr, offset64, len)); @@ -769,16 +769,16 @@ static uae_u32 hardfile_beginio (void) } put_byte (request + 31, 0); if ((flags & 1) && hardfile_canquick (hfd, request)) { - hf_log ("hf quickio unit=%d request=%p cmd=%d\n", unit, request, cmd); + hf_log ("hf quickio unit=%d request=%p cmd=%d\n", unit, request, cmd); if (hardfile_do_io (hfd, hfpd, request)) hf_log2 ("uaehf.device cmd %d bug with IO_QUICK\n", cmd); return get_byte (request + 31); } else { - hf_log2 ("hf asyncio unit=%d request=%p cmd=%d\n", unit, request, cmd); - add_async_request (hfpd, request, ASYNC_REQUEST_TEMP, 0); - put_byte (request + 30, get_byte (request + 30) & ~1); + hf_log2 ("hf asyncio unit=%d request=%p cmd=%d\n", unit, request, cmd); + add_async_request (hfpd, request, ASYNC_REQUEST_TEMP, 0); + put_byte (request + 30, get_byte (request + 30) & ~1); write_comm_pipe_u32 (&hfpd->requests, request, 1); - return 0; + return 0; } } @@ -792,15 +792,15 @@ static void *hardfile_thread (void *devs) for (;;) { uaecptr request = (uaecptr)read_comm_pipe_u32_blocking (&hfpd->requests); uae_sem_wait (&change_sem); - if (!request) { + if (!request) { hfpd->thread_running = 0; uae_sem_post (&hfpd->sync_sem); uae_sem_post (&change_sem); return 0; } else if (hardfile_do_io (get_hardfile_data (hfpd - &hardfpd[0]), hfpd, request) == 0) { - put_byte (request + 30, get_byte (request + 30) & ~1); + put_byte (request + 30, get_byte (request + 30) & ~1); release_async_request (hfpd, request); - uae_ReplyMsg (request); + uae_ReplyMsg (request); } else { hf_log2 ("async request %08.8X\n", request); } @@ -817,7 +817,7 @@ void hardfile_reset (void) hfpd = &hardfpd[i]; if (hfpd->opencount > 0) { for (j = 0; j < MAX_ASYNC_REQUESTS; j++) { - uaecptr request; + uaecptr request; if (request = hfpd->d_request[i]) abort_async (hfpd, request, 0, 0); } diff --git a/include/COMPEMU.H b/include/compemu.h similarity index 100% rename from include/COMPEMU.H rename to include/compemu.h diff --git a/include/options.h b/include/options.h index a82dd0d1..46f5f9a1 100755 --- a/include/options.h +++ b/include/options.h @@ -140,6 +140,7 @@ struct uae_prefs { int immediate_blits; unsigned int chipset_mask; int ntscmode; + int genlock; int chipset_refreshrate; int collision_level; int leds_on_screen; diff --git a/include/sysdeps.h b/include/sysdeps.h index 846e8c7e..5ae50cb7 100755 --- a/include/sysdeps.h +++ b/include/sysdeps.h @@ -461,7 +461,19 @@ extern void logging_init(void); #endif #ifndef STATIC_INLINE +#if __GNUC__ - 1 > 1 && __GNUC_MINOR__ - 1 >= 0 +#define STATIC_INLINE static __inline__ __attribute__ ((always_inline)) +#define NOINLINE __attribute__ ((noinline)) +#define NORETURN __attribute__ ((noreturn)) +#elif _MSC_VER +#define STATIC_INLINE static __forceinline +#define NOINLINE __declspec(noinline) +#define NORETURN __declspec(noreturn) +#else #define STATIC_INLINE static __inline__ +#define NOINLINE +#define NORETURN +#endif #endif /* Every Amiga hardware clock cycle takes this many "virtual" cycles. This diff --git a/inputdevice.c b/inputdevice.c index b29bad77..a25a1274 100755 --- a/inputdevice.c +++ b/inputdevice.c @@ -149,8 +149,6 @@ static unsigned int joydir[MAX_INPUT_DEVICE_EVENTS]; static int joydirpot[MAX_INPUT_DEVICE_EVENTS][2]; static int mouse_frame_x[2], mouse_frame_y[2]; -static int lastmx, lastmy; - static int mouse_port[2]; static int cd32_shifter[2]; static int cd32_pad_enabled[2]; @@ -184,7 +182,7 @@ static void write_config2 (struct zfile *f, int idnum, int i, int offset, char * p = tmp2; got = 0; for (j = 0; j < MAX_INPUT_SUB_EVENT; j++) { - event = id->eventid[i + offset][j]; + event = id->eventid[i + offset][j]; custom = id->custom[i + offset][j]; if (custom == NULL && event <= 0) { for (k = j + 1; k < MAX_INPUT_SUB_EVENT; k++) { @@ -277,11 +275,11 @@ static void write_kbr_config (struct zfile *f, int idnum, int devnum, struct uae break; } if (p > tmp2) { - *p++ = ','; + *p++ = ','; *p = 0; } if (custom) - sprintf (p, "'%s'.%d", custom, kbr->flags[i][j]); + sprintf (p, "'%s'.%d", custom, kbr->flags[i][j]); else if (event > 0) sprintf (p, "%s.%d", events[event].confname, kbr->flags[i][j]); else @@ -291,7 +289,7 @@ static void write_kbr_config (struct zfile *f, int idnum, int devnum, struct uae sprintf (tmp3, "%d", kbr->extra[i][0]); kbrlabel (tmp3); sprintf (tmp1, "keyboard.%d.button.%s", devnum, tmp3); - cfgfile_write (f, "input.%d.%s=%s\n", idnum, tmp1, tmp2); + cfgfile_write (f, "input.%d.%s=%s\n", idnum, tmp1, tmp2); i++; } } @@ -351,7 +349,7 @@ void reset_inputdevice_config (struct uae_prefs *pr) static void clear_id (struct uae_input_device *id) { -#ifndef _DEBUG +#ifndef _DEBUG int i, j; for (i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) { for (j = 0; j < MAX_INPUT_SUB_EVENT; j++) @@ -391,7 +389,7 @@ void read_inputdevice_config (struct uae_prefs *pr, char *option, char *value) return; if (memcmp (option, "mouse.", 6) == 0) { p = option + 6; - devnum = getnum (&p); + devnum = getnum (&p); if (devnum < 0 || devnum >= MAX_INPUT_DEVICES) return; id = &pr->mouse_settings[idnum][devnum]; @@ -401,7 +399,7 @@ void read_inputdevice_config (struct uae_prefs *pr, char *option, char *value) joystick = 0; } else if (memcmp (option, "joystick.", 9) == 0) { p = option + 9; - devnum = getnum (&p); + devnum = getnum (&p); if (devnum < 0 || devnum >= MAX_INPUT_DEVICES) return; id = &pr->joystick_settings[idnum][devnum]; @@ -412,7 +410,7 @@ void read_inputdevice_config (struct uae_prefs *pr, char *option, char *value) } else if (memcmp (option, "keyboard.", 9) == 0) { joystick = -1; p = option + 9; - devnum = getnum (&p); + devnum = getnum (&p); if (devnum < 0 || devnum >= MAX_INPUT_DEVICES) return; id = &pr->keyboard_settings[idnum][devnum]; @@ -454,7 +452,7 @@ void read_inputdevice_config (struct uae_prefs *pr, char *option, char *value) custom = NULL; for (subnum = 0; subnum < MAX_INPUT_SUB_EVENT; subnum++) { - xfree (custom); + xfree (custom); custom = NULL; p2 = getstring (&p); if (!p2) @@ -469,8 +467,8 @@ void read_inputdevice_config (struct uae_prefs *pr, char *option, char *value) if (!ie->name) { ie = &events[0]; if (strlen (p2) > 2 && p2[0] == '\'' && p2[strlen (p2) - 1] == '\'') { - custom = my_strdup (p2 + 1); - custom[strlen (custom) - 1] = 0; + custom = my_strdup (p2 + 1); + custom[strlen (custom) - 1] = 0; } } flags = getnum (&p); @@ -511,88 +509,8 @@ void read_inputdevice_config (struct uae_prefs *pr, char *option, char *value) xfree (custom); } -/* Mousehack stuff */ - -#define defstepx (1<<16) -#define defstepy (1<<16) -#define defxoffs 0 -#define defyoffs 0 - -static const int docal = 60, xcaloff = 40, ycaloff = 20; -static const int calweight = 3; -static int lastsampledmx, lastsampledmy; -static int lastspr0x,lastspr0y,lastdiffx,lastdiffy,spr0pos,spr0ctl; -static int mstepx,mstepy,xoffs=defxoffs,yoffs=defyoffs; -static int sprvbfl; static int ievent_alive = 0; - -static enum mousestate mousestate; - -void mousehack_handle (int sprctl, int sprpos) -{ - if (!sprvbfl && ((sprpos & 0xff) << 2) > 2 * DISPLAY_LEFT_SHIFT) { - spr0ctl = sprctl; - spr0pos = sprpos; - sprvbfl = 2; - } -} - -static void mousehack_setunknown (void) -{ - mousestate = mousehack_unknown; -} - -static void mousehack_setdontcare (void) -{ - if (mousestate == mousehack_dontcare) - return; - write_log ("Don't care mouse mode set\n"); - mousestate = mousehack_dontcare; - lastspr0x = lastmx; lastspr0y = lastmy; - mstepx = defstepx; mstepy = defstepy; -} - -static void mousehack_setfollow (void) -{ - if (mousestate == mousehack_follow) - return; - if (!mousehack_allowed ()) { - mousehack_set (mousehack_normal); - return; - } - write_log ("Follow sprite mode set\n"); - mousestate = mousehack_follow; - lastdiffx = lastdiffy = 0; - sprvbfl = 0; - spr0ctl = spr0pos = 0; - mstepx = defstepx; mstepy = defstepy; -} - -void mousehack_set (int state) -{ - int oldstate = mousestate; - - switch (state) - { - case mousehack_dontcare: - mousehack_setdontcare(); - break; - case mousehack_follow: - mousehack_setfollow(); - break; - default: - mousestate = state; - break; - } - if ((oldstate == mousehack_follow && state != mousehack_follow) || - (oldstate != mousehack_follow && state == mousehack_follow)) - inputdevice_acquire (); -} - -int mousehack_get (void) -{ - return mousestate; -} +static int lastmx, lastmy; int mousehack_alive (void) { @@ -632,15 +550,6 @@ uae_u32 mousehack_helper (void) return 0; } -void togglemouse (void) -{ - switch (mousestate) { - case mousehack_dontcare: mousehack_setfollow (); break; - case mousehack_follow: mousehack_setdontcare (); break; - default: break; /* Nnnnnghh! */ - } -} - STATIC_INLINE int adjust (int val) { if (val > 127) @@ -650,83 +559,6 @@ STATIC_INLINE int adjust (int val) return val; } -static void do_mouse_hack (void) -{ - int spr0x = ((spr0pos & 0xff) << 2) | ((spr0ctl & 1) << 1); - int spr0y = ((spr0pos >> 8) | ((spr0ctl & 4) << 6)) << 1; - int diffx, diffy; - -#if 0 - if (ievent_alive > 0) { - mouse_x[0] = mouse_y[0] = 0; - return; - } -#endif - switch (mousestate) { - case mousehack_normal: -#if 0 - diffx = lastmx - lastsampledmx; - diffy = lastmy - lastsampledmy; - if (!newmousecounters) { - if (diffx > 127) diffx = 127; - if (diffx < -127) diffx = -127; - mouse_x[0] += diffx; - if (diffy > 127) diffy = 127; - if (diffy < -127) diffy = -127; - mouse_y[0] += diffy; - } - lastsampledmx += diffx; lastsampledmy += diffy; -#endif - break; - - case mousehack_dontcare: -#if 0 - diffx = adjust (((lastmx - lastspr0x) * mstepx) >> 16); - diffy = adjust (((lastmy - lastspr0y) * mstepy) >> 16); - lastspr0x = lastmx; lastspr0y = lastmy; - mouse_x[0] += diffx; mouse_y[0] += diffy; -#endif - break; - - case mousehack_follow: - if (sprvbfl && sprvbfl-- > 1) { - int mousexpos, mouseypos; - - if ((lastdiffx > docal || lastdiffx < -docal) - && lastspr0x != spr0x - && spr0x > plfstrt*4 + 34 + xcaloff - && spr0x < plfstop*4 - xcaloff) - { - int val = (lastdiffx << 16) / (spr0x - lastspr0x); - if (val >= 0x8000) - mstepx = (mstepx * (calweight - 1) + val) / calweight; - } - if ((lastdiffy > docal || lastdiffy < -docal) - && lastspr0y != spr0y - && spr0y > plffirstline + ycaloff - && spr0y < plflastline - ycaloff) - { - int val = (lastdiffy << 16) / (spr0y - lastspr0y); - if (val >= 0x8000) - mstepy = (mstepy * (calweight - 1) + val) / calweight; - } - if (mouse_y[0] >= gfxvidinfo.height) - mouse_y[0] = gfxvidinfo.height-1; - mouseypos = coord_native_to_amiga_y (lastmy) << 1; - mousexpos = coord_native_to_amiga_x (lastmx); - diffx = adjust ((((mousexpos + xoffs - spr0x) & ~1) * mstepx) >> 16); - diffy = adjust ((((mouseypos + yoffs - spr0y) & ~1) * mstepy) >> 16); - lastspr0x = spr0x; lastspr0y = spr0y; - lastdiffx = diffx; lastdiffy = diffy; - mouse_x[0] += diffx; mouse_y[0] += diffy; - } - break; - - default: - abort (); - } -} - int getbuttonstate (int joy, int button) { return joybutton[joy] & (1 << button); @@ -739,13 +571,13 @@ static void mouseupdate (int pct) for (i = 0; i < 2; i++) { v = mouse_delta[i][0] * pct / 100; - mouse_x[i] += v; - if (!mouse_deltanoreset[i][0]) + mouse_x[i] += v; + if (!mouse_deltanoreset[i][0]) mouse_delta[i][0] -= v; v = mouse_delta[i][1] * pct / 100; mouse_y[i] += v; - if (!mouse_deltanoreset[i][1]) + if (!mouse_deltanoreset[i][1]) mouse_delta[i][1] -= v; v = mouse_delta[i][2] * pct / 100; @@ -753,7 +585,7 @@ static void mouseupdate (int pct) record_key (0x7a << 1); else if (v < 0) record_key (0x7b << 1); - if (!mouse_deltanoreset[i][2]) + if (!mouse_deltanoreset[i][2]) mouse_delta[i][2] = 0; if (mouse_frame_x[i] - mouse_x[i] > 127) @@ -775,7 +607,7 @@ static void mouseupdate (int pct) mouse_delta[i][2] = 0; mouse_frame_x[i] = mouse_x[i]; mouse_frame_y[i] = mouse_y[i]; - } + } } } @@ -792,7 +624,7 @@ static void readinput (void) } if (input_read) { input_vpos = vpos; - input_read = 0; + input_read = 0; } } @@ -810,10 +642,6 @@ int getjoystate (int joy) top = 1; if (joydir[joy] & DIR_DOWN) bot = 1; - if (mouse_port[joy]) { - if (joy == 0) - do_mouse_hack (); - } v = (uae_u8)mouse_x[joy] | (mouse_y[joy] << 8); if (left || right || top || bot || !mouse_port[joy]) { if (left) @@ -903,7 +731,7 @@ uae_u8 handle_joystick_buttons (uae_u8 dra) int i; for (i = 0; i < 2; i++) { - if (cd32_pad_enabled[i]) { + if (cd32_pad_enabled[i]) { uae_u16 p5dir = 0x0200 << (i * 4); uae_u16 p5dat = 0x0100 << (i * 4); but |= 0x40 << i; @@ -960,7 +788,7 @@ static uae_u16 handle_joystick_potgor (uae_u16 potgor) if (!(potgo_value & p9dir)) potgor |= p9dat; } - if (potgo_hsync < 0) { + if (potgo_hsync < 0) { /* first 10 or so lines after potgo has started * forces input-lines to zero */ @@ -981,9 +809,9 @@ static uae_u16 handle_joystick_potgor (uae_u16 potgor) cd32_shifter[i] = 8; /* shift at 1 == return one, >1 = return button states */ if (cd32_shifter[i] == 0) - potgor &= ~p9dat; /* shift at zero == return zero */ + potgor &= ~p9dat; /* shift at zero == return zero */ if (cd32_shifter[i] >= 2 && (joybutton[i] & ((1 << JOYBUTTON_CD32_PLAY) << (cd32_shifter[i] - 2)))) - potgor &= ~p9dat; + potgor &= ~p9dat; //write_log ("%d:%04.4X %08.8X\n", cd32_shifter[i], potgor, m68k_getpc()); } else { if (getbuttonstate (i, JOYBUTTON_3)) @@ -1055,7 +883,7 @@ uae_u16 POT1DAT (void) } /* direction=input, data pin floating, last connected logic level or previous status - written when direction was ouput + * written when direction was ouput * otherwise it is currently connected logic level. * direction=output, data pin is current value, forced to zero if joystick button is pressed * it takes some tens of microseconds before data pin changes state @@ -1110,8 +938,8 @@ static int check_input_queue (int event) struct input_queue_struct *iq; int i; for (i = 0; i < INPUT_QUEUE_SIZE; i++) { - iq = &input_queue[i]; - if (iq->event == event) return i; + iq = &input_queue[i]; + if (iq->event == event) return i; } return -1; } @@ -1124,7 +952,7 @@ static void queue_input_event (int event, int state, int max, int framecnt, int if (event <= 0) return; if (state < 0 && i >= 0) { - iq = &input_queue[i]; + iq = &input_queue[i]; iq->nextframecnt = -1; iq->framecnt = -1; iq->event = 0; @@ -1160,7 +988,7 @@ void inputdevice_do_keyboard (int code, int state) { if (code < 0x80) { uae_u8 key = code | (state ? 0x00 : 0x80); - keybuf[key & 0x7f] = (key & 0x80) ? 0 : 1; + keybuf[key & 0x7f] = (key & 0x80) ? 0 : 1; if (((keybuf[AK_CTRL] || keybuf[AK_RCTRL]) && keybuf[AK_LAMI] && keybuf[AK_RAMI]) || key == AK_RESETWARNING) { int r = keybuf[AK_LALT] | keybuf[AK_RALT]; memset (keybuf, 0, sizeof (keybuf)); @@ -1377,7 +1205,7 @@ int handle_input_event (int nr, int state, int max, int autofire) } else { delta = state; } - mouse_delta[joy][ie->data] += delta; + mouse_delta[joy][ie->data] += delta; } else if (ie->type & 32) { int speed = currprefs.input_joymouse_speed; @@ -1415,7 +1243,7 @@ int handle_input_event (int nr, int state, int max, int autofire) state = state / 256 + 128; joydirpot[joy][ie->data] = state; } else { - int left = oleft[joy], right = oright[joy], top = otop[joy], bot = obot[joy]; + int left = oleft[joy], right = oright[joy], top = otop[joy], bot = obot[joy]; if (ie->type & 16) { /* button to axis mapping */ if (ie->data & DIR_LEFT) left = oleft[joy] = state ? 1 : 0; @@ -1423,7 +1251,7 @@ int handle_input_event (int nr, int state, int max, int autofire) if (ie->data & DIR_UP) top = otop[joy] = state ? 1 : 0; if (ie->data & DIR_DOWN) bot = obot[joy] = state ? 1 : 0; } else { - /* "normal" joystick axis */ + /* "normal" joystick axis */ int deadzone = currprefs.input_joystick_deadzone * max / 100; int neg, pos; if (state < deadzone && state > -deadzone) @@ -1481,10 +1309,6 @@ void inputdevice_vsync (void) void inputdevice_reset (void) { - if (needmousehack ()) - mousehack_set (mousehack_dontcare); - else - mousehack_set (mousehack_normal); ievent_alive = 0; } @@ -1533,8 +1357,8 @@ static int iscd32 (int ei) return 1; } if (ei >= INPUTEVENT_JOY2_CD32_FIRST && ei <= INPUTEVENT_JOY2_CD32_LAST) { - cd32_pad_enabled[1] = 1; - return 2; + cd32_pad_enabled[1] = 1; + return 2; } return 0; } @@ -1542,7 +1366,7 @@ static int iscd32 (int ei) static int isparport (int ei) { if (ei > INPUTEVENT_PAR_JOY1_START && ei < INPUTEVENT_PAR_JOY_END) { - parport_joystick_enabled = 1; + parport_joystick_enabled = 1; return 1; } return 0; @@ -1581,7 +1405,7 @@ static void scanevents(struct uae_prefs *p) for (i = 0; i < MAX_INPUT_DEVICES; i++) { use_joysticks[i] = 0; use_mice[i] = 0; - for (k = 0; k < MAX_INPUT_SUB_EVENT; k++) { + for (k = 0; k < MAX_INPUT_SUB_EVENT; k++) { for (j = 0; j < ID_BUTTON_TOTAL; j++) { if (joysticks[i].enabled && i < n_joy) { @@ -1608,7 +1432,7 @@ static void scanevents(struct uae_prefs *p) for (j = 0; j < ID_AXIS_TOTAL; j++) { if (joysticks[i].enabled && i < n_joy) { - ei = joysticks[i].eventid[ID_AXIS_OFFSET + j][k]; + ei = joysticks[i].eventid[ID_AXIS_OFFSET + j][k]; iscd32 (ei); isparport (ei); ismouse (ei); @@ -1674,7 +1498,7 @@ static void compatibility_mode (struct uae_prefs *prefs) mice[joy].eventid[ID_AXIS_OFFSET + 0][0] = INPUTEVENT_MOUSE1_HORIZ; mice[joy].eventid[ID_AXIS_OFFSET + 1][0] = INPUTEVENT_MOUSE1_VERT; mice[joy].eventid[ID_AXIS_OFFSET + 2][0] = INPUTEVENT_MOUSE1_WHEEL; - mice[joy].eventid[ID_BUTTON_OFFSET + 0][0] = INPUTEVENT_JOY1_FIRE_BUTTON; + mice[joy].eventid[ID_BUTTON_OFFSET + 0][0] = INPUTEVENT_JOY1_FIRE_BUTTON; mice[joy].eventid[ID_BUTTON_OFFSET + 1][0] = INPUTEVENT_JOY1_2ND_BUTTON; mice[joy].eventid[ID_BUTTON_OFFSET + 2][0] = INPUTEVENT_JOY1_3RD_BUTTON; mice[joy].eventid[ID_BUTTON_OFFSET + 3][0] = INPUTEVENT_KEY_ALT_LEFT; @@ -1686,7 +1510,7 @@ static void compatibility_mode (struct uae_prefs *prefs) if ((joy = jsem_ismouse (1, prefs)) >= 0) { mice[joy].eventid[ID_AXIS_OFFSET + 0][0] = INPUTEVENT_MOUSE2_HORIZ; mice[joy].eventid[ID_AXIS_OFFSET + 1][0] = INPUTEVENT_MOUSE2_VERT; - mice[joy].eventid[ID_BUTTON_OFFSET + 0][0] = INPUTEVENT_JOY2_FIRE_BUTTON; + mice[joy].eventid[ID_BUTTON_OFFSET + 0][0] = INPUTEVENT_JOY2_FIRE_BUTTON; mice[joy].eventid[ID_BUTTON_OFFSET + 1][0] = INPUTEVENT_JOY2_2ND_BUTTON; mice[joy].eventid[ID_BUTTON_OFFSET + 2][0] = INPUTEVENT_JOY2_3RD_BUTTON; mice[joy].enabled = 1; @@ -1695,7 +1519,7 @@ static void compatibility_mode (struct uae_prefs *prefs) joy = jsem_isjoy (1, prefs); if (joy >= 0) { joysticks[joy].eventid[ID_AXIS_OFFSET + 0][0] = INPUTEVENT_JOY2_HORIZ; - joysticks[joy].eventid[ID_AXIS_OFFSET + 1][0] = INPUTEVENT_JOY2_VERT; + joysticks[joy].eventid[ID_AXIS_OFFSET + 1][0] = INPUTEVENT_JOY2_VERT; used[joy] = 1; joysticks[joy].eventid[ID_BUTTON_OFFSET + 0][0] = INPUTEVENT_JOY2_FIRE_BUTTON; joysticks[joy].eventid[ID_BUTTON_OFFSET + 1][0] = INPUTEVENT_JOY2_2ND_BUTTON; @@ -1710,7 +1534,7 @@ static void compatibility_mode (struct uae_prefs *prefs) joy = jsem_isjoy (0, prefs); if (joy >= 0) { used[joy] = 1; - joysticks[joy].eventid[ID_AXIS_OFFSET + 0][0] = INPUTEVENT_JOY1_HORIZ; + joysticks[joy].eventid[ID_AXIS_OFFSET + 0][0] = INPUTEVENT_JOY1_HORIZ; joysticks[joy].eventid[ID_AXIS_OFFSET + 1][0] = INPUTEVENT_JOY1_VERT; joysticks[joy].eventid[ID_BUTTON_OFFSET + 0][0] = INPUTEVENT_JOY1_FIRE_BUTTON; joysticks[joy].eventid[ID_BUTTON_OFFSET + 1][0] = INPUTEVENT_JOY1_2ND_BUTTON; @@ -1720,7 +1544,7 @@ static void compatibility_mode (struct uae_prefs *prefs) for (joy = 0; used[joy]; joy++); if (JSEM_ISANYKBD (0, prefs)) { - joysticks[joy].eventid[ID_AXIS_OFFSET + 0][0] = INPUTEVENT_JOY1_HORIZ; + joysticks[joy].eventid[ID_AXIS_OFFSET + 0][0] = INPUTEVENT_JOY1_HORIZ; joysticks[joy].eventid[ID_AXIS_OFFSET + 1][0] = INPUTEVENT_JOY1_VERT; joysticks[joy].eventid[ID_BUTTON_OFFSET + 0][0] = INPUTEVENT_JOY1_FIRE_BUTTON; joysticks[joy].eventid[ID_BUTTON_OFFSET + 1][0] = INPUTEVENT_JOY1_2ND_BUTTON; @@ -1731,7 +1555,7 @@ static void compatibility_mode (struct uae_prefs *prefs) } for (joy = 0; used[joy]; joy++); if (JSEM_ISANYKBD (1, prefs)) { - joysticks[joy].eventid[ID_AXIS_OFFSET + 0][0] = INPUTEVENT_JOY2_HORIZ; + joysticks[joy].eventid[ID_AXIS_OFFSET + 0][0] = INPUTEVENT_JOY2_HORIZ; joysticks[joy].eventid[ID_AXIS_OFFSET + 1][0] = INPUTEVENT_JOY2_VERT; joysticks[joy].eventid[ID_BUTTON_OFFSET + 0][0] = INPUTEVENT_JOY2_FIRE_BUTTON; joysticks[joy].eventid[ID_BUTTON_OFFSET + 1][0] = INPUTEVENT_JOY2_2ND_BUTTON; @@ -1812,7 +1636,7 @@ static void set_kbr_default (struct uae_prefs *p, int index, int num) if (!trans) return; for (j = 0; j < MAX_INPUT_DEVICES; j++) { - kbr = &p->keyboard_settings[index][j]; + kbr = &p->keyboard_settings[index][j]; for (i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) { memset (kbr, 0, sizeof (struct uae_input_device)); kbr->extra[i][0] = -1; @@ -1855,7 +1679,7 @@ void inputdevice_default_prefs (struct uae_prefs *p) p->input_mouse_speed = 100; p->input_autofire_framecnt = 10; for (i = 0; i <= MAX_INPUT_SETTINGS; i++) { - set_kbr_default (p, i, 0); + set_kbr_default (p, i, 0); input_get_default_mouse (p->mouse_settings[i]); input_get_default_joystick (p->joystick_settings[i]); } @@ -1876,7 +1700,7 @@ int inputdevice_translatekeycode (int keyboard, int scancode, int state) return handled; j = 0; while (na->extra[j][0] >= 0) { - if (na->extra[j][0] == scancode) { + if (na->extra[j][0] == scancode) { for (k = 0; k < MAX_INPUT_SUB_EVENT; k++) {/* send key release events in reverse order */ int autofire = (na->flags[j][sublevdir[state == 0 ? 1 : 0][k]] & ID_FLAG_AUTOFIRE) ? 1 : 0; int event = na->eventid[j][sublevdir[state == 0 ? 1 : 0][k]]; @@ -2065,7 +1889,7 @@ static void get_ename (struct inputevent *ie, char *out) if (!out) return; if (ie->allow_mask == AM_K) - sprintf (out, "%s (0x%02.2X)", ie->name, ie->data); + sprintf (out, "%s (0x%02.2X)", ie->name, ie->data); else strcpy (out, ie->name); } @@ -2120,7 +1944,7 @@ int inputdevice_iterate (int devnum, int num, char *name, int *af) if (!(ie->allow_mask & mask)) continue; get_event_data (idf, devindex, num, &data, &custom, &flags, 0); - get_ename (ie, name); + get_ename (ie, name); *af = (flags & ID_FLAG_AUTOFIRE) ? 1 : 0; return 1; } @@ -2169,7 +1993,7 @@ int inputdevice_set_mapping (int devnum, int num, char *name, char *custom, int if (uid == 0 || num < 0) return 0; if (name) { - eid = 1; + eid = 1; while (events[eid].name) { get_ename (&events[eid], ename); if (!strcmp(ename, name)) break; @@ -2259,10 +2083,10 @@ void inputdevice_swap_ports (struct uae_prefs *p, int devnum) k = 1; while (events[k].confname) { ie2 = &events[k]; - if (ie2->type == ie->type && ie2->data == ie->data && ie2->unit - 1 == ((ie->unit - 1) ^ 1) && ie2->allow_mask == ie->allow_mask) { - uid->eventid[i][j] = k; - break; - } + if (ie2->type == ie->type && ie2->data == ie->data && ie2->unit - 1 == ((ie->unit - 1) ^ 1) && ie2->allow_mask == ie->allow_mask) { + uid->eventid[i][j] = k; + break; + } k++; } } @@ -2309,7 +2133,7 @@ void inputdevice_unacquire (void) for (i = 0; i < MAX_INPUT_DEVICES; i++) idev[IDTYPE_MOUSE].unacquire (i); for (i = 0; i < MAX_INPUT_DEVICES; i++) - idev[IDTYPE_KEYBOARD].unacquire (i); + idev[IDTYPE_KEYBOARD].unacquire (i); } /* Call this function when host machine's joystick/joypad/etc button state changes @@ -2409,17 +2233,15 @@ void setmousestate (int mouse, int axis, int data, int isabs) if (!isabs) { *oldm_p = *mouse_p; *mouse_p += data; - d = (*mouse_p - *oldm_p) * currprefs.input_mouse_speed / 100.0; + d = (*mouse_p - *oldm_p) * currprefs.input_mouse_speed / 100.0; } else { d = data - (int)(*oldm_p); *oldm_p = data; *mouse_p += d; - if (mousehack_allowed () && needmousehack ()) { - if (axis == 0) - lastmx = data; - else - lastmy = data; - } + if (axis == 0) + lastmx = data; + else + lastmy = data; } v = (int)(d > 0 ? d + 0.5 : d - 0.5); fract1[mouse][axis] += d; @@ -2443,17 +2265,17 @@ void warpmode (int mode) turbo_emulation = currprefs.gfx_framerate; } } else if (mode == 0 && turbo_emulation > 0) { - changed_prefs.gfx_framerate = currprefs.gfx_framerate = turbo_emulation; + changed_prefs.gfx_framerate = currprefs.gfx_framerate = turbo_emulation; turbo_emulation = 0; } else if (mode > 0 && !turbo_emulation) { - turbo_emulation = currprefs.gfx_framerate; + turbo_emulation = currprefs.gfx_framerate; } if (turbo_emulation) { if (!currprefs.cpu_cycle_exact && !currprefs.blitter_cycle_exact) changed_prefs.gfx_framerate = currprefs.gfx_framerate = 10; - pause_sound (); + pause_sound (); } else { - resume_sound (); + resume_sound (); } compute_vsynctime (); } diff --git a/inputevents.def b/inputevents.def index dc176bfd..ac6d3e47 100755 --- a/inputevents.def +++ b/inputevents.def @@ -237,23 +237,43 @@ DEFEVENT(MOUSEWHEEL_UP,"Mouse Wheel Up",AM_K,0,0,0x7b) DEFEVENT(KEY_CDTV_STOP,"CDTV Stop",AM_K,0,0,0x72) DEFEVENT(KEY_CDTV_PLAYPAUSE,"CDTV Play/Pause",AM_K,0,0,0x73) -DEFEVENT(KEY_CDTV_FF,"CDTV Fast Forward",AM_K,0,0,0x74) -DEFEVENT(KEY_CDTV_REW,"CDTV Rewind",AM_K,0,0,0x75) +DEFEVENT(KEY_CDTV_PREV,"CDTV Previous",AM_K,0,0,0x74) +DEFEVENT(KEY_CDTV_NEXT,"CDTV Next",AM_K,0,0,0x75) +DEFEVENT(KEY_CDTV_REW,"CDTV Rewind",AM_K,0,0,0x76) +DEFEVENT(KEY_CDTV_FF,"CDTV Fast Forward",AM_K,0,0,0x77) +DEFEVENT(KEY_0E,"Keycode 0x0E",AM_K,0,0,0x0e) + +DEFEVENT(KEY_1C,"Keycode 0x1C",AM_K,0,0,0x1c) + +DEFEVENT(KEY_2C,"Keycode 0x2C",AM_K,0,0,0x2C) + +DEFEVENT(KEY_3B,"Keycode 0x3B",AM_K,0,0,0x3b) DEFEVENT(KEY_47,"Keycode 0x47",AM_K,0,0,0x47) + DEFEVENT(KEY_48,"Keycode 0x48",AM_K,0,0,0x48) DEFEVENT(KEY_49,"Keycode 0x49",AM_K,0,0,0x49) -DEFEVENT(KEY_4B,"Keycode 0x4B",AM_K,0,0,0x4B) - +DEFEVENT(KEY_4B,"Keycode 0x4B",AM_K,0,0,0x4b) + +DEFEVENT(KEY_68,"Keycode 0x68",AM_K,0,0,0x68) +DEFEVENT(KEY_69,"Keycode 0x69",AM_K,0,0,0x69) +DEFEVENT(KEY_6A,"Keycode 0x6A",AM_K,0,0,0x6a) +DEFEVENT(KEY_6B,"Keycode 0x6B",AM_K,0,0,0x6b) +DEFEVENT(KEY_6C,"Keycode 0x6C",AM_K,0,0,0x6c) +DEFEVENT(KEY_6D,"Keycode 0x6D",AM_K,0,0,0x6d) DEFEVENT(KEY_6E,"Keycode 0x6E",AM_K,0,0,0x6e) DEFEVENT(KEY_6F,"Keycode 0x6F",AM_K,0,0,0x6f) DEFEVENT(KEY_70,"Keycode 0x70",AM_K,0,0,0x70) DEFEVENT(KEY_71,"Keycode 0x71",AM_K,0,0,0x71) -DEFEVENT(KEY_76,"Keycode 0x76",AM_K,0,0,0x76) -DEFEVENT(KEY_77,"Keycode 0x77",AM_K,0,0,0x77) DEFEVENT(KEY_78,"Keycode 0x78 (Reset Warning)",AM_K,0,0,0x78) DEFEVENT(KEY_79,"Keycode 0x79",AM_K,0,0,0x79) +DEFEVENT(KEY_7A,"Keycode 0x7A",AM_K,0,0,0x7a) +DEFEVENT(KEY_7B,"Keycode 0x7B",AM_K,0,0,0x7b) +DEFEVENT(KEY_7C,"Keycode 0x7C",AM_K,0,0,0x7c) +DEFEVENT(KEY_7D,"Keycode 0x7D",AM_K,0,0,0x7d) +DEFEVENT(KEY_7E,"Keycode 0x7E",AM_K,0,0,0x7e) +DEFEVENT(KEY_7F,"Keycode 0x7F",AM_K,0,0,0x7f) /* special */ diff --git a/keybuf.c b/keybuf.c index 3d4fef52..5aaf1415 100755 --- a/keybuf.c +++ b/keybuf.c @@ -138,7 +138,7 @@ void record_key (int kc) do_fake (1); return; } else { - if ((kc >> 1) == AK_RCTRL) { + if ((kc >> 1) == AK_RCTRL) { kc ^= AK_RCTRL << 1; kc ^= AK_CTRL << 1; } diff --git a/memory.c b/memory.c index a6fa821e..bd5521e4 100755 --- a/memory.c +++ b/memory.c @@ -30,7 +30,7 @@ int canbang; #ifdef JIT -/* Set by each memory handler that does not simply access real memory. */ +/* Set by each memory handler that does not simply access real memory. */ int special_mem; #endif @@ -154,7 +154,7 @@ struct romdata *getarcadiarombyname (char *name) { int i; for (i = 0; roms[i].name; i++) { - if (roms[i].type == ROMTYPE_ARCADIA) { + if (roms[i].type == ROMTYPE_ARCADIA) { char *p = roms[i].name; p = p + strlen (p) + 1; if (strlen (name) >= strlen (p) + 4) { @@ -171,8 +171,8 @@ void decode_cloanto_rom_do (uae_u8 *mem, int size, int real_size, uae_u8 *key, i { long cnt, t; for (t = cnt = 0; cnt < size; cnt++, t = (t + 1) % keysize) { - mem[cnt] ^= key[t]; - if (real_size == cnt + 1) + mem[cnt] ^= key[t]; + if (real_size == cnt + 1) t = keysize - 1; } } @@ -213,10 +213,10 @@ uae_u8 *load_keyfile (struct uae_prefs *p, char *path, int *size) strcpy (tmp, p->romfile); d = strrchr(tmp, '/'); if (!d) - d = strrchr(tmp, '\\'); + d = strrchr(tmp, '\\'); if (d) { - strcpy (d + 1, "rom.key"); - f = zfile_fopen(tmp, "rb"); + strcpy (d + 1, "rom.key"); + f = zfile_fopen(tmp, "rb"); } } @@ -253,7 +253,7 @@ static int decode_cloanto_rom (uae_u8 *mem, int size, int real_size) p = load_keyfile (&currprefs, NULL, &keysize); if (!p) { -#ifndef SINGLEFILE +#ifndef SINGLEFILE notify_user (NUMSG_NOROMKEY); #endif return 0; @@ -355,7 +355,7 @@ struct romdata *getromdatabyzfile (struct zfile *f) return rd; } -void getromname (struct romdata *rd, char *name) +void getromname (struct romdata *rd, char *name) { name[0] = 0; if (rd->type == ROMTYPE_ARCADIA) @@ -404,7 +404,7 @@ __inline__ void byteput (uaecptr addr, uae_u32 b) } #endif -uae_u32 chipmem_mask, chipmem_full_mask; +uae_u32 chipmem_mask, chipmem_full_mask; uae_u32 kickmem_mask, extendedkickmem_mask, bogomem_mask, a3000mem_mask; static int illegal_count; @@ -418,7 +418,7 @@ static void dummy_wput (uaecptr, uae_u32) REGPARAM; static void dummy_bput (uaecptr, uae_u32) REGPARAM; static int dummy_check (uaecptr addr, uae_u32 size) REGPARAM; -#define MAX_ILG 20 +#define MAX_ILG 20 uae_u32 REGPARAM2 dummy_lget (uaecptr addr) { @@ -522,7 +522,7 @@ int REGPARAM2 dummy_check (uaecptr addr, uae_u32 size) #ifdef AUTOCONFIG -/* A3000 "motherboard resources" bank. */ +/* A3000 "motherboard resources" bank. */ static uae_u32 mbres_lget (uaecptr) REGPARAM; static uae_u32 mbres_wget (uaecptr) REGPARAM; static uae_u32 mbres_bget (uaecptr) REGPARAM; @@ -1008,13 +1008,13 @@ static void a1000_handle_kickstart (int mode) if (mode == 0) { a1000_kickstart_mode = 0; memcpy (kickmemory, kickmemory + 262144, 262144); - kickstart_version = (kickmemory[262144 + 12] << 8) | kickmemory[262144 + 13]; + kickstart_version = (kickmemory[262144 + 12] << 8) | kickmemory[262144 + 13]; } else { a1000_kickstart_mode = 1; memset (kickmemory, 0, 262144); memcpy (kickmemory, a1000_bootrom, 65536); memcpy (kickmemory + 131072, a1000_bootrom, 65536); - kickstart_version = 0; + kickstart_version = 0; } } @@ -1299,7 +1299,7 @@ uae_u8 REGPARAM2 *default_xlate (uaecptr a) } } } - return kickmem_xlate (0); /* So we don't crash. */ + return kickmem_xlate (0); /* So we don't crash. */ } /* Address banks */ @@ -1381,7 +1381,7 @@ static int kickstart_checksum (uae_u8 *mem, int size) cksum++; prevck = cksum; } -#ifndef SINGLEFILE +#ifndef SINGLEFILE if (cksum != 0xFFFFFFFFul) notify_user (NUMSG_KSROMCRCERROR); #endif @@ -1424,10 +1424,10 @@ int read_kickstart (struct zfile *f, uae_u8 *mem, int size, int dochecksum, int return 0; } if (i == 8192 || i == 65536) { - a1000_bootrom = xmalloc (65536); - memcpy (a1000_bootrom, kickmemory, 65536); - memset (kickmemory, 0, kickmem_size); - a1000_handle_kickstart (1); + a1000_bootrom = xmalloc (65536); + memcpy (a1000_bootrom, kickmemory, 65536); + memset (kickmemory, 0, kickmem_size); + a1000_handle_kickstart (1); i = 524288; dochecksum = 0; } @@ -1506,9 +1506,9 @@ static int patch_shapeshifter (uae_u8 *kickmemory) uae_u8 kickshift3[] = { 0x43, 0xf8, 0x04, 0x00 }; for (i = 0x200; i < 0x300; i++) { - if (!memcmp (kickmemory + i, kickshift1, sizeof (kickshift1)) || - !memcmp (kickmemory + i, kickshift2, sizeof (kickshift2)) || - !memcmp (kickmemory + i, kickshift3, sizeof (kickshift3))) { + if (!memcmp (kickmemory + i, kickshift1, sizeof (kickshift1)) || + !memcmp (kickmemory + i, kickshift2, sizeof (kickshift2)) || + !memcmp (kickmemory + i, kickshift3, sizeof (kickshift3))) { kickmemory[i + 2] = 0x30; write_log ("Kickstart KickShifted @%04.4X\n", i); patched++; @@ -1543,7 +1543,7 @@ static int patch_residents (uae_u8 *kickmemory) } j++; } - } + } } } return patched; @@ -1578,7 +1578,7 @@ static int load_kickstart (void) #if defined(AMIGA)||defined(__POS__) #define USE_UAE_ERSATZ "USE_UAE_ERSATZ" if( !getenv(USE_UAE_ERSATZ)) - { + { write_log ("Using current ROM. (create ENV:%s to " "use uae's ROM replacement)\n",USE_UAE_ERSATZ); memcpy(kickmemory,(char*)0x1000000-kickmem_size,kickmem_size); @@ -1840,7 +1840,7 @@ static void allocate_memory (void) if (savestate_state == STATE_RESTORE) { restore_ram (chip_filepos, chipmemory); if (allocated_bogomem > 0) - restore_ram (bogo_filepos, bogomemory); + restore_ram (bogo_filepos, bogomemory); } chipmem_bank.baseaddr = chipmemory; #ifdef AGA @@ -1864,7 +1864,7 @@ void map_overlay (int chip) else map_banks (&kickmem_bank, 0, i, 0x80000); if (savestate_state != STATE_RESTORE && savestate_state != STATE_REWIND) - m68k_setpc(m68k_getpc()); + m68k_setpc(m68k_getpc()); } void memory_reset (void) @@ -1889,12 +1889,12 @@ void memory_reset (void) a1000_kickstart_mode = 0; memcpy (currprefs.romfile, changed_prefs.romfile, sizeof currprefs.romfile); memcpy (currprefs.romextfile, changed_prefs.romextfile, sizeof currprefs.romextfile); - if (savestate_state != STATE_RESTORE) + if (savestate_state != STATE_RESTORE) clearexec (); xfree (extendedkickmemory); extendedkickmemory = 0; - extendedkickmem_size = 0; - load_extendedkickstart (); + extendedkickmem_size = 0; + load_extendedkickstart (); kickmem_mask = 524288 - 1; if (!load_kickstart ()) { if (strlen (currprefs.romfile) > 0) { @@ -1902,7 +1902,7 @@ void memory_reset (void) notify_user (NUMSG_NOROM); } #ifdef AUTOCONFIG - init_ersatz_rom (kickmemory); + init_ersatz_rom (kickmemory); ersatzkickfile = 1; #else uae_restart (-1, NULL); @@ -1966,12 +1966,12 @@ void memory_reset (void) /* map beta Kickstarts to 0x200000 */ if (kickmemory[2] == 0x4e && kickmemory[3] == 0xf9 && kickmemory[4] == 0x00) { uae_u32 addr = kickmemory[5]; - if (addr == 0x20 && currprefs.chipmem_size <= 0x200000 && currprefs.fastmem_size == 0) + if (addr == 0x20 && currprefs.chipmem_size <= 0x200000 && currprefs.fastmem_size == 0) map_banks (&kickmem_bank, addr, 8, 0); } if (a1000_bootrom) - a1000_handle_kickstart (1); + a1000_handle_kickstart (1); #ifdef AUTOCONFIG map_banks (&expamem_bank, 0xE8, 1, 0); #endif @@ -2016,7 +2016,7 @@ void memory_reset (void) memcpy (currprefs.cartfile, changed_prefs.cartfile, sizeof currprefs.cartfile); arcadia_unmap (); } - arcadia_map_banks (); + arcadia_map_banks (); } #endif @@ -2253,7 +2253,7 @@ uae_u8 *save_rom (int first, int *len, uae_u8 *dstptr) if (dstptr) dstbak = dst = dstptr; else - dstbak = dst = xmalloc (4 + 4 + 4 + 4 + 4 + 256 + 256 + mem_size); + dstbak = dst = xmalloc (4 + 4 + 4 + 4 + 4 + 256 + 256 + mem_size); save_u32 (mem_start); save_u32 (mem_size); save_u32 (mem_type); diff --git a/newcpu.c b/newcpu.c index 273044fa..1c72e9c0 100755 --- a/newcpu.c +++ b/newcpu.c @@ -164,7 +164,7 @@ static void build_cpufunctbl (void) tbl = op_smalltbl_5_ff; /* prefetch */ #endif #ifdef CPUEMU_6 - if (currprefs.cpu_cycle_exact) + if (currprefs.cpu_cycle_exact) tbl = op_smalltbl_6_ff; /* prefetch and cycle-exact */ #endif break; @@ -181,7 +181,7 @@ static void build_cpufunctbl (void) #ifdef JIT tbl[i].specific = 0; #endif - cpufunctbl[tbl[i].opcode] = tbl[i].handler; + cpufunctbl[tbl[i].opcode] = tbl[i].handler; } opcnt = 0; for (opcode = 0; opcode < 65536; opcode++) { @@ -311,25 +311,25 @@ void init_m68k (void) } switch (currprefs.cpu_level) { case 1: - write_log ("010"); - break; + write_log ("010"); + break; case 2: - write_log ("020"); - break; + write_log ("020"); + break; case 3: - write_log ("020/881"); - break; + write_log ("020/881"); + break; case 4: - /* Who is going to miss the MMU anyway...? :-) */ - write_log ("040"); - break; + /* Who is going to miss the MMU anyway...? :-) */ + write_log ("040"); + break; case 6: - /* Who is going to miss the MMU anyway...? :-) */ - write_log ("060"); - break; + /* Who is going to miss the MMU anyway...? :-) */ + write_log ("060"); + break; default: - write_log ("000"); - break; + write_log ("000"); + break; } if (currprefs.cpu_cycle_exact) { if (currprefs.cpu_level == 0) @@ -366,7 +366,7 @@ int lastint_no; #define get_ibyte_1(o) get_byte(regs.pc + (regs.pc_p - regs.pc_oldp) + (o) + 1) #define get_iword_1(o) get_word(regs.pc + (regs.pc_p - regs.pc_oldp) + (o)) #define get_ilong_1(o) get_long(regs.pc + (regs.pc_p - regs.pc_oldp) + (o)) - + uae_s32 ShowEA (void *f, uae_u16 opcode, int reg, amodes mode, wordsizes size, char *buf) { uae_u16 dp; @@ -521,7 +521,7 @@ uae_s32 ShowEA (void *f, uae_u16 opcode, int reg, amodes mode, wordsizes size, c offset = (uae_s32)(uae_s16)get_iword_1 (m68kpc_offset); m68kpc_offset += 2; buffer[0] = 0; - sprintf (buffer,"#$%04x", (unsigned int)(offset & 0xffff)); + sprintf (buffer,"#$%04x", (unsigned int)(offset & 0xffff)); break; case imm2: offset = (uae_s32)get_ilong_1 (m68kpc_offset); @@ -750,10 +750,10 @@ void MakeFromSR (void) SET_VFLG ((regs.sr >> 1) & 1); SET_CFLG (regs.sr & 1); if (regs.t1 == ((regs.sr >> 15) & 1) && - regs.t0 == ((regs.sr >> 14) & 1) && - regs.s == ((regs.sr >> 13) & 1) && + regs.t0 == ((regs.sr >> 14) & 1) && + regs.s == ((regs.sr >> 13) & 1) && regs.m == ((regs.sr >> 12) & 1) && - regs.intmask == ((regs.sr >> 8) & 7)) + regs.intmask == ((regs.sr >> 8) & 7)) return; regs.t1 = (regs.sr >> 15) & 1; regs.t0 = (regs.sr >> 14) & 1; @@ -798,7 +798,7 @@ void MakeFromSR (void) if (regs.t1 || regs.t0) set_special (SPCFLAG_TRACE); else - /* Keep SPCFLAG_DOTRACE, we still want a trace exception for + /* Keep SPCFLAG_DOTRACE, we still want a trace exception for SR-modifying instructions (including STOP). */ unset_special (SPCFLAG_TRACE); } @@ -846,10 +846,10 @@ static void Exception_ce (int nr, uaecptr oldpc) c = 6; break; case 4: /* illegal instruction */ - c = 6; + c = 6; break; case 5: /* divide by zero */ - c = 10; + c = 10; break; case 6: /* chk */ c = 12; @@ -897,23 +897,23 @@ static void Exception_ce (int nr, uaecptr oldpc) do_cycles (c * CYCLE_UNIT / 2); if (!regs.s) { regs.usp = m68k_areg(regs, 7); - m68k_areg(regs, 7) = regs.isp; + m68k_areg(regs, 7) = regs.isp; regs.s = 1; } if (nr == 2 || nr == 3) { /* 2=bus error,3=address error */ - uae_u16 mode = (sv ? 4 : 0) | (last_instructionaccess_for_exception_3 ? 2 : 1); + uae_u16 mode = (sv ? 4 : 0) | (last_instructionaccess_for_exception_3 ? 2 : 1); mode |= last_writeaccess_for_exception_3 ? 0 : 16; - m68k_areg(regs, 7) -= 14; - /* fixme: bit3=I/N */ - put_word_ce (m68k_areg(regs, 7) + 12, last_addr_for_exception_3); - put_word_ce (m68k_areg(regs, 7) + 8, regs.sr); - put_word_ce (m68k_areg(regs, 7) + 10, last_addr_for_exception_3 >> 16); - put_word_ce (m68k_areg(regs, 7) + 6, last_op_for_exception_3); - put_word_ce (m68k_areg(regs, 7) + 4, last_fault_for_exception_3); - put_word_ce (m68k_areg(regs, 7) + 0, mode); - put_word_ce (m68k_areg(regs, 7) + 2, last_fault_for_exception_3 >> 16); - write_log ("Exception %d (%x) at %x -> %x!\n", nr, oldpc, currpc, get_long (4 * nr)); - goto kludge_me_do; + m68k_areg(regs, 7) -= 14; + /* fixme: bit3=I/N */ + put_word_ce (m68k_areg(regs, 7) + 12, last_addr_for_exception_3); + put_word_ce (m68k_areg(regs, 7) + 8, regs.sr); + put_word_ce (m68k_areg(regs, 7) + 10, last_addr_for_exception_3 >> 16); + put_word_ce (m68k_areg(regs, 7) + 6, last_op_for_exception_3); + put_word_ce (m68k_areg(regs, 7) + 4, last_fault_for_exception_3); + put_word_ce (m68k_areg(regs, 7) + 0, mode); + put_word_ce (m68k_areg(regs, 7) + 2, last_fault_for_exception_3 >> 16); + write_log ("Exception %d (%x) at %x -> %x!\n", nr, oldpc, currpc, get_long (4 * nr)); + goto kludge_me_do; } m68k_areg (regs, 7) -= 6; put_word_ce (m68k_areg(regs, 7) + 4, currpc); @@ -989,8 +989,8 @@ static void Exception_normal (int nr, uaecptr oldpc) m68k_areg(regs, 7) -= 2; put_word (m68k_areg(regs, 7), 0); } - m68k_areg(regs, 7) -= 4; - put_long (m68k_areg(regs, 7), last_fault_for_exception_3); + m68k_areg(regs, 7) -= 4; + put_long (m68k_areg(regs, 7), last_fault_for_exception_3); m68k_areg(regs, 7) -= 2; put_word (m68k_areg(regs, 7), 0); m68k_areg(regs, 7) -= 2; @@ -1026,7 +1026,7 @@ static void Exception_normal (int nr, uaecptr oldpc) } } else if (nr == 2 || nr == 3) { uae_u16 mode = (sv ? 4 : 0) | (last_instructionaccess_for_exception_3 ? 2 : 1); - mode |= last_writeaccess_for_exception_3 ? 0 : 16; + mode |= last_writeaccess_for_exception_3 ? 0 : 16; m68k_areg(regs, 7) -= 14; /* fixme: bit3=I/N */ put_word (m68k_areg(regs, 7) + 0, mode); @@ -1034,7 +1034,7 @@ static void Exception_normal (int nr, uaecptr oldpc) put_word (m68k_areg(regs, 7) + 6, last_op_for_exception_3); put_word (m68k_areg(regs, 7) + 8, regs.sr); put_long (m68k_areg(regs, 7) + 10, last_addr_for_exception_3); - write_log ("Exception %d (%x) at %x -> %x!\n", nr, oldpc, currpc, get_long (regs.vbr + 4*nr)); + write_log ("Exception %d (%x) at %x -> %x!\n", nr, oldpc, currpc, get_long (regs.vbr + 4*nr)); goto kludge_me_do; } m68k_areg(regs, 7) -= 4; @@ -1468,7 +1468,7 @@ void m68k_reset (void) regs.kick_mask = 0x00F80000; regs.spcflags = 0; if (savestate_state == STATE_RESTORE || savestate_state == STATE_REWIND) { - m68k_setpc (regs.pc); + m68k_setpc (regs.pc); /* MakeFromSR() must not swap stack pointer */ regs.s = (regs.sr >> 13) & 1; MakeFromSR(); @@ -1525,7 +1525,7 @@ unsigned long REGPARAM2 op_illg (uae_u32 opcode) } if (opcode == 0x4E7B && in_rom (pc) && get_long (0x10) == 0) { - notify_user (NUMSG_KS68020); + notify_user (NUMSG_KS68020); uae_restart (-1, NULL); } @@ -1556,7 +1556,7 @@ unsigned long REGPARAM2 op_illg (uae_u32 opcode) if ((opcode & 0xF000) == 0xF000) { if (warned < 20) { - write_log ("B-Trap %x at %x (%p)\n", opcode, m68k_getpc () + m68kpc_offset, regs.pc_p); + write_log ("B-Trap %x at %x (%p)\n", opcode, m68k_getpc () + m68kpc_offset, regs.pc_p); warned++; } Exception(0xB,0); @@ -1573,8 +1573,8 @@ unsigned long REGPARAM2 op_illg (uae_u32 opcode) return 4; } if (warned < 20) { - write_log ("Illegal instruction: %04x at %08.8X -> %08.8X\n", opcode, pc, get_long (regs.vbr + 0x10)); - warned++; + write_log ("Illegal instruction: %04x at %08.8X -> %08.8X\n", opcode, pc, get_long (regs.vbr + 0x10)); + warned++; } Exception (4,0); @@ -1658,7 +1658,7 @@ static int do_specialties (int cycles) { /*if(action_replay_flag == ACTION_REPLAY_ACTIVE && !is_ar_pc_in_rom())*/ /* write_log("PC:%p\n",m68k_getpc());*/ - + if(action_replay_flag == ACTION_REPLAY_ACTIVATE || action_replay_flag == ACTION_REPLAY_DORESET) action_replay_enter(); if(action_replay_flag == ACTION_REPLAY_HIDE && !is_ar_pc_in_rom()) @@ -1686,11 +1686,11 @@ static int do_specialties (int cycles) #endif while ((regs.spcflags & SPCFLAG_BLTNASTY) && dmaen (DMA_BLITTER) && cycles > 0 && !currprefs.blitter_cycle_exact) { - int c = blitnasty(); - if (c > 0) { - cycles -= c * CYCLE_UNIT * 2; - if (cycles < CYCLE_UNIT) - cycles = 0; + int c = blitnasty(); + if (c > 0) { + cycles -= c * CYCLE_UNIT * 2; + if (cycles < CYCLE_UNIT) + cycles = 0; } else c = 4; do_cycles (c * CYCLE_UNIT); @@ -1706,7 +1706,7 @@ static int do_specialties (int cycles) } while (regs.spcflags & SPCFLAG_STOP) { - do_cycles (4 * CYCLE_UNIT); + do_cycles (4 * CYCLE_UNIT); if (regs.spcflags & SPCFLAG_COPPER) do_copper (); if (regs.spcflags & (SPCFLAG_INT | SPCFLAG_DOINT)) { @@ -1716,7 +1716,7 @@ static int do_specialties (int cycles) unset_special (SPCFLAG_INT | SPCFLAG_DOINT); #endif if (intr != -1 && intr > regs.intmask) - Interrupt (intr); + Interrupt (intr); } if ((regs.spcflags & (SPCFLAG_BRK | SPCFLAG_MODE_CHANGE))) { unset_special (SPCFLAG_BRK | SPCFLAG_MODE_CHANGE); @@ -1737,7 +1737,7 @@ static int do_specialties (int cycles) #endif lvpos = vpos; if (sleepcnt < 0) { - sleepcnt = IDLETIME / 2; + sleepcnt = IDLETIME / 2; sleep_millis (1); } } @@ -1757,12 +1757,12 @@ static int do_specialties (int cycles) #else if (regs.spcflags & SPCFLAG_INT) { #endif - int intr = intlev (); + int intr = intlev (); #ifdef JIT if (currprefs.cachesize) unset_special (SPCFLAG_DOINT); #endif - if (intr != -1 && intr > regs.intmask) + if (intr != -1 && intr > regs.intmask) Interrupt (intr); } @@ -2068,7 +2068,7 @@ static void m68k_run_2p (void) cycles = (*cpufunctbl[opcode])(opcode); cycles &= cycles_mask; cycles |= cycles_val; - do_cycles (cycles); + do_cycles (cycles); if (regs.spcflags) { if (do_specialties (cycles)) return; @@ -2104,7 +2104,7 @@ static void m68k_run_2 (void) } #endif /* assert (!regs.stopped && !(regs.spcflags & SPCFLAG_STOP)); */ -/* regs_backup[backup_pointer = (backup_pointer + 1) % 16] = regs;*/ +/* regs_backup[backup_pointer = (backup_pointer + 1) % 16] = regs;*/ #if COUNT_INSTRS == 2 if (table68k[opcode].handler != -1) instrcount[table68k[opcode].handler]++; @@ -2123,7 +2123,7 @@ static void m68k_run_2 (void) /*n_insns++;*/ cycles &= cycles_mask; cycles |= cycles_val; - do_cycles (cycles); + do_cycles (cycles); if (regs.spcflags) { if (do_specialties (cycles)) return; @@ -2141,7 +2141,7 @@ STATIC_INLINE void m68k_run1 (void (*func)(void)) : : "r" (func) : "%eax", "%edx", "%ecx", "memory", "cc"); } #else -#define m68k_run1(F) (F) () +#define m68k_run1(F) (F) () #endif int in_m68k_go = 0; @@ -2183,13 +2183,13 @@ void m68k_go (int may_quit) customreset (); m68k_reset (); if (hardreset) { - memset (chipmemory, 0, allocated_chipmem); + memset (chipmemory, 0, allocated_chipmem); write_log ("chipmem cleared\n"); } /* We may have been restoring state, but we're done now. */ if (savestate_state == STATE_RESTORE || savestate_state == STATE_REWIND) { - map_overlay (1); - fill_prefetch_slow (); /* compatibility with old state saves */ + map_overlay (1); + fill_prefetch_slow (); /* compatibility with old state saves */ } savestate_restore_finish (); fill_prefetch_slow (); @@ -2198,7 +2198,7 @@ void m68k_go (int may_quit) handle_active_events (); if (regs.spcflags) do_specialties (0); - m68k_setpc (regs.pc); + m68k_setpc (regs.pc); } #ifdef DEBUGGER @@ -2212,7 +2212,7 @@ void m68k_go (int may_quit) if (regs.isp & 1) regs.panic = 1; if (!regs.panic) - exception2_handle (regs.panic_pc, regs.panic_addr); + exception2_handle (regs.panic_pc, regs.panic_addr); if (regs.panic) { /* system is very badly confused */ write_log ("double bus error or corrupted stack, forcing reboot..\n"); @@ -2349,7 +2349,7 @@ void sm68k_disasm(char *instrname, char *instrcode, uaecptr addr, uaecptr *nextp oldpc = m68kpc_offset; opcode = get_iword_1 (m68kpc_offset); if (cpufunctbl[opcode] == op_illg_1) { - opcode = 0x4AFC; + opcode = 0x4AFC; } dp = table68k + opcode; for (lookup = lookuptab;lookup->mnemo != dp->mnemo; lookup++); @@ -2359,7 +2359,7 @@ void sm68k_disasm(char *instrname, char *instrcode, uaecptr addr, uaecptr *nextp strcpy (instrname, lookup->name); ccpt = strstr (instrname, "cc"); if (ccpt != 0) { - strncpy (ccpt, ccnames[dp->cc], 2); + strncpy (ccpt, ccnames[dp->cc], 2); } switch (dp->size){ case sz_byte: strcat (instrname, ".B "); break; @@ -2369,14 +2369,14 @@ void sm68k_disasm(char *instrname, char *instrcode, uaecptr addr, uaecptr *nextp } if (dp->suse) { - newpc = m68k_getpc () + m68kpc_offset; - newpc += ShowEA (0, opcode, dp->sreg, dp->smode, dp->size, instrname); + newpc = m68k_getpc () + m68kpc_offset; + newpc += ShowEA (0, opcode, dp->sreg, dp->smode, dp->size, instrname); } if (dp->suse && dp->duse) - strcat (instrname, ","); + strcat (instrname, ","); if (dp->duse) { - newpc = m68k_getpc () + m68kpc_offset; - newpc += ShowEA (0, opcode, dp->dreg, dp->dmode, dp->size, instrname); + newpc = m68k_getpc () + m68kpc_offset; + newpc += ShowEA (0, opcode, dp->dreg, dp->dmode, dp->size, instrname); } if (instrcode) @@ -2409,13 +2409,13 @@ void m68k_dumpstate (void *f, uaecptr *nextpc) if (regs.s && regs.m) regs.msp = m68k_areg(regs, 7); if (regs.s && regs.m == 0) regs.isp = m68k_areg(regs, 7); f_out (f, "USP=%08lx ISP=%08lx MSP=%08lx VBR=%08lx\n", - regs.usp,regs.isp,regs.msp,regs.vbr); + regs.usp,regs.isp,regs.msp,regs.vbr); f_out (f, "T=%d%d S=%d M=%d X=%d N=%d Z=%d V=%d C=%d IMASK=%d\n", - regs.t1, regs.t0, regs.s, regs.m, - GET_XFLG, GET_NFLG, GET_ZFLG, GET_VFLG, GET_CFLG, regs.intmask); + regs.t1, regs.t0, regs.s, regs.m, + GET_XFLG, GET_NFLG, GET_ZFLG, GET_VFLG, GET_CFLG, regs.intmask); #ifdef FPUEMU if (currprefs.cpu_level >= 2) { - uae_u32 fpsr; + uae_u32 fpsr; for (i = 0; i < 8; i++){ f_out (f, "FP%d: %g ", i, regs.fp[i]); if ((i & 3) == 3) f_out (f, "\n"); @@ -2515,7 +2515,7 @@ uae_u8 *restore_cpu (uae_u8 *src) currprefs.m68k_speed = changed_prefs.m68k_speed = -1; } write_log ("CPU %d%s%03d, PC=%08.8X\n", - model / 1000, flags & 1 ? "EC" : "", model % 1000, regs.pc); + model / 1000, flags & 1 ? "EC" : "", model % 1000, regs.pc); init_m68k_full (); m68k_setpc (regs.pc); @@ -2532,7 +2532,7 @@ uae_u8 *save_cpu (int *len, uae_u8 *dstptr) if (dstptr) dstbak = dst = dstptr; else - dstbak = dst = malloc(4+4+15*4+4+4+4+4+2+4+4+4+4+4+4+4); + dstbak = dst = malloc(4+4+15*4+4+4+4+4+2+4+4+4+4+4+4+4); model = cpumodel[currprefs.cpu_level]; save_u32 (model); /* MODEL */ save_u32 (currprefs.address_space_24 ? 1 : 0); /* FLAGS */ @@ -2699,7 +2699,7 @@ STATIC_INLINE int getDivu68kCycles_2(uae_u32 dividend, uae_u16 divisor) int getDivu68kCycles(uae_u32 dividend, uae_u16 divisor) { int v = getDivu68kCycles_2(dividend, divisor) - 4; -// write_log("U%d ", v); +// write_log("U%d ", v); return v; } @@ -2755,6 +2755,6 @@ STATIC_INLINE int getDivs68kCycles_2(uae_s32 dividend, uae_s16 divisor) int getDivs68kCycles(uae_s32 dividend, uae_s16 divisor) { int v = getDivs68kCycles_2(dividend, divisor) - 4; -// write_log("S%d ", v); +// write_log("S%d ", v); return v; } diff --git a/od-win32/ahidsound.c b/od-win32/ahidsound.c index 77b47572..2d83728d 100755 --- a/od-win32/ahidsound.c +++ b/od-win32/ahidsound.c @@ -89,8 +89,8 @@ static LPDIRECTSOUNDCAPTURE lpDS2r = NULL; static LPDIRECTSOUNDCAPTUREBUFFER lpDSBprimary2r = NULL; static LPDIRECTSOUNDCAPTUREBUFFER lpDSB2r = NULL; -struct winuae //this struct is put in a6 if you call - //execute native function +struct winuae //this struct is put in a6 if you call + //execute native function { HWND amigawnd; //adress of amiga Window Windows Handle unsigned int changenum; //number to detect screen close/open @@ -102,10 +102,10 @@ static struct winuae *a6; #if defined(X86_MSVC_ASSEMBLY) #define CREATE_NATIVE_FUNC_PTR2 uae_u32 (* native_func)( uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, \ - uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32,uae_u32,uae_u32) + uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32,uae_u32,uae_u32) #define SET_NATIVE_FUNC2(x) native_func = (uae_u32 (*)(uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32,uae_u32,uae_u32))(x) #define CALL_NATIVE_FUNC2( d1,d2,d3,d4,d5,d6,d7,a1,a2,a3,a4,a5,a6,a7) if(native_func) return native_func( d1,d2,d3,d4,d5,d6,d7,a1,a2,a3,a4,a5,a6,a7,regs_ ) - + static uae_u32 emulib_ExecuteNativeCode2 (void) { uae_u8* object_UAM = (uae_u8*) m68k_areg( regs, 0 ); @@ -170,31 +170,31 @@ void ahi_close_sound (void) if(lpDSB2) { hr = IDirectSoundBuffer_Stop(lpDSB2); } - + if(FAILED(hr)) { write_log( "SoundStop() failure: %s\n", DXError(hr)); } else { write_log( "Sound Stopped...\n" ); } if(lpDSB2) { - IDirectSoundBuffer_Release( lpDSB2 ); - lpDSB2 = NULL; + IDirectSoundBuffer_Release( lpDSB2 ); + lpDSB2 = NULL; } if(lpDSBprimary2) { - IDirectSoundBuffer_Release(lpDSBprimary2); - lpDSBprimary2 = NULL; + IDirectSoundBuffer_Release(lpDSBprimary2); + lpDSBprimary2 = NULL; } if(lpDS2) { - IDirectSound_Release(lpDS2); - lpDS2 = NULL; + IDirectSound_Release(lpDS2); + lpDS2 = NULL; } if(lpDSB2r) { - IDirectSoundCaptureBuffer_Release(lpDSB2r); - lpDSB2r = NULL; + IDirectSoundCaptureBuffer_Release(lpDSB2r); + lpDSB2r = NULL; } if (dsound_tmpw) { @@ -204,7 +204,7 @@ void ahi_close_sound (void) free(ahisndbuffer); } -void ahi_updatesound( int force ) +void ahi_updatesound(int force) { HRESULT hr; int i; @@ -224,22 +224,21 @@ void ahi_updatesound( int force ) /* Get the big looping IDirectSoundBuffer_Play() rolling here, but only once at startup */ hr = IDirectSoundBuffer_Play(lpDSB2, 0, 0, DSBPLAY_LOOPING); hr = IDirectSoundBuffer_Unlock(lpDSB2,lpData,dwBytes,dwData2,dwBytes2); - if (!norec) + if (!norec) hr = IDirectSoundCaptureBuffer_Start(lpDSB2r,DSBPLAY_LOOPING); - //memset( lpData, 0x80,4 ); + //memset( lpData, 0x80,4 ); } /* { long dwEvt=1; dwEvt = MsgWaitForMultipleObjects( - 2, // How many possible events - rghEvent, // Location of handles - FALSE, // Wait for all? - INFINITE, // How long to wait - QS_ALLINPUT); // Any message is an event + 2, // How many possible events + rghEvent, // Location of handles + FALSE, // Wait for all? + INFINITE, // How long to wait + QS_ALLINPUT); // Any message is an event - calcsound=1; if (dwEvt==0)freeblock=0; if (dwEvt==1)freeblock=1; @@ -275,9 +274,9 @@ if (dwEvt>1 ){calcsound=0;return;} if(hr == DSERR_BUFFERLOST) { write_log("lostbuf%d %x\n",i,amigablksize); - IDirectSoundBuffer_Restore(lpDSB2); - hr = IDirectSoundBuffer_Lock(lpDSB2, 0, 0, &lpData, &dwBytes, NULL, NULL, DSBLOCK_ENTIREBUFFER); - dwData1=lpData;dwBytes1=dwBytes;dwBytes2=0;dwData2=0; + IDirectSoundBuffer_Restore(lpDSB2); + hr = IDirectSoundBuffer_Lock(lpDSB2, 0, 0, &lpData, &dwBytes, NULL, NULL, DSBLOCK_ENTIREBUFFER); + dwData1=lpData;dwBytes1=dwBytes;dwBytes2=0;dwData2=0; } if(FAILED(hr)) return; @@ -293,7 +292,7 @@ if (dwEvt>1 ){calcsound=0;return;} p2[i + 1] = p1[i + 0]; } } else { - memcpy(dwData1,ahisndbuffer,dwBytes1); + memcpy(dwData1,ahisndbuffer,dwBytes1); } sndptrmax = ahisndbuffer+ahisndbufsize; @@ -325,7 +324,7 @@ static int ahi_init_sound_win32 (void) DSCBUFFERDESC sound_buffer_rec; if (lpDS2) - return 0; + return 0; enumerate_sound_devices (0); wavfmt.wFormatTag = WAVE_FORMAT_PCM; @@ -344,8 +343,8 @@ static int ahi_init_sound_win32 (void) hr = DirectSoundCreate( &sound_device_guid[currprefs.win32_soundcard], &lpDS2, NULL ); if (FAILED(hr)) { - write_log( "DirectSoundCreate() failure: %s\n", DXError(hr)); - return 0; + write_log( "DirectSoundCreate() failure: %s\n", DXError(hr)); + return 0; } memset (&sound_buffer, 0, sizeof( DSBUFFERDESC )); sound_buffer.dwSize = sizeof( DSBUFFERDESC ); @@ -354,17 +353,15 @@ static int ahi_init_sound_win32 (void) sound_buffer.lpwfxFormat = NULL; dsound_tmpw = CreateWindowEx( WS_EX_ACCEPTFILES, - "PCsuxRox", - "Argh", - WS_CAPTION, - CW_USEDEFAULT, CW_USEDEFAULT, - 10, 10, - NULL, - NULL, - 0, - NULL); - - + "PCsuxRox", + "Argh", + WS_CAPTION, + CW_USEDEFAULT, CW_USEDEFAULT, + 10, 10, + NULL, + NULL, + 0, + NULL); DSCaps.dwSize = sizeof(DSCAPS); hr = IDirectSound_GetCaps(lpDS2, &DSCaps); @@ -374,18 +371,18 @@ static int ahi_init_sound_win32 (void) write_log( "Your DirectSound Driver is emulated via WaveOut - yuck!\n" ); } if FAILED(IDirectSound_SetCooperativeLevel(lpDS2,dsound_tmpw, DSSCL_PRIORITY)) - return 0; + return 0; hr = IDirectSound_CreateSoundBuffer(lpDS2, &sound_buffer, &lpDSBprimary2, NULL); if(FAILED(hr)) { - write_log("CreateSoundBuffer() failure: %s\n", DXError(hr)); - return 0; + write_log("CreateSoundBuffer() failure: %s\n", DXError(hr)); + return 0; } hr = IDirectSoundBuffer_SetFormat(lpDSBprimary2, &wavfmt); if(FAILED(hr)) { - write_log( "SetFormat() failure: %s\n", DXError(hr)); - return 0; + write_log( "SetFormat() failure: %s\n", DXError(hr)); + return 0; } sound_buffer.dwBufferBytes = ahisndbufsize; sound_buffer.lpwfxFormat = &wavfmt; @@ -394,14 +391,14 @@ static int ahi_init_sound_win32 (void) hr = IDirectSound_CreateSoundBuffer(lpDS2, &sound_buffer, &lpDSB2, NULL); if (FAILED(hr)) { - write_log("CreateSoundBuffer() failure: %s\n", DXError(hr)); - return 0; + write_log("CreateSoundBuffer() failure: %s\n", DXError(hr)); + return 0; } /* //used for PositionNotify for ( i = 0; i < 2; i++) { - rghEvent[i] = CreateEvent(NULL, FALSE, FALSE, NULL); - if (NULL == rghEvent[i]) return FALSE; + rghEvent[i] = CreateEvent(NULL, FALSE, FALSE, NULL); + if (NULL == rghEvent[i]) return FALSE; } rgdsbpn[0].dwOffset = 0; rgdsbpn[0].hEventNotify = rghEvent[0]; @@ -410,14 +407,14 @@ static int ahi_init_sound_win32 (void) if FAILED(IDirectSoundBuffer_QueryInterface(lpDSB, - &IID_IDirectSoundNotify, (VOID **)&lpdsNotify)) - return FALSE; + &IID_IDirectSoundNotify, (VOID **)&lpdsNotify)) + return FALSE; if FAILED(IDirectSoundNotify_SetNotificationPositions( - lpdsNotify, 2,rgdsbpn)) + lpdsNotify, 2,rgdsbpn)) { - IDirectSoundNotify_Release(lpdsNotify); - return FALSE; + IDirectSoundNotify_Release(lpdsNotify); + return FALSE; } */ @@ -451,7 +448,7 @@ static int ahi_init_sound_win32 (void) if (!norec) { hr = IDirectSoundCapture_CreateCaptureBuffer( lpDS2r, &sound_buffer_rec, &lpDSB2r, NULL ); - if (FAILED(hr)) + if (FAILED(hr)) { write_log ("CreateCaptureSoundBuffer() failure: %s\n", DXError(hr)); norec = 1; @@ -497,8 +494,8 @@ uae_u32 ahi_demux (void) //use the extern int (6 #13) // d0 0=opensound d1=unit d2=samplerate d3=blksize ret: sound frequency // d0 1=closesound d1=unit -// d0 2=writesamples d1=unit a0=addr write blksize samples to card -// d0 3=readsamples d1=unit a0=addr read samples from card ret: d0=samples read +// d0 2=writesamples d1=unit a0=addr write blksize samples to card +// d0 3=readsamples d1=unit a0=addr read samples from card ret: d0=samples read // make sure you have from amigaside blksize*4 mem alloced // d0=-1 no data available d0=-2 no recording open // d0 > 0 there are more blksize Data in the que @@ -506,53 +503,53 @@ uae_u32 ahi_demux (void) // if d0 is greater than 200 bring a message // that show the user that data is lost // maximum blocksbuffered are 250 (8,5 sec) -// d0 4=writeinterrupt d1=unit d0=0 no interrupt happen for this unit +// d0 4=writeinterrupt d1=unit d0=0 no interrupt happen for this unit // d0=-2 no playing open //note units for now not support use only unit 0 -// d0=10 get clipboard size d0=size in bytes -// d0=11 get clipboard data a0=clipboarddata - //Note: a get clipboard size must do before -// d0=12 write clipboard data a0=clipboarddata -// d0=13 setp96mouserate d1=hz value -// d0=100 open dll d1=dll name in windows name conventions -// d0=101 get dll function addr d1=dllhandle a0 function/var name -// d0=102 exec dllcode a0=addr of function (see 101) +// d0=10 get clipboard size d0=size in bytes +// d0=11 get clipboard data a0=clipboarddata + //Note: a get clipboard size must do before +// d0=12 write clipboard data a0=clipboarddata +// d0=13 setp96mouserate d1=hz value +// d0=100 open dll d1=dll name in windows name conventions +// d0=101 get dll function addr d1=dllhandle a0 function/var name +// d0=102 exec dllcode a0=addr of function (see 101) // d0=103 close dll // d0=104 screenlost // d0=105 mem offset // d0=106 16Bit byteswap // d0=107 32Bit byteswap // d0=108 free swap array -// d0=200 ahitweak d1=offset for dsound position pointer +// d0=200 ahitweak d1=offset for dsound position pointer int opcode = m68k_dreg (regs, 0); switch (opcode) { - int i,slen,t,todo,byte1,byte2; + int i,slen,t,todo,byte1,byte2; LPTSTR p,p2,pos1,pos2; uae_u32 src, num_vars; static int cap_pos,clipsize; static LPTSTR clipdat; int cur_pos; - + case 0: cap_pos=0; - sound_freq_ahi=m68k_dreg (regs, 2); - amigablksize=m68k_dreg (regs, 3); + sound_freq_ahi=m68k_dreg (regs, 2); + amigablksize=m68k_dreg (regs, 3); sound_freq_ahi=ahi_open_sound(); uaevar.changenum--; return sound_freq_ahi; - case 1: + case 1: ahi_close_sound(); sound_freq_ahi = 0; return 0; - case 2: + case 2: addr=(char *)m68k_areg (regs, 0); for (i=0;i<(amigablksize*4);i+=4) { - ahisndbufpt[0] = get_long((unsigned int)addr+i); + ahisndbufpt[0] = get_long((unsigned int)addr+i); ahisndbufpt+=1; /*ahisndbufpt[0]=chipmem_bget((unsigned int)addr+i+2); ahisndbufpt+=1; @@ -576,7 +573,7 @@ uae_u32 ahi_demux (void) todo=cur_pos+(RECORDBUFFER*t)-cap_pos; if (todocbSize = (WORD) (wfxMaxFmtSize - sizeof(WAVEFORMATEX)); // shrugs - + memset(&acmopt, 0, sizeof(ACMFORMATCHOOSE)); - + acmopt.cbStruct = sizeof(ACMFORMATCHOOSE); acmopt.fdwStyle = ACMFORMATCHOOSE_STYLEF_ENABLEHOOK | ACMFORMATCHOOSE_STYLEF_INITTOWFXSTRUCT; acmopt.hwndOwner = hwnd; - + acmopt.pwfx = pwfxDst; acmopt.cbwfx = wfxMaxFmtSize; - + acmopt.pszTitle = "Choose Audio Codec"; - + //acmopt.szFormatTag =; // not valid until the format is chosen //acmopt.szFormat =; // not valid until the format is chosen - + //acmopt.pszName =; // can use later in config saving loading //acmopt.cchName =; // size of pszName, as pszName can be non-null-terminated - + acmopt.fdwEnum = ACM_FORMATENUMF_INPUT | ACM_FORMATENUMF_NCHANNELS | ACM_FORMATENUMF_NSAMPLESPERSEC; //ACM_FORMATENUMF_CONVERT // renders WinUAE unstable for some unknown reason //ACM_FORMATENUMF_WBITSPERSAMPLE // MP3 doesn't apply so it will be removed from codec selection //ACM_FORMATENUMF_SUGGEST // with this flag set, only MP3 320kbps is displayed, which is closest to the source format - + acmopt.pwfxEnum = &wfxSrc; - + acmopt.pfnHook = acmFilterChooseHookProc; - + switch(acmFormatChoose(&acmopt)) { case MMSYSERR_NOERROR: - { - - return acmopt.szFormatTag; - } + return acmopt.szFormatTag; case ACMERR_CANCELED: //MessageBox(hwnd, "The user chose the Cancel button or the Close command on the System menu to close the dialog box.", VersionStr, MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND); @@ -248,23 +245,23 @@ LPSTR AVIOutput_ChooseAudioCodec(HWND hwnd) MessageBox(hwnd, "acmFormatChoose() FAILED", VersionStr, MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND); break; } - + return NULL; } LPSTR AVIOutput_ChooseVideoCodec(HWND hwnd) { ICINFO icinfo = { 0 }; - + AVIOutput_ReleaseVideo(); - avioutput_width = workprefs.gfx_width; - avioutput_height = workprefs.gfx_height; - avioutput_bits = workprefs.color_mode == 2 ? 16 : workprefs.color_mode > 2 ? 32 : 8; - + avioutput_width = workprefs.gfx_width; + avioutput_height = workprefs.gfx_height; + avioutput_bits = workprefs.color_mode == 2 ? 16 : workprefs.color_mode > 2 ? 32 : 8; + if(!(lpbi = (LPBITMAPINFOHEADER) malloc(sizeof(BITMAPINFOHEADER) + (((avioutput_bits <= 8) ? 1 << avioutput_bits : 0) * sizeof(RGBQUAD))))) return NULL; - + lpbi->biSize = sizeof(BITMAPINFOHEADER); lpbi->biWidth = avioutput_width; lpbi->biHeight = avioutput_height; @@ -279,23 +276,23 @@ LPSTR AVIOutput_ChooseVideoCodec(HWND hwnd) if(!(pcompvars = (PCOMPVARS) malloc(sizeof(COMPVARS)))) return NULL; - + memset(pcompvars, 0, sizeof(COMPVARS)); pcompvars->cbSize = sizeof(COMPVARS); - + // we really should check first to see if the user has a particular compressor installed before we set one // we could set one but we will leave it up to the operating system and the set priority levels for the compressors - + // default //pcompvars->fccHandler = mmioFOURCC('C','V','I','D'); // "Cinepak Codec by Radius" //pcompvars->fccHandler = mmioFOURCC('M','R','L','E'); // "Microsoft RLE" //pcompvars->fccHandler = mmioFOURCC('D','I','B',' '); // "Full Frames (Uncompressed)" - + pcompvars->lQ = 10000; // 10000 is maximum quality setting or ICQUALITY_DEFAULT for default pcompvars->lKey = avioutput_fps; // default to one key frame per second, every (FPS) frames - + pcompvars->dwFlags = ICMF_COMPVARS_VALID; - + if(ICCompressorChoose(hwnd, ICMF_CHOOSE_DATARATE | ICMF_CHOOSE_KEYFRAME, lpbi, NULL, pcompvars, "Choose Video Codec") == TRUE) { if(pcompvars->fccHandler == mmioFOURCC('D','I','B',' ')) @@ -309,7 +306,7 @@ LPSTR AVIOutput_ChooseVideoCodec(HWND hwnd) return string; } } - + return NULL; } @@ -346,23 +343,23 @@ static void AVIOuput_AVIWriteAudio (uae_u8 *sndbuffer, int sndbufsize) { DWORD dwOutputBytes = 0, written = 0, swritten = 0; unsigned int err; - - if (avioutput_needs_restart) + + if (avioutput_needs_restart) dorestart (); EnterCriticalSection(&AVIOutput_CriticalSection); - + if(avioutput_audio) { if(!avioutput_init) goto error; - + if((err = acmStreamSize(has, sndbufsize, &dwOutputBytes, ACM_STREAMSIZEF_SOURCE) != 0)) { gui_message("acmStreamSize() FAILED (%X)\n", err); goto error; } - + if(!(lpAudio = malloc(dwOutputBytes))) { goto error; @@ -371,44 +368,44 @@ static void AVIOuput_AVIWriteAudio (uae_u8 *sndbuffer, int sndbufsize) ash.cbStruct = sizeof(ACMSTREAMHEADER); ash.fdwStatus = 0; ash.dwUser = 0; - + // source ash.pbSrc = sndbuffer; - + ash.cbSrcLength = sndbufsize; ash.cbSrcLengthUsed = 0; // This member is not valid until the conversion is complete. - + ash.dwSrcUser = 0; - + // destination ash.pbDst = lpAudio; - + ash.cbDstLength = dwOutputBytes; ash.cbDstLengthUsed = 0; // This member is not valid until the conversion is complete. - + ash.dwDstUser = 0; - + if((err = acmStreamPrepareHeader(has, &ash, 0))) { gui_message("acmStreamPrepareHeader() FAILED (%X)\n", err); goto error; } - + if((err = acmStreamConvert(has, &ash, ACM_STREAMCONVERTF_BLOCKALIGN))) { gui_message("acmStreamConvert() FAILED (%X)\n", err); goto error; } - + if((err = AVIStreamWrite(AVIAudioStream, StreamSizeAudio, ash.cbDstLengthUsed / pwfxDst->nBlockAlign, lpAudio, ash.cbDstLengthUsed, 0, &swritten, &written)) != 0) { gui_message("AVIStreamWrite() FAILED (%X)\n", err); goto error; } - + StreamSizeAudio += swritten; total_avi_size += written; - + acmStreamUnprepareHeader(has, &ash, 0); if(lpAudio) @@ -418,12 +415,11 @@ static void AVIOuput_AVIWriteAudio (uae_u8 *sndbuffer, int sndbufsize) } checkAVIsize (0); } - + LeaveCriticalSection(&AVIOutput_CriticalSection); return; - + error: - LeaveCriticalSection(&AVIOutput_CriticalSection); AVIOutput_End(); } @@ -465,8 +461,8 @@ static int getFromDC(LPBITMAPINFO lpbi) SelectObject(hdcMem, hbitmapOld); if(GetDIBits(hdc, hbitmap, 0, avioutput_height, lpVideo, (LPBITMAPINFO) lpbi, DIB_RGB_COLORS) == 0) { - gui_message("GetDIBits() FAILED (%X)\n", GetLastError()); - ok = 0; + gui_message("GetDIBits() FAILED (%X)\n", GetLastError()); + ok = 0; } DeleteObject(hbitmap); DeleteDC(hdcMem); @@ -506,7 +502,7 @@ static int getFromBuffer(LPBITMAPINFO lpbi) dst -= avioutput_width * gfxvidinfo.pixbytes; for (x = 0; x < (gfxvidinfo.width > avioutput_width ? avioutput_width : gfxvidinfo.width); x++) { if (gfxvidinfo.pixbytes == 1) { - dst[x] = src[x]; + dst[x] = src[x]; } else if (gfxvidinfo.pixbytes == 2) { uae_u16 v = ((uae_u16*)src)[x]; uae_u16 v2 = v; @@ -521,7 +517,7 @@ static int getFromBuffer(LPBITMAPINFO lpbi) ((uae_u32*)dst)[x] = v; } } - src += gfxvidinfo.rowbytes; + src += gfxvidinfo.rowbytes; } return 1; } @@ -540,11 +536,11 @@ void AVIOutput_WriteVideo(void) if(avioutput_video) { - if(!avioutput_init) + if(!avioutput_init) goto error; - actual_width = gfxvidinfo.width; - actual_height = gfxvidinfo.height; + actual_width = gfxvidinfo.width; + actual_height = gfxvidinfo.height; #if defined (GFXFILTER) if (!usedfilter || (usedfilter && usedfilter->x[0]) || WIN32GFX_IsPicassoScreen ()) @@ -552,7 +548,7 @@ void AVIOutput_WriteVideo(void) else v = getFromBuffer((LPBITMAPINFO)lpbi); #else - v = getFromDC((LPBITMAPINFO)lpbi); + v = getFromDC((LPBITMAPINFO)lpbi); #endif if (!v) goto error; @@ -564,8 +560,8 @@ void AVIOutput_WriteVideo(void) { if((err = AVIStreamSetFormat(AVIVideoStream, frame_count, lpbi, lpbi->biSize + (lpbi->biClrUsed * sizeof(RGBQUAD)))) != 0) { - gui_message("AVIStreamSetFormat() FAILED (%X)\n", err); - goto error; + gui_message("AVIStreamSetFormat() FAILED (%X)\n", err); + goto error; } } @@ -574,23 +570,23 @@ void AVIOutput_WriteVideo(void) gui_message("AVIStreamWrite() FAILED (%X)\n", err); goto error; } - + frame_count++; total_avi_size += written; - + if(frame_end) { if(frame_count >= frame_end) { - AVIOutput_End(); + AVIOutput_End(); } } checkAVIsize (0); } else { - gui_message("DirectDraw_GetDC() FAILED\n"); - goto error; + gui_message("DirectDraw_GetDC() FAILED\n"); + goto error; } @@ -598,7 +594,7 @@ void AVIOutput_WriteVideo(void) if ((frame_count % (avioutput_fps * 10)) == 0) write_log ("AVIOutput: %d frames, (%d fps)\n", frame_count, avioutput_fps); return; - + error: LeaveCriticalSection(&AVIOutput_CriticalSection); @@ -655,25 +651,25 @@ void AVIOutput_End(void) acmStreamClose(has, 0); has = NULL; } - + if(AVIAudioStream) { AVIStreamRelease(AVIAudioStream); AVIAudioStream = NULL; } - + if(AVIVideoStream) { AVIStreamRelease(AVIVideoStream); AVIVideoStream = NULL; } - + if(AVIStreamInterface) { AVIStreamRelease(AVIStreamInterface); AVIStreamInterface = NULL; } - + if(pfile) { AVIFileRelease(pfile); @@ -689,8 +685,7 @@ void AVIOutput_End(void) fclose (wavfile); wavfile = 0; } - - + LeaveCriticalSection(&AVIOutput_CriticalSection); } @@ -728,7 +723,7 @@ void AVIOutput_Begin(void) avioutput_enabled = avioutput_audio || avioutput_video; if(!avioutput_init || !avioutput_enabled) goto error; - + // delete any existing file before writing AVI SetFileAttributes(avioutput_filename, FILE_ATTRIBUTE_ARCHIVE); DeleteFile(avioutput_filename); @@ -771,46 +766,45 @@ void AVIOutput_Begin(void) //avistreaminfo.dwEditCount =; // Number of times the stream has been edited. The stream handler maintains this count. //avistreaminfo.dwFormatChangeCount =; // Number of times the stream format has changed. The stream handler maintains this count. strcpy(avistreaminfo.szName, "Audiostream"); // description of the stream. - - + // create the audio stream if((err = AVIFileCreateStream(pfile, &AVIAudioStream, &avistreaminfo)) != 0) { gui_message("AVIFileCreateStream() FAILED (%X)\n", err); goto error; } - + if((err = AVIStreamSetFormat(AVIAudioStream, 0, pwfxDst, sizeof(WAVEFORMATEX) + pwfxDst->cbSize)) != 0) { gui_message("AVIStreamSetFormat() FAILED (%X)\n", err); goto error; } - + if((err = acmStreamOpen(&has, NULL, &wfxSrc, pwfxDst, NULL, 0, 0, ACM_STREAMOPENF_NONREALTIME)) != 0) { gui_message("acmStreamOpen() FAILED (%X)\n", err); goto error; } } - + if(avioutput_video) { if(!(lpVideo = malloc(lpbi->biSizeImage))) { goto error; } - + // fill in the header for the video stream memset(&avistreaminfo, 0, sizeof(AVISTREAMINFO)); avistreaminfo.fccType = streamtypeVIDEO; // stream type - + // unsure about this, as this is the uncompressed stream, not the compressed stream //avistreaminfo.fccHandler = 0; - + // incase the amiga changes palette if(lpbi->biBitCount < 24) avistreaminfo.dwFlags = AVISTREAMINFO_FORMATCHANGES; - + //avistreaminfo.dwCaps =; // Capability flags; currently unused //avistreaminfo.wPriority =; // Priority of the stream //avistreaminfo.wLanguage =; // Language of the stream @@ -822,36 +816,36 @@ void AVIOutput_Begin(void) avistreaminfo.dwSuggestedBufferSize = lpbi->biSizeImage; avistreaminfo.dwQuality = -1; // drivers will use the default quality setting avistreaminfo.dwSampleSize = 0; // variable video data samples - + SetRect(&avistreaminfo.rcFrame, 0, 0, lpbi->biWidth, lpbi->biHeight); // rectangle for stream - + //avistreaminfo.dwEditCount =; // Number of times the stream has been edited. The stream handler maintains this count. //avistreaminfo.dwFormatChangeCount =; // Number of times the stream format has changed. The stream handler maintains this count. strcpy(avistreaminfo.szName, "Videostream"); // description of the stream. - + // create the stream if((err = AVIFileCreateStream(pfile, &AVIStreamInterface, &avistreaminfo)) != 0) { gui_message("AVIFileCreateStream() FAILED (%X)\n", err); goto error; } - + videoOptions.fccType = streamtypeVIDEO; videoOptions.fccHandler = pcompvars->fccHandler; videoOptions.dwKeyFrameEvery = pcompvars->lKey; videoOptions.dwQuality = pcompvars->lQ; - + videoOptions.dwBytesPerSecond = pcompvars->lDataRate * 1024; videoOptions.dwFlags = AVICOMPRESSF_VALID | AVICOMPRESSF_KEYFRAMES | AVICOMPRESSF_INTERLEAVE | AVICOMPRESSF_DATARATE; - + videoOptions.dwInterleaveEvery = 1; - + videoOptions.cbFormat = sizeof(BITMAPINFOHEADER); videoOptions.lpFormat = lpbi; - + videoOptions.cbParms = pcompvars->cbState; videoOptions.lpParms = pcompvars->lpState; - + // create a compressed stream from our uncompressed stream and a compression filter if((err = AVIMakeCompressedStream(&AVIVideoStream, AVIStreamInterface, &videoOptions, NULL)) != AVIERR_OK) { @@ -861,9 +855,8 @@ void AVIOutput_Begin(void) } write_log ("AVIOutput enabled: video=%d audio=%d\n", avioutput_video, avioutput_audio); return; - + error: - AVIOutput_End(); } @@ -873,20 +866,20 @@ void AVIOutput_Release(void) AVIOutput_ReleaseAudio(); AVIOutput_ReleaseVideo(); - + if(avioutput_init) { AVIFileExit(); avioutput_init = 0; } - + DeleteCriticalSection(&AVIOutput_CriticalSection); } void AVIOutput_Initialize(void) { InitializeCriticalSection(&AVIOutput_CriticalSection); - + if(!avioutput_init) { AVIFileInit(); @@ -911,7 +904,7 @@ void frame_drawn(void) if (avioutput_audio && (frame_count % avioutput_fps) == 0) { StreamSizeAudioExpected += currprefs.sound_freq; - diff = (StreamSizeAudio - StreamSizeAudioExpected) / sndbufsize; + diff = (StreamSizeAudio - StreamSizeAudioExpected) / sndbufsize; skipmode = pow (diff < 0 ? -diff : diff, EXP); if (diff < 0) skipmode = -skipmode; if (skipmode < -ADJUST_SIZE) skipmode = -ADJUST_SIZE; diff --git a/od-win32/blkdev_win32_aspi.c b/od-win32/blkdev_win32_aspi.c index f17937af..e431a910 100755 --- a/od-win32/blkdev_win32_aspi.c +++ b/od-win32/blkdev_win32_aspi.c @@ -48,8 +48,8 @@ static int unitcnt; static int ha_inquiry (SCSI *scgp, int id, SRB_HAInquiry *ip) { DWORD Status; - - ip->SRB_Cmd = SC_HA_INQUIRY; + + ip->SRB_Cmd = SC_HA_INQUIRY; ip->SRB_HaId = id; ip->SRB_Flags = 0; ip->SRB_Hdr_Rsvd = 0; @@ -59,17 +59,17 @@ static int ha_inquiry (SCSI *scgp, int id, SRB_HAInquiry *ip) write_log ("ASPI: S=%d ha=%d, ID=%d, M='%s', Id='%s'\n", Status, ip->HA_Count, ip->HA_SCSI_ID, ip->HA_ManagerId, ip->HA_Identifier); if (ip->SRB_Status != SS_COMP) - return -1; + return -1; return 0; } static int open_driver (SCSI *scgp) { char path[MAX_DPATH]; - DWORD astatus; - BYTE HACount; - BYTE ASPIStatus; - int i; + DWORD astatus; + BYTE HACount; + BYTE ASPIStatus; + int i; int nero; HKEY key; DWORD type = REG_SZ; @@ -105,7 +105,7 @@ static int open_driver (SCSI *scgp) */ if (hAspiLib == NULL) { write_log ("ASPI: failed to load wnaspi32.dll\n"); - return FALSE; + return FALSE; } /* * Get a pointer to GetASPI32SupportInfo function @@ -116,7 +116,7 @@ static int open_driver (SCSI *scgp) if ((pfnGetASPI32SupportInfo == NULL) || (pfnSendASPI32Command == NULL)) { write_log ("ASPI: obsolete wnaspi32.dll found\n"); - return FALSE; + return FALSE; } pfnGetASPI32Buffer = (BOOL(*)(PASPI32BUFF))GetProcAddress(hAspiLib, "GetASPI32Buffer"); @@ -136,7 +136,7 @@ static int open_driver (SCSI *scgp) write_log ("ASPI: open_driver %X HostASPIStatus=0x%x HACount=0x%x\n", astatus, ASPIStatus, HACount); if (ASPIStatus != SS_COMP && ASPIStatus != SS_NO_ADAPTERS) { - write_log ("ASPI: Could not find any host adapters, ASPIStatus == 0x%02X\n", ASPIStatus); + write_log ("ASPI: Could not find any host adapters, ASPIStatus == 0x%02X\n", ASPIStatus); return FALSE; } busses = HACount; @@ -144,7 +144,7 @@ static int open_driver (SCSI *scgp) write_log ("ASPI: open_driver HostASPIStatus=0x%x HACount=0x%x\n", ASPIStatus, HACount); for (i=0; i < busses; i++) { - SRB_HAInquiry s; + SRB_HAInquiry s; ha_inquiry(scgp, i, &s); } return TRUE; @@ -154,11 +154,11 @@ static int open_driver (SCSI *scgp) static void close_driver (void) { if (!AspiLoaded) return; - AspiLoaded = FALSE; + AspiLoaded = FALSE; pfnGetASPI32SupportInfo = NULL; pfnSendASPI32Command = NULL; - pfnGetASPI32Buffer = NULL; - pfnFreeASPI32Buffer = NULL; + pfnGetASPI32Buffer = NULL; + pfnFreeASPI32Buffer = NULL; pfnTranslateASPI32Address = NULL; FreeLibrary(hAspiLib); hAspiLib = NULL; @@ -186,19 +186,19 @@ static void *scgo_getbuf (SCSI *scgp, long amt) static void scsi_sfree (SCSI *scgp) { if (scgp->cmdstart) - free(scgp->cmdstart); + free(scgp->cmdstart); if (scgp->cmdstop) - free(scgp->cmdstop); + free(scgp->cmdstop); if (scgp->scmd) - free(scgp->scmd); + free(scgp->scmd); if (scgp->inq) - free(scgp->inq); + free(scgp->inq); if (scgp->cap) - free(scgp->cap); + free(scgp->cap); if (scgp->local) - free(scgp->local); + free(scgp->local); if (scgp->errstr) - free(scgp->errstr); + free(scgp->errstr); free(scgp); } @@ -208,7 +208,7 @@ static SCSI *scsi_smalloc(void) scgp = (SCSI *)malloc(sizeof(*scgp)); if (scgp == NULL) - return 0; + return 0; memset (scgp, 0, sizeof (*scgp)); scgp->deftimeout = 20; @@ -216,7 +216,7 @@ static SCSI *scsi_smalloc(void) scgp->cmdstart = (struct timeval *)malloc(sizeof(struct timeval)); if (scgp->cmdstart == NULL) - goto err; + goto err; scgp->cmdstop = (struct timeval *)malloc(sizeof(struct timeval)); if (scgp->cmdstop == NULL) goto err; @@ -240,21 +240,21 @@ err: return 0; } -#define MAX_SCG 16 /* Max # of SCSI controllers */ -#define MAX_TGT 16 /* Max # of SCSI Targets */ -#define MAX_LUN 8 /* Max # of SCSI LUNs */ +#define MAX_SCG 16 /* Max # of SCSI controllers */ +#define MAX_TGT 16 /* Max # of SCSI Targets */ +#define MAX_LUN 8 /* Max # of SCSI LUNs */ struct scg_local { int dummy; }; -#define scglocal(p) ((struct scg_local *)((p)->local)) +#define scglocal(p) ((struct scg_local *)((p)->local)) static SCSI *openscsi (int busno, int tgt, int tlun) { SCSI *scgp = scsi_smalloc (); if (busno >= MAX_SCG || tgt >= MAX_TGT || tlun >= MAX_LUN) { - errno = EINVAL; + errno = EINVAL; if (log_scsi) write_log ("ASPI: Illegal value for busno, target or lun '%d,%d,%d'\n", busno, tgt, tlun); return 0; @@ -263,13 +263,13 @@ static SCSI *openscsi (int busno, int tgt, int tlun) * Check if variables are within the range */ if (tgt >= 0 && tgt >= 0 && tlun >= 0) { - /* - * This is the non -scanbus case. - */ + /* + * This is the non -scanbus case. + */ ; } else if (tgt != -1 || tgt != -1 || tlun != -1) { - errno = EINVAL; - return 0; + errno = EINVAL; + return 0; } if (scgp->local == NULL) { scgp->local = malloc(sizeof(struct scg_local)); @@ -285,7 +285,7 @@ static SCSI *openscsi (int busno, int tgt, int tlun) * More than we have ... */ if (busno >= busses) { - close_driver (); + close_driver (); return 0; } return scgp; @@ -305,13 +305,13 @@ static void scsi_debug (SCSI *scgp, SRB_ExecSCSICmd *s) write_log ("ASPI EXEC_SCSI: bus=%d,target=%d,lun=%d\n", s->SRB_HaId, s->SRB_Target, s->SRB_Lun); scsi_log_before (scgp->scmd->cdb.cmd_cdb, scgp->scmd->cdb_len, - (s->SRB_Flags & SRB_DIR_OUT) ? s->SRB_BufPointer : 0, s->SRB_BufLen); + (s->SRB_Flags & SRB_DIR_OUT) ? s->SRB_BufPointer : 0, s->SRB_BufLen); } -static void copy_sensedata(SRB_ExecSCSICmd *cp, struct scg_cmd *sp) +static void copy_sensedata(SRB_ExecSCSICmd *cp, struct scg_cmd *sp) { - sp->sense_count = cp->SRB_SenseLen; + sp->sense_count = cp->SRB_SenseLen; if (sp->sense_count > sp->sense_len) sp->sense_count = sp->sense_len; memset(&sp->u_sense.Sense, 0x00, sizeof(sp->u_sense.Sense)); @@ -395,7 +395,7 @@ static int scsiabort(SCSI *scgp, SRB_ExecSCSICmd *sp) s.SRB_Cmd = SC_ABORT_SRB; /* ASPI command code = SC_ABORT_SRB */ s.SRB_HaId = scg_scsibus(scgp); /* ASPI host adapter number */ s.SRB_Flags = 0; /* Flags */ - s.SRB_ToAbort = (LPSRB)&sp; /* sp */ + s.SRB_ToAbort = (LPSRB)&sp; /* sp */ /* * Initiate SCSI abort */ @@ -438,11 +438,11 @@ static int scsicmd(SCSI *scgp) * Check cbd_len > the maximum command pakket that can be handled by ASPI */ if (sp->cdb_len > 16) { - sp->error = SCG_FATAL; - sp->ux_errno = EINVAL; + sp->error = SCG_FATAL; + sp->ux_errno = EINVAL; if (log_scsi) write_log ("ASPI: sp->cdb_len > sizeof(SRB_ExecSCSICmd.CDBByte). Fatal error in scgo_send, exiting...\n"); - return -1; + return -1; } /* * copy command into SRB @@ -454,16 +454,16 @@ static int scsicmd(SCSI *scgp) /* * Fill ASPI structure */ - s.SRB_Cmd = SC_EXEC_SCSI_CMD; /* SCSI Command */ - s.SRB_HaId = scg_scsibus(scgp); /* Host adapter number */ - s.SRB_Flags = SRB_EVENT_NOTIFY; /* Flags */ - s.SRB_Target = scg_target(scgp); /* Target SCSI ID */ - s.SRB_Lun = scg_lun(scgp); /* Target SCSI LUN */ - s.SRB_BufLen = sp->size; /* # of bytes transferred */ - s.SRB_BufPointer= sp->addr; /* pointer to data buffer */ - s.SRB_CDBLen = sp->cdb_len; /* SCSI command length */ - s.SRB_PostProc = Event; /* Post proc event */ - s.SRB_SenseLen = SENSE_LEN; /* Lenght of sense buffer */ + s.SRB_Cmd = SC_EXEC_SCSI_CMD; /* SCSI Command */ + s.SRB_HaId = scg_scsibus(scgp); /* Host adapter number */ + s.SRB_Flags = SRB_EVENT_NOTIFY; /* Flags */ + s.SRB_Target = scg_target(scgp); /* Target SCSI ID */ + s.SRB_Lun = scg_lun(scgp); /* Target SCSI LUN */ + s.SRB_BufLen = sp->size; /* # of bytes transferred */ + s.SRB_BufPointer= sp->addr; /* pointer to data buffer */ + s.SRB_CDBLen = sp->cdb_len; /* SCSI command length */ + s.SRB_PostProc = Event; /* Post proc event */ + s.SRB_SenseLen = SENSE_LEN; /* Lenght of sense buffer */ /* * Do we receive data from this ASPI command? @@ -471,11 +471,11 @@ static int scsicmd(SCSI *scgp) if (sp->flags & SCG_RECV_DATA) { s.SRB_Flags |= SRB_DIR_IN; } else { - /* - * Set direction to output - */ - if (sp->size > 0) - s.SRB_Flags |= SRB_DIR_OUT; + /* + * Set direction to output + */ + if (sp->size > 0) + s.SRB_Flags |= SRB_DIR_OUT; } scsi_debug (scgp,&s); @@ -488,18 +488,18 @@ static int scsicmd(SCSI *scgp) Status = pfnSendASPI32Command((LPSRB)&s);/* Initiate SCSI command */ if (Status == SS_PENDING) { /* If in progress */ - /* - * Wait until command completes, or times out. - */ - EventStatus = WaitForSingleObject(Event, sp->timeout * 1000); + /* + * Wait until command completes, or times out. + */ + EventStatus = WaitForSingleObject(Event, sp->timeout * 1000); if (EventStatus == WAIT_OBJECT_0) - ResetEvent(Event); /* Clear event, time out */ + ResetEvent(Event); /* Clear event, time out */ if (s.SRB_Status == SS_PENDING) {/* Check if we got a timeout*/ scsiabort(scgp, &s); - ResetEvent(Event); /* Clear event, time out */ - CloseHandle(Event); /* Close the event handle */ + ResetEvent(Event); /* Clear event, time out */ + CloseHandle(Event); /* Close the event handle */ sp->error = SCG_TIMEOUT; - return 1; /* Return error */ + return 1; /* Return error */ } } CloseHandle (Event); /* Close the event handle */ @@ -513,7 +513,7 @@ static int scsicmd(SCSI *scgp) sp->u_sense.cmd_sense, sp->sense_len); if (s.SRB_Status != SS_COMP) { - if (log_scsi && s.SRB_Status != 0x82) + if (log_scsi && s.SRB_Status != 0x82) write_log ("ASPI: Error in scgo_send: s.SRB_Status is 0x%x\n", s.SRB_Status); set_error(&s, sp); /* Set error flags */ copy_sensedata(&s, sp); /* Copy sense and status */ @@ -544,7 +544,7 @@ static int inquiry (SCSI *scgp, void *bp, int cnt) scmd->cdb.g0_cdb.count = cnt; scgp->scmd->timeout = 10 * 60; if (scsicmd(scgp)) - return -1; + return -1; return 0; } @@ -554,7 +554,7 @@ static int scsierr(SCSI *scgp) if(cp->error != SCG_NO_ERROR || cp->ux_errno != 0 || *(u_char *)&cp->scb != 0) - return -1; + return -1; return 0; } @@ -564,15 +564,15 @@ static void scan_scsi_bus (SCSI *scgp, int flags) write_log ("ASPI: SCSI scan starting..\n"); scanphase = 1; for (scgp->addr.scsibus=0; scgp->addr.scsibus < 8; scgp->addr.scsibus++) { - if (!scsi_havebus(scgp, scgp->addr.scsibus)) - continue; - for (scgp->addr.target=0; scgp->addr.target < 16; scgp->addr.target++) { - struct scsi_inquiry inq; - scgp->addr.lun = 0; - if (inquiry (scgp, &inq, sizeof(inq))) - continue; - for (scgp->addr.lun=0; scgp->addr.lun < 8; scgp->addr.lun++) { - if (!inquiry (scgp, &inq, sizeof(inq))) { + if (!scsi_havebus(scgp, scgp->addr.scsibus)) + continue; + for (scgp->addr.target=0; scgp->addr.target < 16; scgp->addr.target++) { + struct scsi_inquiry inq; + scgp->addr.lun = 0; + if (inquiry (scgp, &inq, sizeof(inq))) + continue; + for (scgp->addr.lun=0; scgp->addr.lun < 8; scgp->addr.lun++) { + if (!inquiry (scgp, &inq, sizeof(inq))) { write_log ("ASPI: %d:%d:%d ", scgp->addr.scsibus,scgp->addr.target,scgp->addr.lun); write_log ("'%.8s' ", inq.vendor_info); write_log ("'%.16s' ", inq.prod_ident); @@ -608,8 +608,8 @@ static void scan_scsi_bus (SCSI *scgp, int flags) } write_log ("\n"); } - } - } + } + } } write_log ("ASPI: SCSI scan ended\n"); scanphase = 0; @@ -683,7 +683,7 @@ static int open_scsi_bus (int flags) unitcnt = 0; if (scgp) { scan_scsi_bus (scgp, flags); - uae_sem_init (&scgp_sem, 0, 1); + uae_sem_init (&scgp_sem, 0, 1); } scsi_handle = scgp; return scgp ? 1 : 0; @@ -746,7 +746,7 @@ static int execscsicmd_direct (int unitnum, uaecptr acmd) /* do transfer directly to and from Amiga memory */ if (!bank_data || !bank_data->check (scsi_data, scsi_len)) - return -5; /* IOERR_BADADDRESS */ + return -5; /* IOERR_BADADDRESS */ uae_sem_wait (&scgp_sem); @@ -758,15 +758,15 @@ static int execscsicmd_direct (int unitnum, uaecptr acmd) scmd->cdb.cmd_cdb[i] = get_byte (scsi_cmd + i); scmd->target = si[unitnum].target; scmd->sense_len = (scsi_flags & 4) ? 4 : /* SCSIF_OLDAUTOSENSE */ - (scsi_flags & 2) ? scsi_sense_len : /* SCSIF_AUTOSENSE */ - -1; + (scsi_flags & 2) ? scsi_sense_len : /* SCSIF_AUTOSENSE */ + -1; scmd->sense_count = 0; scmd->u_scb.cmd_scb[0] = 0; scgp->addr.scsibus = si[unitnum].scsibus; scgp->addr.target = si[unitnum].target; scgp->addr.lun = si[unitnum].lun; if (si[unitnum].isatapi) - scsi_atapi_fixup_pre (scmd->cdb.cmd_cdb, &scsi_cmd_len, &scsi_datap, &scsi_len, &parm); + scsi_atapi_fixup_pre (scmd->cdb.cmd_cdb, &scsi_cmd_len, &scsi_datap, &scsi_len, &parm); scmd->addr = scsi_datap; scmd->size = scsi_len; scmd->cdb_len = scsi_cmd_len; @@ -777,25 +777,25 @@ static int execscsicmd_direct (int unitnum, uaecptr acmd) put_word (acmd + 18, scmd->error == SCG_FATAL ? 0 : scsi_cmd_len_org); /* fake scsi_CmdActual */ put_byte (acmd + 21, scmd->u_scb.cmd_scb[0]); /* scsi_Status */ if (scmd->u_scb.cmd_scb[0]) { - io_error = 45; /* HFERR_BadStatus */ - /* copy sense? */ - for (sactual = 0; scsi_sense && sactual < scsi_sense_len && sactual < scmd->sense_count; sactual++) - put_byte (scsi_sense + sactual, scmd->u_sense.cmd_sense[sactual]); - put_long (acmd + 8, 0); /* scsi_Actual */ + io_error = 45; /* HFERR_BadStatus */ + /* copy sense? */ + for (sactual = 0; scsi_sense && sactual < scsi_sense_len && sactual < scmd->sense_count; sactual++) + put_byte (scsi_sense + sactual, scmd->u_sense.cmd_sense[sactual]); + put_long (acmd + 8, 0); /* scsi_Actual */ } else { - int i; - for (i = 0; i < scsi_sense_len; i++) - put_byte (scsi_sense + i, 0); - sactual = 0; - if (scmd->error != SCG_NO_ERROR) { + int i; + for (i = 0; i < scsi_sense_len; i++) + put_byte (scsi_sense + i, 0); + sactual = 0; + if (scmd->error != SCG_NO_ERROR) { io_error = 20; /* io_Error, but not specified */ put_long (acmd + 8, 0); /* scsi_Actual */ - } else { + } else { io_error = 0; if (si[unitnum].isatapi) scsi_atapi_fixup_post (scmd->cdb.cmd_cdb, scsi_cmd_len, scsi_datap_org, scsi_datap, &scsi_len, parm); - put_long (acmd + 8, scsi_len - scmd->resid); /* scsi_Actual */ - } + put_long (acmd + 8, scsi_len - scmd->resid); /* scsi_Actual */ + } } put_word (acmd + 28, sactual); diff --git a/od-win32/blkdev_win32_ioctl.c b/od-win32/blkdev_win32_ioctl.c index 9f908bfd..620d8134 100755 --- a/od-win32/blkdev_win32_ioctl.c +++ b/od-win32/blkdev_win32_ioctl.c @@ -81,14 +81,14 @@ static int ioctl_command_pause (int unitnum, int paused) int cnt = 3; while (cnt-- > 0) { - seterrormode (); + seterrormode (); if (!DeviceIoControl(ciw32[unitnum].h, command, NULL, 0, NULL, 0, &len, NULL)) { reseterrormode (); if (win32_error (unitnum, paused ? "IOCTL_CDROM_PAUSE_AUDIO" : "IOCTL_CDROM_RESUME_AUDIO") < 0) continue; return 0; } - reseterrormode (); + reseterrormode (); break; } return 1; @@ -101,7 +101,7 @@ static int ioctl_command_stop (int unitnum) int cnt = 3; while (cnt-- > 0) { - seterrormode (); + seterrormode (); if(!DeviceIoControl(ciw32[unitnum].h, IOCTL_CDROM_STOP_AUDIO, NULL, 0, NULL, 0, &len, NULL)) { reseterrormode (); if (win32_error (unitnum, "IOCTL_CDROM_STOP_AUDIO") < 0) @@ -192,7 +192,7 @@ static uae_u8 *ioctl_command_read (int unitnum, int sector) continue; return 0; } - reseterrormode (); + reseterrormode (); break; } cnt = 3; @@ -223,18 +223,18 @@ static int fetch_geometry (int unitnum, struct device_info *di) int cnt = 3; while (cnt-- > 0) { - seterrormode (); + seterrormode (); if (!DeviceIoControl(ciw32[unitnum].h, IOCTL_CDROM_GET_DRIVE_GEOMETRY, NULL, 0, &geom, sizeof(geom), &len, NULL)) { reseterrormode (); if (win32_error (unitnum, "IOCTL_CDROM_GET_DRIVE_GEOMETRY") < 0) continue; return 0; } - reseterrormode (); + reseterrormode (); break; } if (di) { - di->cylinders = geom.Cylinders.LowPart; + di->cylinders = geom.Cylinders.LowPart; di->sectorspertrack = geom.SectorsPerTrack; di->trackspercylinder = geom.TracksPerCylinder; di->bytespersector = geom.BytesPerSector; @@ -254,14 +254,14 @@ static uae_u8 *ioctl_command_toc (int unitnum) gui_cd_led (1); while (cnt-- > 0) { - seterrormode (); + seterrormode (); if (!DeviceIoControl(ciw32[unitnum].h, IOCTL_CDROM_READ_TOC, NULL, 0, &toc, sizeof(toc), &len, NULL)) { reseterrormode (); if (win32_error (unitnum, "IOCTL_CDROM_READ_TOC") < 0) continue; return 0; } - reseterrormode (); + reseterrormode (); break; } @@ -322,8 +322,8 @@ static int sys_cddev_open (int unitnum) ciw->h = CreateFile(ciw->devname, flags, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (ciw->h == INVALID_HANDLE_VALUE) { flags |= GENERIC_WRITE; - ciw->h = CreateFile(ciw->devname, flags, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (ciw->h == INVALID_HANDLE_VALUE) { + ciw->h = CreateFile(ciw->devname, flags, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (ciw->h == INVALID_HANDLE_VALUE) { write_log ("IOCTL: failed to open device handle (%s)\n", ciw->devname); goto error; } @@ -405,7 +405,7 @@ static int open_bus (int flags) if (log_scsi) write_log ("IOCTL: drive %c type %d\n", drive, dt); if (((flags & (1 << INQ_ROMD)) && dt == DRIVE_CDROM) || ((flags & (1 << INQ_DASD)) && dt == DRIVE_FIXED)) { - if (log_scsi) + if (log_scsi) write_log ("IOCTL: drive %c: = unit %d\n", drive, total_devices); ciw32[total_devices].drvletter = drive; ciw32[total_devices].type = dt; diff --git a/od-win32/blkdev_win32_spti.c b/od-win32/blkdev_win32_spti.c index aff70688..9104c511 100755 --- a/od-win32/blkdev_win32_spti.c +++ b/od-win32/blkdev_win32_spti.c @@ -63,7 +63,7 @@ static int doscsi (HANDLE *h, SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER *swb, int *er if (!status) { int lasterror = GetLastError(); *err = lasterror; - write_log("SCSI ERROR, H=%X: ", h); + write_log("SCSI ERROR, H=%X: ", h); write_log("Error code = %d, LastError=%d\n", swb->spt.ScsiStatus, lasterror); scsi_log_before (swb->spt.Cdb, swb->spt.CdbLength, swb->spt.DataIn == SCSI_IOCTL_DATA_OUT ? swb->spt.DataBuffer : 0,swb->spt.DataTransferLength); @@ -138,7 +138,7 @@ static int execscsicmd_direct (int unitnum, uaecptr acmd) /* do transfer directly to and from Amiga memory */ if (!bank_data || !bank_data->check (scsi_data, scsi_len)) - return -5; /* IOERR_BADADDRESS */ + return -5; /* IOERR_BADADDRESS */ uae_sem_wait (&scgp_sem); @@ -151,10 +151,10 @@ static int execscsicmd_direct (int unitnum, uaecptr acmd) if (scsi_sense_len > 32) scsi_sense_len = 32; swb.spt.SenseInfoLength = (scsi_flags & 4) ? 4 : /* SCSIF_OLDAUTOSENSE */ - (scsi_flags & 2) ? scsi_sense_len : /* SCSIF_AUTOSENSE */ - 32; + (scsi_flags & 2) ? scsi_sense_len : /* SCSIF_AUTOSENSE */ + 32; if (dev_info[unitnum].isatapi) - scsi_atapi_fixup_pre (swb.spt.Cdb, &scsi_cmd_len, &scsi_datap, &scsi_len, &parm); + scsi_atapi_fixup_pre (swb.spt.Cdb, &scsi_cmd_len, &scsi_datap, &scsi_len, &parm); swb.spt.CdbLength = (UCHAR)scsi_cmd_len; swb.spt.DataTransferLength = scsi_len; swb.spt.DataBuffer = scsi_datap; @@ -164,26 +164,26 @@ static int execscsicmd_direct (int unitnum, uaecptr acmd) put_word (acmd + 18, status == 0 ? 0 : scsi_cmd_len_orig); /* fake scsi_CmdActual */ put_byte (acmd + 21, swb.spt.ScsiStatus); /* scsi_Status */ if (swb.spt.ScsiStatus) { - io_error = 45; /* HFERR_BadStatus */ - /* copy sense? */ - for (sactual = 0; scsi_sense && sactual < scsi_sense_len && sactual < swb.spt.SenseInfoLength; sactual++) - put_byte (scsi_sense + sactual, swb.SenseBuf[sactual]); - put_long (acmd + 8, 0); /* scsi_Actual */ + io_error = 45; /* HFERR_BadStatus */ + /* copy sense? */ + for (sactual = 0; scsi_sense && sactual < scsi_sense_len && sactual < swb.spt.SenseInfoLength; sactual++) + put_byte (scsi_sense + sactual, swb.SenseBuf[sactual]); + put_long (acmd + 8, 0); /* scsi_Actual */ } else { - int i; - for (i = 0; i < scsi_sense_len; i++) - put_byte (scsi_sense + i, 0); - sactual = 0; - if (status == 0) { + int i; + for (i = 0; i < scsi_sense_len; i++) + put_byte (scsi_sense + i, 0); + sactual = 0; + if (status == 0) { io_error = 20; /* io_Error, but not specified */ put_long (acmd + 8, 0); /* scsi_Actual */ - } else { + } else { scsi_len = swb.spt.DataTransferLength; if (dev_info[unitnum].isatapi) scsi_atapi_fixup_post (swb.spt.Cdb, scsi_cmd_len, scsi_datap_org, scsi_datap, &scsi_len, parm); io_error = 0; - put_long (acmd + 8, scsi_len); /* scsi_Actual */ - } + put_long (acmd + 8, scsi_len); /* scsi_Actual */ + } } put_word (acmd + 28, sactual); uae_sem_post (&scgp_sem); @@ -315,14 +315,14 @@ int open_scsi_device (int unitnum) h = CreateFile(dev,GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,0,NULL); dev_info[unitnum].handle = h; if (h == INVALID_HANDLE_VALUE) { - write_log ("failed to open cd unit %d (%s)\n", unitnum, dev); + write_log ("failed to open cd unit %d (%s)\n", unitnum, dev); } else { - dev_info[unitnum].mediainserted = mediacheck (unitnum); + dev_info[unitnum].mediainserted = mediacheck (unitnum); dev_info[unitnum].isatapi = isatapi (unitnum); write_log ("cd unit %d %s opened (%s), %s\n", unitnum, dev_info[unitnum].isatapi ? "[ATAPI]" : "[SCSI]", dev, dev_info[unitnum].mediainserted ? "CD inserted" : "Drive empty"); - return 1; + return 1; } return 0; } diff --git a/od-win32/bsdsock.c b/od-win32/bsdsock.c index 6e4663d9..16e0b58e 100755 --- a/od-win32/bsdsock.c +++ b/od-win32/bsdsock.c @@ -46,8 +46,10 @@ static CRITICAL_SECTION csSigQueueLock; static DWORD threadid; #ifdef __GNUC__ #define THREAD(func,arg) CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)func,(LPVOID)arg,0,&threadid) +#define THREADEND() #else #define THREAD(func,arg) (HANDLE)_beginthreadex(NULL, 0, func, arg, 0, &threadid) +#define THREADEND(result) _endthreadex(result) #endif #define SETERRNO seterrno(sb,WSAGetLastError()-WSABASEERR) @@ -57,8 +59,8 @@ static DWORD threadid; #define SETSIGNAL addtosigqueue(sb,0) #define CANCELSIGNAL cancelsig(sb) -#define FIOSETOWN _IOW('f', 124, long) /* set owner (struct Task *) */ -#define FIOGETOWN _IOR('f', 123, long) /* get owner (struct Task *) */ +#define FIOSETOWN _IOW('f', 124, long) /* set owner (struct Task *) */ +#define FIOGETOWN _IOR('f', 123, long) /* get owner (struct Task *) */ #define BEGINBLOCKING if (sb->ftable[sd-1] & SF_BLOCKING) sb->ftable[sd-1] |= SF_BLOCKINGINPROGRESS #define ENDBLOCKING sb->ftable[sd-1] &= ~SF_BLOCKINGINPROGRESS @@ -113,7 +115,7 @@ static CRITICAL_SECTION SockThreadCS; #define SF_RAW_RUDP 0x08000000 #define SF_RAW_RICMP 0x04000000 -typedef struct ip_option_information { +typedef struct ip_option_information { u_char Ttl; /* Time To Live (used for traceroute) */ u_char Tos; /* Type Of Service (usually 0) */ u_char Flags; /* IP header flags (usually 0) */ @@ -158,7 +160,7 @@ static int mySockStartup( void ) } else { - write_log( "BSDSOCK: using %s\n", wsbData.szDescription ); + write_log( "BSDSOCK: using %s\n", wsbData.szDescription ); // make sure WSP/NSPStartup gets called from within the regular stack // (Windows 95/98 need this) if((dummy = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP)) != INVALID_SOCKET) @@ -415,7 +417,7 @@ void sockmsg(unsigned int msg, WPARAM wParam, LPARAM lParam) unlocksigqueue(); } -static unsigned int allocasyncmsg(SB,uae_u32 sd,SOCKET s) +static unsigned int allocasyncmsg(SB,uae_u32 sd,SOCKET s) { int i; locksigqueue(); @@ -467,7 +469,7 @@ static void cancelasyncmsg(unsigned int wMsg) } void sockabort(SB) -{ +{ locksigqueue(); unlocksigqueue(); @@ -539,7 +541,7 @@ int host_dup2socket(SB, int fd1, int fd2) s2 = getsock(sb,fd2); if (s2 != INVALID_SOCKET) { - shutdown(s2,1); + shutdown(s2,1); closesocket(s2); } setsd(sb,fd2,s1); @@ -573,9 +575,9 @@ int host_socket(SB, int af, int type, int protocol) return -1; } else - sd = getsd(sb,(int)s); + sd = getsd(sb,(int)s); - sb->ftable[sd-1] = SF_BLOCKING; + sb->ftable[sd-1] = SF_BLOCKING; ioctlsocket(s,FIONBIO,&nonblocking); TRACE(("%d\n",sd)); @@ -583,7 +585,7 @@ int host_socket(SB, int af, int type, int protocol) { if (protocol==IPPROTO_UDP) { - sb->ftable[sd-1] |= SF_RAW_UDP; + sb->ftable[sd-1] |= SF_RAW_UDP; } if (protocol==IPPROTO_ICMP) { @@ -593,7 +595,7 @@ int host_socket(SB, int af, int type, int protocol) sin.sin_addr.s_addr = INADDR_ANY; bind(s,(struct sockaddr *)&sin,sizeof(sin)) ; } - if (protocol==IPPROTO_RAW) + if (protocol==IPPROTO_RAW) { sb->ftable[sd-1] |= SF_RAW_RAW; } @@ -639,7 +641,7 @@ uae_u32 host_listen(SB, uae_u32 sd, uae_u32 backlog) { SOCKET s; uae_u32 success = -1; - + sd++; TRACE(("listen(%d,%d) -> ",sd,backlog)); s = getsock(sb, sd); @@ -654,14 +656,13 @@ uae_u32 host_listen(SB, uae_u32 sd, uae_u32 backlog) else TRACE(("OK\n")); } - return success; } void host_accept(SB, uae_u32 sd, uae_u32 name, uae_u32 namelen) { struct sockaddr *rp_name,*rp_nameuae; - struct sockaddr sockaddr; + struct sockaddr sockaddr; int hlen,hlenuae=0; SOCKET s, s2; int success = 0; @@ -793,35 +794,35 @@ struct threadsock_packet threadsock_e packet_type; union { - struct sendto_params - { - char *buf; - char *realpt; - uae_u32 sd; - uae_u32 msg; - uae_u32 len; - uae_u32 flags; - uae_u32 to; - uae_u32 tolen; - } sendto_s; - struct recvfrom_params - { - char *realpt; - uae_u32 addr; - uae_u32 len; - uae_u32 flags; - struct sockaddr *rp_addr; - int *hlen; - } recvfrom_s; - struct connect_params - { - char *buf; - uae_u32 namelen; - } connect_s; - struct abort_params - { - SOCKET *newsock; - } abort_s; + struct sendto_params + { + char *buf; + char *realpt; + uae_u32 sd; + uae_u32 msg; + uae_u32 len; + uae_u32 flags; + uae_u32 to; + uae_u32 tolen; + } sendto_s; + struct recvfrom_params + { + char *realpt; + uae_u32 addr; + uae_u32 len; + uae_u32 flags; + struct sockaddr *rp_addr; + int *hlen; + } recvfrom_s; + struct connect_params + { + char *buf; + uae_u32 namelen; + } connect_s; + struct abort_params + { + SOCKET *newsock; + } abort_s; } params; SOCKET s; SB; @@ -840,7 +841,7 @@ BOOL HandleStuff( void ) switch( sockreq.packet_type ) { case connect_req: - sockreq.sb->resultval = connect(sockreq.s,(struct sockaddr *)(sockreq.params.connect_s.buf),sockreq.params.connect_s.namelen); + sockreq.sb->resultval = connect(sockreq.s,(struct sockaddr *)(sockreq.params.connect_s.buf),sockreq.params.connect_s.namelen); break; case sendto_req: if( sockreq.params.sendto_s.to ) @@ -899,15 +900,15 @@ BOOL HandleStuff( void ) return quit; } -static LRESULT CALLBACK SocketWindowProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ) +static LRESULT CALLBACK SocketWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { if( message >= 0xB000 && message < 0xB000+MAXPENDINGASYNC*2 ) { #if DEBUG_SOCKETS - write_log( "sockmsg(0x%x, 0x%x, 0x%x)\n", message, wParam, lParam ); + write_log( "sockmsg(0x%x, 0x%x, 0x%x)\n", message, wParam, lParam ); #endif - sockmsg( message, wParam, lParam ); - return 0; + sockmsg( message, wParam, lParam ); + return 0; } return DefWindowProc( hwnd, message, wParam, lParam ); } @@ -917,7 +918,7 @@ static LRESULT CALLBACK SocketWindowProc( HWND hwnd, UINT message, WPARAM wParam static unsigned int __stdcall sock_thread(void *blah) { unsigned int result = 0; - HANDLE WaitHandle; + HANDLE WaitHandle; MSG msg; if( hSockWnd ) @@ -927,7 +928,7 @@ static unsigned int __stdcall sock_thread(void *blah) if (!os_winnt) { pri = priorities[currprefs.win32_active_priority].value; if (pri == THREAD_PRIORITY_HIGHEST) - pri = THREAD_PRIORITY_TIME_CRITICAL; + pri = THREAD_PRIORITY_TIME_CRITICAL; else pri++; } @@ -958,9 +959,7 @@ static unsigned int __stdcall sock_thread(void *blah) } } write_log( "BSDSOCK: We have exited our sock_thread()\n" ); -#ifndef __GNUC__ - _endthreadex( result ); -#endif + THREADEND(result); return result; } @@ -1047,9 +1046,9 @@ void host_connect(SB, uae_u32 sd, uae_u32 name, uae_u32 namelen) setWSAAsyncSelect(sb,sd,s,0); } } - } - else - write_log("BSDSOCK: WARNING - Excessive namelen (%d) in connect()!\n",namelen); + } + else + write_log("BSDSOCK: WARNING - Excessive namelen (%d) in connect()!\n",namelen); } TRACE(("%d\n",sb->sb_errno)); } @@ -1060,7 +1059,7 @@ void host_sendto(SB, uae_u32 sd, uae_u32 msg, uae_u32 len, uae_u32 flags, uae_u3 char *realpt; unsigned int wMsg; char buf[MAXADDRLEN]; - int iCut; + int iCut; #ifdef TRACING_ENABLED if (to) @@ -1073,7 +1072,7 @@ void host_sendto(SB, uae_u32 sd, uae_u32 msg, uae_u32 len, uae_u32 flags, uae_u3 if (s != INVALID_SOCKET) { - realpt = get_real_address(msg); + realpt = get_real_address(msg); if (to) { @@ -1142,7 +1141,7 @@ void host_sendto(SB, uae_u32 sd, uae_u32 msg, uae_u32 len, uae_u32 flags, uae_u3 if (sb->ftable[sd-1]&SF_RAW_UDP) { *(buf+2) = *(realpt+2); - *(buf+3) = *(realpt+3); + *(buf+3) = *(realpt+3); // Copy DST-Port iCut = 8; sockreq.params.sendto_s.realpt += iCut; @@ -1154,7 +1153,7 @@ void host_sendto(SB, uae_u32 sd, uae_u32 msg, uae_u32 len, uae_u32 flags, uae_u3 iTTL = (int) *(realpt+8)&0xff; setsockopt(s,IPPROTO_IP,4,(char*) &iTTL,sizeof(iTTL)); *(buf+2) = *(realpt+22); - *(buf+3) = *(realpt+23); + *(buf+3) = *(realpt+23); // Copy DST-Port iCut = 28; sockreq.params.sendto_s.realpt += iCut; @@ -1266,19 +1265,19 @@ void host_recvfrom(SB, uae_u32 sd, uae_u32 msg, uae_u32 len, uae_u32 flags, uae_ for (;;) { - PREPARE_THREAD; - - sockreq.packet_type = recvfrom_req; - sockreq.s = s; - sockreq.sb = sb; - sockreq.params.recvfrom_s.addr = addr; - sockreq.params.recvfrom_s.flags = flags; - sockreq.params.recvfrom_s.hlen = &hlen; - sockreq.params.recvfrom_s.len = len; - sockreq.params.recvfrom_s.realpt = realpt; - sockreq.params.recvfrom_s.rp_addr = rp_addr; - - TRIGGER_THREAD; + PREPARE_THREAD; + + sockreq.packet_type = recvfrom_req; + sockreq.s = s; + sockreq.sb = sb; + sockreq.params.recvfrom_s.addr = addr; + sockreq.params.recvfrom_s.flags = flags; + sockreq.params.recvfrom_s.hlen = &hlen; + sockreq.params.recvfrom_s.len = len; + sockreq.params.recvfrom_s.realpt = realpt; + sockreq.params.recvfrom_s.rp_addr = rp_addr; + + TRIGGER_THREAD; if (sb->resultval == -1) { if (sb->sb_errno == WSAEWOULDBLOCK-WSABASEERR && sb->ftable[sd-1] & SF_BLOCKING) @@ -1359,7 +1358,7 @@ uae_u32 host_shutdown(SB, uae_u32 sd, uae_u32 how) return 0; } } - + return -1; } @@ -1369,7 +1368,7 @@ void host_setsockopt(SB, uae_u32 sd, uae_u32 level, uae_u32 optname, uae_u32 opt char buf[MAXADDRLEN]; TRACE(("setsockopt(%d,%d,0x%lx,0x%lx,%d) -> ",sd,(short)level,optname,optval,len)); - sd++; + sd++; s = getsock(sb,sd); if (s != INVALID_SOCKET) @@ -1457,7 +1456,7 @@ uae_u32 host_getsockopt(SB, uae_u32 sd, uae_u32 level, uae_u32 optname, uae_u32 else write_log("BSDSOCK: ERROR - Unknown optlen (%d) in setsockopt(%d,%d)\n",level,optname); } -// put_long(optlen,len); // some programs pass the actual ength instead of a pointer to the length, so... +// put_long(optlen,len); // some programs pass the actual ength instead of a pointer to the length, so... TRACE(("OK (%d,%d)\n",len,*(long *)buf)); return 0; } @@ -1553,7 +1552,7 @@ uae_u32 host_IoctlSocket(SB, uae_u32 sd, uae_u32 request, uae_u32 arg) { switch (request) { - case FIOSETOWN: + case FIOSETOWN: sb->ownertask = get_long(arg); success = 0; break; @@ -1611,7 +1610,7 @@ int host_CloseSocket(SB, int sd) { unsigned int wMsg; SOCKET s; - + TRACE(("CloseSocket(%d) -> ",sd)); sd++; @@ -1633,7 +1632,7 @@ int host_CloseSocket(SB, int sd) for (;;) { - shutdown(s,1); + shutdown(s,1); if (!closesocket(s)) { releasesock(sb,sd); @@ -1664,9 +1663,9 @@ int host_CloseSocket(SB, int sd) else break; } - ENDBLOCKING; + ENDBLOCKING; } - + TRACE(("failed (%d)\n",sb->sb_errno)); return -1; @@ -1766,7 +1765,6 @@ static void makesockbitfield(SB, uae_u32 fd_set_amiga, struct fd_set *fd_set_win static void fd_zero(uae_u32 fdset, uae_u32 nfds) { unsigned int i; - for (i = 0; i < nfds; i += 32, fdset += 4) put_long(fdset,0); } @@ -1841,7 +1839,7 @@ static unsigned int __stdcall thread_WaitSelect(void *indexp) } else { - sb->needAbort = 0; + sb->needAbort = 0; } if (sb->resultval == SOCKET_ERROR) { @@ -1864,9 +1862,7 @@ static unsigned int __stdcall thread_WaitSelect(void *indexp) SetEvent(sb->hEvent); } } -#ifndef __GNUC__ - _endthreadex( result ); -#endif + THREADEND(result); return result; } @@ -1900,7 +1896,7 @@ void host_WaitSelect(SB, uae_u32 nfds, uae_u32 readfds, uae_u32 writefds, uae_u3 if (readfds) fd_zero(readfds,nfds); if (writefds) fd_zero(writefds,nfds); if (exceptfds) fd_zero(exceptfds,nfds); - sb->resultval = 0; + sb->resultval = 0; seterrno(sb,0); return; } @@ -1995,14 +1991,14 @@ void host_WaitSelect(SB, uae_u32 nfds, uae_u32 readfds, uae_u32 writefds, uae_u3 if (newsock != INVALID_SOCKET) sb->sockAbort = newsock; - if( sigmp ) - { + if( sigmp ) + { put_long(sigmp,sigs & wssigs); if (sigs & sb->eintrsigs) { TRACE(("[interrupted]\n")); - sb->resultval = -1; + sb->resultval = -1; seterrno(sb,4); // EINTR } else if (sigs & wssigs) @@ -2012,7 +2008,7 @@ void host_WaitSelect(SB, uae_u32 nfds, uae_u32 readfds, uae_u32 writefds, uae_u3 if (writefds) fd_zero(writefds,nfds); if (exceptfds) fd_zero(exceptfds,nfds); seterrno(sb,0); - sb->resultval = 0; + sb->resultval = 0; } if (sb->resultval >= 0) { @@ -2022,7 +2018,7 @@ void host_WaitSelect(SB, uae_u32 nfds, uae_u32 readfds, uae_u32 writefds, uae_u3 { TRACE(("%d errno %d\n",sb->resultval,sb->sb_errno)); } - } + } else TRACE(("%d\n",sb->resultval)); } } @@ -2219,13 +2215,10 @@ static unsigned int __stdcall thread_get(void *indexp) } } -#ifndef __GNUC__ - _endthreadex( result ); -#endif + THREADEND(result); return result; } - void host_gethostbynameaddr(SB, uae_u32 name, uae_u32 namelen, long addrtype) { HOSTENT *h; @@ -2242,9 +2235,9 @@ void host_gethostbynameaddr(SB, uae_u32 name, uae_u32 namelen, long addrtype) char buf[MAXGETHOSTSTRUCT]; unsigned int wMsg = 0; -// char on = 1; +// char on = 1; // InternetSetOption(0,INTERNET_OPTION_SETTINGS_CHANGED,&on,strlen(&on)); -// Do not use: Causes locks with some machines +// Do not use: Causes locks with some machines name_rp = get_real_address(name); @@ -2353,10 +2346,10 @@ kludge: if (sb->hostent) { - uae_FreeMem( sb->hostent, sb->hostentsize ); + uae_FreeMem( sb->hostent, sb->hostentsize ); } - sb->hostent = uae_AllocMem( size, 0 ); + sb->hostent = uae_AllocMem( size, 0 ); if (!sb->hostent) { @@ -2481,7 +2474,7 @@ void host_getprotobyname(SB, uae_u32 name) if (sb->protoent) { - uae_FreeMem( sb->protoent, sb->protoentsize ); + uae_FreeMem( sb->protoent, sb->protoentsize ); } sb->protoent = uae_AllocMem( size, 0 ); @@ -2614,10 +2607,10 @@ void host_getservbynameport(SB, uae_u32 nameport, uae_u32 proto, uae_u32 type) if (sb->servent) { - uae_FreeMem( sb->servent, sb->serventsize ); + uae_FreeMem( sb->servent, sb->serventsize ); } - sb->servent = uae_AllocMem( size, 0 ); + sb->servent = uae_AllocMem( size, 0 ); if (!sb->servent) { @@ -2652,8 +2645,6 @@ void host_getservbynameport(SB, uae_u32 nameport, uae_u32 proto, uae_u32 type) } - - uae_u32 host_gethostname(uae_u32 name, uae_u32 namelen) { return gethostname(get_real_address(name),namelen); diff --git a/od-win32/caps/caps_win32.c b/od-win32/caps/caps_win32.c index 9b170c60..93eb7b06 100755 --- a/od-win32/caps/caps_win32.c +++ b/od-win32/caps/caps_win32.c @@ -61,7 +61,7 @@ int caps_init (void) notify_user (NUMSG_OLDCAPS); noticed = 1; return 0; - } + } pCAPSInit = (CAPSINIT)GetProcAddress (h, "CAPSInit"); pCAPSAddImage = (CAPSADDIMAGE)GetProcAddress (h, "CAPSAddImage"); pCAPSLockImageMemory = (CAPSLOCKIMAGEMEMORY)GetProcAddress (h, "CAPSLockImageMemory"); diff --git a/od-win32/dinput.c b/od-win32/dinput.c index ad93d63a..abc8724e 100755 --- a/od-win32/dinput.c +++ b/od-win32/dinput.c @@ -275,8 +275,8 @@ static int initialize_rawinput (void) for (i = 0; i < gotnum; i++) { int type = ridl[i].dwType; HANDLE h = ridl[i].hDevice; - vtmp = bufsize; - pGetRawInputDeviceInfo (h, RIDI_DEVICENAME, buf, &vtmp); + vtmp = bufsize; + pGetRawInputDeviceInfo (h, RIDI_DEVICENAME, buf, &vtmp); if (!memcmp (RDP_MOUSE, buf, strlen (RDP_MOUSE))) continue; @@ -386,7 +386,7 @@ static void initialize_windowsmouse (void) did += num_mouse; for (i = 0; i < 2; i++) { - if (num_mouse >= MAX_INPUT_DEVICES) + if (num_mouse >= MAX_INPUT_DEVICES) return; num_mouse++; name = (i == 0) ? "Windows mouse" : "Mousehack mouse"; @@ -430,7 +430,7 @@ static void handle_rawinput_2 (RAWINPUT *raw) if (raw->header.dwType == RIM_TYPEMOUSE) { PRAWMOUSE rm = &raw->data.mouse; - + for (num = 0; num < num_mouse; num++) { did = &di_mouse[num]; if (!did->disabled && did->rawinput == raw->header.hDevice) @@ -461,13 +461,13 @@ static void handle_rawinput_2 (RAWINPUT *raw) for (i = 5; i < did->buttons; i++) setmousebuttonstate (num, i, (rm->ulRawButtons & (1 << i)) ? 1 : 0); } - if (did->buttons >= 3 && (rm->usButtonFlags & RI_MOUSE_MIDDLE_BUTTON_DOWN)) { + if (did->buttons >= 3 && (rm->usButtonFlags & RI_MOUSE_MIDDLE_BUTTON_DOWN)) { if (currprefs.win32_middle_mouse) { - if (isfullscreen ()) + if (isfullscreen ()) minimizewindow (); if (mouseactive) setmouseactive(0); - } + } } } if (rm->usButtonFlags & RI_MOUSE_WHEEL) @@ -598,7 +598,7 @@ static void sortobjects (struct didata *did, int *mappings, int *sort, char **na char *tmpc; for (i = 0; i < num; i++) { - for (j = i + 1; j < num; j++) { + for (j = i + 1; j < num; j++) { if (sort[i] > sort[j]) { tmpi = mappings[i]; mappings[i] = mappings[j]; mappings[j] = tmpi; tmpi = sort[i]; sort[i] = sort[j]; sort[j] = tmpi; @@ -734,9 +734,9 @@ static BOOL CALLBACK di_enumcallback (LPCDIDEVICEINSTANCE lpddi, LPVOID *dd) #ifdef DI_DEBUG write_log ("GUID=%08.8X-%04.8X-%04.8X-%02.2X%02.2X%02.2X%02.2X%02.2X%02.2X%02.2X%02.2X:\n", - lpddi->guidInstance.Data1, lpddi->guidInstance.Data2, lpddi->guidInstance.Data3, - lpddi->guidInstance.Data4[0], lpddi->guidInstance.Data4[1], lpddi->guidInstance.Data4[2], lpddi->guidInstance.Data4[3], - lpddi->guidInstance.Data4[4], lpddi->guidInstance.Data4[5], lpddi->guidInstance.Data4[6], lpddi->guidInstance.Data4[7]); + lpddi->guidInstance.Data1, lpddi->guidInstance.Data2, lpddi->guidInstance.Data3, + lpddi->guidInstance.Data4[0], lpddi->guidInstance.Data4[1], lpddi->guidInstance.Data4[2], lpddi->guidInstance.Data4[3], + lpddi->guidInstance.Data4[4], lpddi->guidInstance.Data4[5], lpddi->guidInstance.Data4[6], lpddi->guidInstance.Data4[7]); write_log ("'%s' '%s' %08.8X [%s]\n", lpddi->tszProductName, lpddi->tszInstanceName, lpddi->dwDevType, typetxt); #endif @@ -760,8 +760,8 @@ static BOOL CALLBACK di_enumcallback (LPCDIDEVICEINSTANCE lpddi, LPVOID *dd) memset (did, 0, sizeof (*did)); for (i = 0; i < MAX_MAPPINGS; i++) { - did->axismappings[i] = -1; - did->buttonmappings[i] = -1; + did->axismappings[i] = -1; + did->buttonmappings[i] = -1; } len = strlen (lpddi->tszInstanceName) + 3 + 1; did->connection = DIDC_DX; @@ -1058,7 +1058,7 @@ static void read_mouse (void) } else if (did->acquired && hr == DIERR_NOTACQUIRED) { acquire (lpdi, "mouse"); } - IDirectInputDevice8_Poll (lpdi); + IDirectInputDevice8_Poll (lpdi); } } @@ -1109,11 +1109,11 @@ static uae_u32 get_leds (void) GetKeyboardState (ledkeystate); if (ledkeystate[VK_NUMLOCK] & 1) - led |= KBLED_NUMLOCK; + led |= KBLED_NUMLOCK; if (ledkeystate[VK_CAPITAL] & 1) - led |= KBLED_CAPSLOCK; + led |= KBLED_CAPSLOCK; if (ledkeystate[VK_SCROLL] & 1) - led |= KBLED_SCROLLLOCK; + led |= KBLED_SCROLLLOCK; if (usbledmode && os_winnt) { oldusbleds = led; @@ -1161,8 +1161,8 @@ static void set_leds (uae_u32 led) ULONG ReturnedLength; memset (&InputBuffer, 0, sizeof (InputBuffer)); - if (led & KBLED_NUMLOCK) - InputBuffer.LedFlags |= KEYBOARD_NUM_LOCK_ON; + if (led & KBLED_NUMLOCK) + InputBuffer.LedFlags |= KEYBOARD_NUM_LOCK_ON; if (led & KBLED_CAPSLOCK) InputBuffer.LedFlags |= KEYBOARD_CAPS_LOCK_ON; if (led & KBLED_SCROLLLOCK) @@ -1223,7 +1223,7 @@ static int init_kb (void) oldusedleds = -1; keyboard_inited = 1; for (i = 0; i < num_keyboard; i++) { - struct didata *did = &di_keyboard[i]; + struct didata *did = &di_keyboard[i]; if (!did->disabled && did->connection == DIDC_DX) { hr = IDirectInput8_CreateDevice (g_lpdi, &did->guid, &lpdi, NULL); if (hr == DI_OK) { @@ -1239,7 +1239,7 @@ static int init_kb (void) hr = IDirectInputDevice8_SetProperty (lpdi, DIPROP_BUFFERSIZE, &dipdw.diph); if (hr != DI_OK) write_log ("keyboard setpropertry failed, %s\n", DXError (hr)); - IDirectInputDevice8_EnumObjects (lpdi, EnumObjectsCallback, (void*)did, DIDFT_ALL); + IDirectInputDevice8_EnumObjects (lpdi, EnumObjectsCallback, (void*)did, DIDFT_ALL); sortobjects (did, did->axismappings, did->axissort, did->axisname, did->axistype, did->axles); sortobjects (did, did->buttonmappings, did->buttonsort, did->buttonname, 0, did->buttons); did->lpdi = lpdi; @@ -1269,7 +1269,7 @@ static void close_kb (void) di_free (); } -#define MAX_KEYCODES 256 +#define MAX_KEYCODES 256 static uae_u8 di_keycodes[MAX_INPUT_DEVICES][MAX_KEYCODES]; static uae_u32 kb_do_refresh; @@ -1323,7 +1323,7 @@ static int refresh_kb (LPDIRECTINPUTDEVICE8 lpdi, int num) } -static int keyhack (int scancode,int pressed, int num) +static int keyhack (int scancode,int pressed, int num) { static byte backslashstate,apostrophstate; @@ -1356,38 +1356,38 @@ static int keyhack (int scancode,int pressed, int num) if (scancode == DIK_BACKSLASH) // The # key { if (di_keycodes[num][DIK_LSHIFT] || di_keycodes[num][DIK_RSHIFT] || apostrophstate) - { - if (pressed) - { apostrophstate=1; - inputdevice_translatekeycode (num, DIK_RSHIFT, 0); - inputdevice_translatekeycode (num, DIK_LSHIFT, 0); - return 13; // the german ' key - } - else - { - //best is add a real keystatecheck here but it still work so - apostrophstate = 0; - inputdevice_translatekeycode (num, DIK_LALT,0); - inputdevice_translatekeycode (num, DIK_LSHIFT,0); - inputdevice_translatekeycode (num, 4, 0); // release also the # key - return 13; - } - - } - if (pressed) - { - inputdevice_translatekeycode (num, DIK_LALT, 1); - inputdevice_translatekeycode (num, DIK_LSHIFT,1); - return 4; // the german # key - } - else - { - inputdevice_translatekeycode (num, DIK_LALT, 0); - inputdevice_translatekeycode (num, DIK_LSHIFT, 0); - // Here is the same not nice but do the job - return 4; // the german # key - - } + { + if (pressed) + { apostrophstate=1; + inputdevice_translatekeycode (num, DIK_RSHIFT, 0); + inputdevice_translatekeycode (num, DIK_LSHIFT, 0); + return 13; // the german ' key + } + else + { + //best is add a real keystatecheck here but it still work so + apostrophstate = 0; + inputdevice_translatekeycode (num, DIK_LALT,0); + inputdevice_translatekeycode (num, DIK_LSHIFT,0); + inputdevice_translatekeycode (num, 4, 0); // release also the # key + return 13; + } + + } + if (pressed) + { + inputdevice_translatekeycode (num, DIK_LALT, 1); + inputdevice_translatekeycode (num, DIK_LSHIFT,1); + return 4; // the german # key + } + else + { + inputdevice_translatekeycode (num, DIK_LALT, 0); + inputdevice_translatekeycode (num, DIK_LSHIFT, 0); + // Here is the same not nice but do the job + return 4; // the german # key + + } } if ((di_keycodes[num][DIK_RALT]) || (backslashstate)) { switch (scancode) @@ -1438,14 +1438,14 @@ static void read_kb (void) for (j = 0; j < elements; j++) { int scancode = didod[j].dwOfs; int pressed = (didod[j].dwData & 0x80) ? 1 : 0; - scancode = keyhack (scancode, pressed, i); - if (scancode < 0) + scancode = keyhack (scancode, pressed, i); + if (scancode < 0) continue; di_keycodes[i][scancode] = pressed; if (stopoutput == 0) my_kbd_handler (i, scancode, pressed); } - } else if (hr == DIERR_INPUTLOST) { + } else if (hr == DIERR_INPUTLOST) { acquire (lpdi, "keyboard"); kb_do_refresh |= 1 << i; } else if (did->acquired && hr == DIERR_NOTACQUIRED) { @@ -1546,7 +1546,7 @@ static int acquire_kb (int num, int flags) superkb++; else normalkb++; - di_keyboard[num].acquired = 1; + di_keyboard[num].acquired = 1; } return di_keyboard[num].acquired > 0 ? 1 : 0; } @@ -1561,7 +1561,7 @@ static void unacquire_kb (int num) superkb--; else normalkb--; - di_keyboard[num].acquired = 0; + di_keyboard[num].acquired = 0; } release_keys (); @@ -1678,8 +1678,8 @@ static void read_joystick (void) write_log ("B:NUM=%d OFF=%d NAME=%s VAL=%d STATE=%d\n", k, dimofs, did->buttonname[k], data, state); #endif - setjoybuttonstate (i, k, state); - break; + setjoybuttonstate (i, k, state); + break; } } for (k = 0; k < did->axles; k++) { @@ -1697,7 +1697,7 @@ static void read_joystick (void) #endif setjoystickstate (i, k, data, 32768); } - break; + break; } } } @@ -1706,7 +1706,7 @@ static void read_joystick (void) } else if (did->acquired && hr == DIERR_NOTACQUIRED) { acquire (lpdi, "joystick"); } - IDirectInputDevice8_Poll (lpdi); + IDirectInputDevice8_Poll (lpdi); } #if 0 { @@ -1721,14 +1721,14 @@ static void read_joystick (void) odir = dir; obut = but; if ((dir & 15) != (dir2 & 15)) { - handle_input_event (INPUTEVENT_JOY2_HORIZ, !(dir & 1) ? 1 : !(dir & 2) ? -1 : 0, 1, 0); - handle_input_event (INPUTEVENT_JOY2_VERT, !(dir & 4) ? 1 : !(dir & 8) ? -1 : 0, 1, 0); + handle_input_event (INPUTEVENT_JOY2_HORIZ, !(dir & 1) ? 1 : !(dir & 2) ? -1 : 0, 1, 0); + handle_input_event (INPUTEVENT_JOY2_VERT, !(dir & 4) ? 1 : !(dir & 8) ? -1 : 0, 1, 0); } dir >>= 4; dir2 >>= 4; if ((dir & 15) != (dir2 & 15)) { - handle_input_event (INPUTEVENT_JOY1_HORIZ, !(dir & 1) ? 1 : !(dir & 2) ? -1 : 0, 1, 0); - handle_input_event (INPUTEVENT_JOY1_VERT, !(dir & 4) ? 1 : !(dir & 8) ? -1 : 0, 1, 0); + handle_input_event (INPUTEVENT_JOY1_HORIZ, !(dir & 1) ? 1 : !(dir & 2) ? -1 : 0, 1, 0); + handle_input_event (INPUTEVENT_JOY1_VERT, !(dir & 4) ? 1 : !(dir & 8) ? -1 : 0, 1, 0); } } } @@ -1836,14 +1836,14 @@ void input_get_default_mouse (struct uae_input_device *uid) port = i & 1; if (di_mouse[i].wininput) port = 0; - uid[i].eventid[ID_AXIS_OFFSET + 0][0] = port ? INPUTEVENT_MOUSE2_HORIZ : INPUTEVENT_MOUSE1_HORIZ; + uid[i].eventid[ID_AXIS_OFFSET + 0][0] = port ? INPUTEVENT_MOUSE2_HORIZ : INPUTEVENT_MOUSE1_HORIZ; uid[i].eventid[ID_AXIS_OFFSET + 1][0] = port ? INPUTEVENT_MOUSE2_VERT : INPUTEVENT_MOUSE1_VERT; - uid[i].eventid[ID_AXIS_OFFSET + 2][0] = port ? 0 : INPUTEVENT_MOUSE1_WHEEL; + uid[i].eventid[ID_AXIS_OFFSET + 2][0] = port ? 0 : INPUTEVENT_MOUSE1_WHEEL; uid[i].eventid[ID_BUTTON_OFFSET + 0][0] = port ? INPUTEVENT_JOY2_FIRE_BUTTON : INPUTEVENT_JOY1_FIRE_BUTTON; uid[i].eventid[ID_BUTTON_OFFSET + 1][0] = port ? INPUTEVENT_JOY2_2ND_BUTTON : INPUTEVENT_JOY1_2ND_BUTTON; uid[i].eventid[ID_BUTTON_OFFSET + 2][0] = port ? INPUTEVENT_JOY2_3RD_BUTTON : INPUTEVENT_JOY1_3RD_BUTTON; if (port == 0) { /* map back and forward to ALT+LCUR and ALT+RCUR */ - uid[i].eventid[ID_BUTTON_OFFSET + 3][0] = INPUTEVENT_KEY_ALT_LEFT; + uid[i].eventid[ID_BUTTON_OFFSET + 3][0] = INPUTEVENT_KEY_ALT_LEFT; uid[i].eventid[ID_BUTTON_OFFSET + 3][1] = INPUTEVENT_KEY_CURSOR_LEFT; uid[i].eventid[ID_BUTTON_OFFSET + 4][0] = INPUTEVENT_KEY_ALT_LEFT; uid[i].eventid[ID_BUTTON_OFFSET + 4][1] = INPUTEVENT_KEY_CURSOR_RIGHT; @@ -1858,7 +1858,7 @@ void input_get_default_joystick (struct uae_input_device *uid) for (i = 0; i < num_mouse; i++) { port = i & 1; - uid[i].eventid[ID_AXIS_OFFSET + 0][0] = port ? INPUTEVENT_JOY2_HORIZ : INPUTEVENT_JOY1_HORIZ; + uid[i].eventid[ID_AXIS_OFFSET + 0][0] = port ? INPUTEVENT_JOY2_HORIZ : INPUTEVENT_JOY1_HORIZ; uid[i].eventid[ID_AXIS_OFFSET + 1][0] = port ? INPUTEVENT_JOY2_VERT : INPUTEVENT_JOY1_VERT; uid[i].eventid[ID_BUTTON_OFFSET + 0][0] = port ? INPUTEVENT_JOY2_FIRE_BUTTON : INPUTEVENT_JOY1_FIRE_BUTTON; uid[i].eventid[ID_BUTTON_OFFSET + 1][0] = port ? INPUTEVENT_JOY2_2ND_BUTTON : INPUTEVENT_JOY1_2ND_BUTTON; diff --git a/od-win32/direct3d.c b/od-win32/direct3d.c index 6d8b201e..af0a6e0a 100755 --- a/od-win32/direct3d.c +++ b/od-win32/direct3d.c @@ -109,11 +109,11 @@ static int restoredeviceobjects(void) switch (currprefs.gfx_filter_filtermode & 1) { - case 0: + case 0: v = D3DTEXF_POINT; break; - case 1: - default: + case 1: + default: v = D3DTEXF_LINEAR; break; } @@ -193,7 +193,7 @@ static void createscanlines (int force) hr = IDirect3DTexture9_LockRect(sltexture, 0, &locked, NULL, D3DLOCK_DISCARD); if (FAILED (hr)) { - write_log ("SL IDirect3DTexture9_LockRect failed: %s\n", D3D_ErrorString (hr)); + write_log ("SL IDirect3DTexture9_LockRect failed: %s\n", D3D_ErrorString (hr)); return; } sld = (uae_u8*)locked.pBits; @@ -202,11 +202,11 @@ static void createscanlines (int force) for (y = 1; y < window_h; y += l1 + l2) { for (yy = 0; yy < l2 && y + yy < window_h; yy++) { for (x = 0; x < window_w; x++) { - /* 16-bit, A4R4G4B4 */ - uae_u8 sll = sl42; - p = &sld[(y + yy) * locked.Pitch + (x * 2)]; - p[1] = (sl4 << 4) | (sll << 0); - p[0] = (sll << 4) | (sll << 0); + /* 16-bit, A4R4G4B4 */ + uae_u8 sll = sl42; + p = &sld[(y + yy) * locked.Pitch + (x * 2)]; + p[1] = (sl4 << 4) | (sll << 0); + p[0] = (sll << 4) | (sll << 0); } } } @@ -239,11 +239,11 @@ const char *D3D_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth) d3dDLL = LoadLibrary("D3D9.DLL"); if (d3dDLL == NULL) { - strcpy (errmsg, "Direct3D: DirectX 9 or newer required"); - return errmsg; + strcpy (errmsg, "Direct3D: DirectX 9 or newer required"); + return errmsg; } D3DCreate = (LPDIRECT3D9 (WINAPI *)(UINT)) - GetProcAddress(d3dDLL, "Direct3DCreate9"); + GetProcAddress(d3dDLL, "Direct3DCreate9"); if(D3DCreate == NULL) { D3D_free (); strcpy (errmsg, "Direct3D: DirectX 9 or newer required"); @@ -281,7 +281,7 @@ const char *D3D_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth) } } } - + ret = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, ahwnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &dpp, &d3ddev); if(FAILED(ret)) { @@ -314,14 +314,14 @@ const char *D3D_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth) t_depth = depth; switch (depth) { - case 32: + case 32: if (currprefs.gfx_filter_scanlines) tformat = D3DFMT_A8R8G8B8; else tformat = D3DFMT_X8R8G8B8; break; - case 15: - case 16: + case 15: + case 16: if (currprefs.gfx_filter_scanlines) tformat = D3DFMT_A1R5G5B5; else @@ -354,7 +354,7 @@ typedef struct _D3DTLVERTEX { } D3DTLVERTEX, *LPD3DTLVERTEX; static void BlitRect(LPDIRECT3DDEVICE9 dev, LPDIRECT3DTEXTURE9 src, - float left, float top, float right, float bottom, D3DCOLOR col,float z) + float left, float top, float right, float bottom, D3DCOLOR col,float z) { int i; HRESULT hr; @@ -377,20 +377,20 @@ static void BlitRect(LPDIRECT3DDEVICE9 dev, LPDIRECT3DTEXTURE9 src, // set the texture hr = IDirect3DDevice9_SetTexture(dev, 0, src); if (FAILED (hr)) - write_log ("IDirect3DDevice9_SetTexture failed: %s\n", D3D_ErrorString (hr)); + write_log ("IDirect3DDevice9_SetTexture failed: %s\n", D3D_ErrorString (hr)); hr = IDirect3DDevice9_SetVertexShader(dev, NULL); if (FAILED (hr)) - write_log ("IDirect3DDevice9_SetVertexShader failed: %s\n", D3D_ErrorString (hr)); + write_log ("IDirect3DDevice9_SetVertexShader failed: %s\n", D3D_ErrorString (hr)); // configure shader for vertex type hr = IDirect3DDevice9_SetFVF(dev, D3DFVF_TLVERTEX); if (FAILED (hr)) - write_log ("IDirect3DDevice9_SetFVF failed: %s\n", D3D_ErrorString (hr)); + write_log ("IDirect3DDevice9_SetFVF failed: %s\n", D3D_ErrorString (hr)); // draw the rectangle hr = IDirect3DDevice9_DrawPrimitiveUP(dev, D3DPT_TRIANGLEFAN, 2, verts, sizeof(D3DTLVERTEX)); if (FAILED (hr)) - write_log ("IDirect3DDevice9_DrawPrimitiveUP failed: %s\n", D3D_ErrorString (hr)); + write_log ("IDirect3DDevice9_DrawPrimitiveUP failed: %s\n", D3D_ErrorString (hr)); } static void calc (float *xp, float *yp, float *sxp, float *syp) @@ -451,7 +451,7 @@ int D3D_locktexture (void) } hr = IDirect3DTexture9_LockRect(texture, 0, &locked, NULL, D3DLOCK_DISCARD | D3DLOCK_NOSYSLOCK); if (FAILED (hr)) { - write_log ("IDirect3DTexture9_LockRect failed: %s\n", D3D_ErrorString (hr)); + write_log ("IDirect3DTexture9_LockRect failed: %s\n", D3D_ErrorString (hr)); D3D_unlocktexture (); return 0; } @@ -494,8 +494,8 @@ void D3D_getpixelformat (int depth,int *rb, int *gb, int *bb, int *rs, int *gs, { switch (depth) { - case 32: - *rb = 8; + case 32: + *rb = 8; *gb = 8; *bb = 8; *ab = 8; @@ -505,9 +505,9 @@ void D3D_getpixelformat (int depth,int *rb, int *gb, int *bb, int *rs, int *gs, *as = 24; *a = 255; break; - case 15: - case 16: - *rb = 5; + case 15: + case 16: + *rb = 5; *gb = 5; *bb = 5; *ab = 1; @@ -536,7 +536,7 @@ HDC D3D_getDC(HDC hdc) if (!d3d_enabled) return 0; if (!hdc) { - hr = IDirect3DDevice9_GetBackBuffer (d3ddev, 0, 0, D3DBACKBUFFER_TYPE_MONO, &bb); + hr = IDirect3DDevice9_GetBackBuffer (d3ddev, 0, 0, D3DBACKBUFFER_TYPE_MONO, &bb); if (!SUCCEEDED (hr)) { write_log ("failed to create backbuffer: %s\n", D3D_ErrorString (hr)); return 0; diff --git a/od-win32/dxwrap.c b/od-win32/dxwrap.c index 844c6481..04cca2d7 100755 --- a/od-win32/dxwrap.c +++ b/od-win32/dxwrap.c @@ -38,7 +38,7 @@ #include "custom.h" static BOOL bColourKeyAvailable = FALSE; -static BOOL bOverlayAvailable = FALSE; +static BOOL bOverlayAvailable = FALSE; static DDCAPS_DX7 drivercaps, helcaps; static DWORD overlayflags; static DDOVERLAYFX overlayfx; @@ -244,19 +244,19 @@ static int LockStub( surface_type_e type ) break; case secondary_surface: surface = DirectDrawState.secondary.surface; - surfacedesc = &DirectDrawState.secondary.desc; + surfacedesc = &DirectDrawState.secondary.desc; break; case tertiary_surface: surface = DirectDrawState.tertiary.surface; - surfacedesc = &DirectDrawState.tertiary.desc; + surfacedesc = &DirectDrawState.tertiary.desc; break; case temporary_surface: surface = DirectDrawState.temporary.surface; - surfacedesc = &DirectDrawState.temporary.desc; + surfacedesc = &DirectDrawState.temporary.desc; break; case overlay_surface: surface = DirectDrawState.overlay.surface; - surfacedesc = &DirectDrawState.overlay.desc; + surfacedesc = &DirectDrawState.overlay.desc; break; } @@ -274,28 +274,28 @@ static int LockStub( surface_type_e type ) } while (FAILED(ddrval = IDirectDrawSurface7_Lock(surface, NULL, surfacedesc, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, - NULL))) + NULL))) { - if (ddrval == DDERR_SURFACELOST) { - ddrval = restoresurface (surface); - if (FAILED(ddrval)) - { - result = 0; - break; - } - } - else if (ddrval != DDERR_SURFACEBUSY) - { + if (ddrval == DDERR_SURFACELOST) { + ddrval = restoresurface (surface); + if (FAILED(ddrval)) + { + result = 0; + break; + } + } + else if (ddrval != DDERR_SURFACEBUSY) + { write_log ("lpDDS->Lock() failed - %s\n", DXError (ddrval)); - result = 0; - break; - } + result = 0; + break; + } } if(SUCCEEDED(ddrval)) - result = 1; + result = 1; if(result) - lockcnt++; + lockcnt++; return result; } @@ -321,34 +321,34 @@ int DirectDraw_SurfaceLock( surface_type_e surface_type ) int result = 0; if( surface_type == lockable_surface ) - surface_type = DirectDraw_GetLockableType(); + surface_type = DirectDraw_GetLockableType(); switch( surface_type ) { - case primary_surface: - DirectDrawState.primary.desc.dwSize = sizeof( DDSURFACEDESC2 ); - result = LockStub( surface_type ); - break; - case secondary_surface: - DirectDrawState.secondary.desc.dwSize = sizeof( DDSURFACEDESC2 ); - result = LockStub( surface_type ); - break; - case tertiary_surface: - DirectDrawState.tertiary.desc.dwSize = sizeof( DDSURFACEDESC2 ); - result = LockStub( surface_type ); - break; - case temporary_surface: - DirectDrawState.temporary.desc.dwSize = sizeof( DDSURFACEDESC2 ); - result = LockStub( surface_type ); - break; + case primary_surface: + DirectDrawState.primary.desc.dwSize = sizeof( DDSURFACEDESC2 ); + result = LockStub( surface_type ); + break; + case secondary_surface: + DirectDrawState.secondary.desc.dwSize = sizeof( DDSURFACEDESC2 ); + result = LockStub( surface_type ); + break; + case tertiary_surface: + DirectDrawState.tertiary.desc.dwSize = sizeof( DDSURFACEDESC2 ); + result = LockStub( surface_type ); + break; + case temporary_surface: + DirectDrawState.temporary.desc.dwSize = sizeof( DDSURFACEDESC2 ); + result = LockStub( surface_type ); + break; case overlay_surface: DirectDrawState.overlay.desc.dwSize = sizeof( DDSURFACEDESC2 ); result = LockStub( surface_type ); - case lockable_surface: - case invalid_surface: - default: + case lockable_surface: + case invalid_surface: + default: - break; + break; } DirectDrawState.locked = result; @@ -377,7 +377,7 @@ char *DirectDraw_GetSurfacePointer( void ) /* Make sure that somebody has done a lock before returning the lpSurface member */ if(lockcnt) { - pixels = DirectDrawState.lockable.lpdesc->lpSurface; + pixels = DirectDrawState.lockable.lpdesc->lpSurface; } return pixels; } @@ -532,15 +532,15 @@ DWORD DirectDraw_GetPixelFormatBitMask( DirectDraw_Mask_e mask ) DWORD result = 0; switch( mask ) { - case red_mask: - result = DirectDrawState.lockable.lpdesc->ddpfPixelFormat.dwRBitMask; - break; - case green_mask: - result = DirectDrawState.lockable.lpdesc->ddpfPixelFormat.dwGBitMask; - break; - case blue_mask: - result = DirectDrawState.lockable.lpdesc->ddpfPixelFormat.dwBBitMask; - break; + case red_mask: + result = DirectDrawState.lockable.lpdesc->ddpfPixelFormat.dwRBitMask; + break; + case green_mask: + result = DirectDrawState.lockable.lpdesc->ddpfPixelFormat.dwGBitMask; + break; + case blue_mask: + result = DirectDrawState.lockable.lpdesc->ddpfPixelFormat.dwBBitMask; + break; } return result; } @@ -624,11 +624,11 @@ static surface_type_e try_surface_locks( int want_fullscreen ) } else { - if( DirectDraw_SurfaceLock( secondary_surface ) ) - { - result = secondary_surface; + if( DirectDraw_SurfaceLock( secondary_surface ) ) + { + result = secondary_surface; write_log( "try_surface_locks() returning secondary\n" ); - } + } } return result; @@ -697,12 +697,12 @@ int DirectDraw_Start( GUID *guid ) DirectDrawState.initialized = TRUE; ddrval = IDirectDraw_QueryInterface( DirectDrawState.directdraw.ddx, - &IID_IDirectDraw7, - (LPVOID *)&DirectDrawState.directdraw.dd ); + &IID_IDirectDraw7, + (LPVOID *)&DirectDrawState.directdraw.dd ); if(FAILED(ddrval)) { gui_message("start_ddraw(): DirectX 7 or newer required"); - DirectDraw_Release(); + DirectDraw_Release(); return 0; } @@ -775,12 +775,12 @@ void DirectDraw_Release( void ) * PURPOSE:Wrapper for setting the cooperative level (fullscreen or normal) * * PARAMETERS: - * window Window to set the cooperative level for - * want_fullscreen fullscreen mode flag + * window Window to set the cooperative level for + * want_fullscreen fullscreen mode flag * - * RETURNS: result of underlying DirectDraw call + * RETURNS: result of underlying DirectDraw call * - * NOTES: Updates the .fullscreen and .window members. + * NOTES: Updates the .fullscreen and .window members. * * HISTORY: * 1999.08.02 Brian King Creation @@ -791,10 +791,9 @@ HRESULT DirectDraw_SetCooperativeLevel( HWND window, int want_fullscreen ) HRESULT ddrval; ddrval = IDirectDraw7_SetCooperativeLevel( DirectDrawState.directdraw.dd, - window, - want_fullscreen ? - DDSCL_ALLOWREBOOT | DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN : - DDSCL_NORMAL ); + window, + want_fullscreen ? + DDSCL_ALLOWREBOOT | DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN : DDSCL_NORMAL ); if(SUCCEEDED(ddrval)) { DirectDrawState.fullscreen = want_fullscreen; DirectDrawState.window = window; @@ -808,12 +807,12 @@ HRESULT DirectDraw_SetCooperativeLevel( HWND window, int want_fullscreen ) * PURPOSE:Wrapper for setting the cooperative level (fullscreen or normal) * * PARAMETERS: - * window Window to set the cooperative level for - * want_fullscreen fullscreen mode flag + * window Window to set the cooperative level for + * want_fullscreen fullscreen mode flag * - * RETURNS: result of underlying DirectDraw call + * RETURNS: result of underlying DirectDraw call * - * NOTES: Updates the .fullscreen and .window members. + * NOTES: Updates the .fullscreen and .window members. * * HISTORY: * 1999.08.02 Brian King Creation @@ -857,7 +856,7 @@ HRESULT DirectDraw_SetDisplayMode( int width, int height, int bits, int freq ) HRESULT ddrval; ddrval = IDirectDraw7_SetDisplayMode( DirectDrawState.directdraw.dd, - width, height, bits, freq, 0 ); + width, height, bits, freq, 0 ); DirectDrawState.modeset = 1; return ddrval; } @@ -885,7 +884,7 @@ HRESULT DirectDraw_GetDisplayMode( void ) /* We fill in the current.desc in all cases */ DirectDrawState.current.desc.dwSize = sizeof( DDSURFACEDESC2 ); ddrval = IDirectDraw7_GetDisplayMode( DirectDrawState.directdraw.dd, - &DirectDrawState.current.desc ); + &DirectDrawState.current.desc ); return ddrval; } @@ -909,7 +908,7 @@ HRESULT DirectDraw_GetCaps( DDCAPS_DX7 *driver_caps, DDCAPS_DX7 *hel_caps ) HRESULT ddrval; ddrval = IDirectDraw7_GetCaps( DirectDrawState.directdraw.dd, - driver_caps, hel_caps ); + driver_caps, hel_caps ); return ddrval; } @@ -932,9 +931,7 @@ HRESULT DirectDraw_CreateClipper( void ) { HRESULT ddrval; ddrval = IDirectDraw7_CreateClipper( DirectDrawState.directdraw.dd, - 0, - &DirectDrawState.lpDDC, - NULL ); + 0, &DirectDrawState.lpDDC, NULL ); return ddrval; } @@ -954,9 +951,9 @@ static DWORD ConvertGDIColor( COLORREF dwGDIColor ) // Use GDI SetPixel to color match for us if(dwGDIColor != CLR_INVALID && SUCCEEDED(IDirectDrawSurface7_GetDC(DirectDrawState.primary.surface, &hdc))) { - rgbT = GetPixel(hdc, 0, 0); // Save current pixel value - SetPixel(hdc, 0, 0, dwGDIColor); // Set our value - IDirectDrawSurface7_ReleaseDC(DirectDrawState.primary.surface,hdc); + rgbT = GetPixel(hdc, 0, 0); // Save current pixel value + SetPixel(hdc, 0, 0, dwGDIColor); // Set our value + IDirectDrawSurface7_ReleaseDC(DirectDrawState.primary.surface,hdc); } // Now lock the surface so we can read back the converted color @@ -964,16 +961,16 @@ static DWORD ConvertGDIColor( COLORREF dwGDIColor ) hr = IDirectDrawSurface7_Lock(DirectDrawState.primary.surface, NULL, &ddsd, DDLOCK_WAIT, NULL ); if(SUCCEEDED(hr)) { - dw = *(DWORD *) ddsd.lpSurface; - if( ddsd.ddpfPixelFormat.dwRGBBitCount < 32 ) // Mask it to bpp - dw &= ( 1 << ddsd.ddpfPixelFormat.dwRGBBitCount ) - 1; + dw = *(DWORD *) ddsd.lpSurface; + if( ddsd.ddpfPixelFormat.dwRGBBitCount < 32 ) // Mask it to bpp + dw &= ( 1 << ddsd.ddpfPixelFormat.dwRGBBitCount ) - 1; IDirectDrawSurface7_Unlock(DirectDrawState.primary.surface,NULL); } // Now put the color that was there back. if(dwGDIColor != CLR_INVALID && SUCCEEDED(IDirectDrawSurface7_GetDC(DirectDrawState.primary.surface,&hdc))) { - SetPixel( hdc, 0, 0, rgbT ); + SetPixel( hdc, 0, 0, rgbT ); IDirectDrawSurface7_ReleaseDC(DirectDrawState.primary.surface,hdc); } @@ -1112,7 +1109,7 @@ HRESULT DirectDraw_CreateSurface( int width, int height ) } else { DirectDrawState.flipping = triple_buffer; } - clearsurface (primary_surface); + clearsurface (primary_surface); } else { // We're not full-screen, so you cannot create a flipping pair... ZeroMemory( &DirectDrawState.primary.desc, sizeof(DDSURFACEDESC2)); @@ -1201,44 +1198,44 @@ HRESULT DirectDraw_CreateSurface( int width, int height ) // we're not full-screen, then lets create ourselves a back-buffer manually. if( DirectDrawState.flipping == single_buffer ) { - ZeroMemory( &DirectDrawState.secondary.desc, sizeof( DDSURFACEDESC2 ) ); - DirectDrawState.secondary.desc.dwSize = sizeof( DDSURFACEDESC2 ); - DirectDrawState.secondary.desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; - DirectDrawState.secondary.desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; - DirectDrawState.secondary.desc.dwWidth = width; - DirectDrawState.secondary.desc.dwHeight = height; - ddrval = IDirectDraw7_CreateSurface( DirectDrawState.directdraw.dd, - &DirectDrawState.secondary.desc, - &DirectDrawState.secondary.surface, - NULL ); - if(FAILED(ddrval)) - { + ZeroMemory( &DirectDrawState.secondary.desc, sizeof( DDSURFACEDESC2 ) ); + DirectDrawState.secondary.desc.dwSize = sizeof( DDSURFACEDESC2 ); + DirectDrawState.secondary.desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + DirectDrawState.secondary.desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; + DirectDrawState.secondary.desc.dwWidth = width; + DirectDrawState.secondary.desc.dwHeight = height; + ddrval = IDirectDraw7_CreateSurface( DirectDrawState.directdraw.dd, + &DirectDrawState.secondary.desc, + &DirectDrawState.secondary.surface, + NULL ); + if(FAILED(ddrval)) + { write_log( "DDRAW:Secondary surface creation attempt #1 failed with %s\n", DXError(ddrval)); - DirectDrawState.secondary.desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; - ddrval = IDirectDraw7_CreateSurface( DirectDrawState.directdraw.dd, - &DirectDrawState.secondary.desc, - &DirectDrawState.secondary.surface, - NULL ); + DirectDrawState.secondary.desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; + ddrval = IDirectDraw7_CreateSurface( DirectDrawState.directdraw.dd, + &DirectDrawState.secondary.desc, + &DirectDrawState.secondary.surface, + NULL ); if(SUCCEEDED(ddrval)) write_log( "DDRAW: Secondary surface created in plain system-memory\n" ); else { goto out; } - } - else - { - write_log( "DDRAW: Secondary surface created in video-memory\n" ); - } + } + else + { + write_log( "DDRAW: Secondary surface created in video-memory\n" ); + } #if 0 // Get our IDirectDrawSurface7 pointer - ddrval = IDirectDrawSurface7_QueryInterface( DirectDrawState.secondary.surface, - &IID_IDirectDrawSurface7, - (LPVOID *)&DirectDrawState.secondary.surface ); - if(FAILED(ddrval)) - { + ddrval = IDirectDrawSurface7_QueryInterface( DirectDrawState.secondary.surface, + &IID_IDirectDrawSurface7, + (LPVOID *)&DirectDrawState.secondary.surface ); + if(FAILED(ddrval)) + { goto out; - } + } #endif } out: @@ -1269,44 +1266,44 @@ int DirectDraw_DetermineLocking( int wantfull ) { case invalid_surface: case lockable_surface: - DirectDrawState.lockable.lpdesc = NULL; - DirectDrawState.lockable.lpdesc = NULL; - DirectDrawState.lockable.surface = NULL; - DirectDrawState.lockable.surface = NULL; - write_log( "set_ddraw: Couldn't lock primary, and no secondary available.\n" ); - break; + DirectDrawState.lockable.lpdesc = NULL; + DirectDrawState.lockable.lpdesc = NULL; + DirectDrawState.lockable.surface = NULL; + DirectDrawState.lockable.surface = NULL; + write_log( "set_ddraw: Couldn't lock primary, and no secondary available.\n" ); + break; case primary_surface: - DirectDrawState.lockable.lpdesc = &DirectDrawState.primary.desc; - DirectDrawState.lockable.lpdesc = &DirectDrawState.primary.desc; - DirectDrawState.lockable.surface = DirectDrawState.primary.surface; - DirectDrawState.lockable.surface = DirectDrawState.primary.surface; + DirectDrawState.lockable.lpdesc = &DirectDrawState.primary.desc; + DirectDrawState.lockable.lpdesc = &DirectDrawState.primary.desc; + DirectDrawState.lockable.surface = DirectDrawState.primary.surface; + DirectDrawState.lockable.surface = DirectDrawState.primary.surface; result = 1; - break; + break; case overlay_surface: - DirectDrawState.lockable.lpdesc = &DirectDrawState.overlay.desc; - DirectDrawState.lockable.lpdesc = &DirectDrawState.overlay.desc; - DirectDrawState.lockable.surface = DirectDrawState.overlay.surface; - DirectDrawState.lockable.surface = DirectDrawState.overlay.surface; + DirectDrawState.lockable.lpdesc = &DirectDrawState.overlay.desc; + DirectDrawState.lockable.lpdesc = &DirectDrawState.overlay.desc; + DirectDrawState.lockable.surface = DirectDrawState.overlay.surface; + DirectDrawState.lockable.surface = DirectDrawState.overlay.surface; result = 1; - break; + break; case secondary_surface: - DirectDrawState.lockable.lpdesc = &DirectDrawState.secondary.desc; - DirectDrawState.lockable.lpdesc = &DirectDrawState.secondary.desc; - DirectDrawState.lockable.surface = DirectDrawState.secondary.surface; - DirectDrawState.lockable.surface = DirectDrawState.secondary.surface; + DirectDrawState.lockable.lpdesc = &DirectDrawState.secondary.desc; + DirectDrawState.lockable.lpdesc = &DirectDrawState.secondary.desc; + DirectDrawState.lockable.surface = DirectDrawState.secondary.surface; + DirectDrawState.lockable.surface = DirectDrawState.secondary.surface; result = 1; - break; + break; case tertiary_surface: - DirectDrawState.lockable.lpdesc = &DirectDrawState.tertiary.desc; - DirectDrawState.lockable.lpdesc = &DirectDrawState.tertiary.desc; - DirectDrawState.lockable.surface = DirectDrawState.tertiary.surface; - DirectDrawState.lockable.surface = DirectDrawState.tertiary.surface; + DirectDrawState.lockable.lpdesc = &DirectDrawState.tertiary.desc; + DirectDrawState.lockable.lpdesc = &DirectDrawState.tertiary.desc; + DirectDrawState.lockable.surface = DirectDrawState.tertiary.surface; + DirectDrawState.lockable.surface = DirectDrawState.tertiary.surface; result = 1; - break; + break; } if( DirectDrawState.lockable.surface ) - DirectDraw_SurfaceUnlock(); + DirectDraw_SurfaceUnlock(); return result; } @@ -1331,10 +1328,10 @@ HRESULT DirectDraw_SetClipper( HWND hWnd ) HRESULT ddrval; ddrval = IDirectDrawSurface7_SetClipper( DirectDrawState.primary.surface, - hWnd ? DirectDrawState.lpDDC : NULL ); + hWnd ? DirectDrawState.lpDDC : NULL ); if( hWnd && SUCCEEDED(ddrval)) { - ddrval = IDirectDrawClipper_SetHWnd( DirectDrawState.lpDDC, 0, hWnd ); + ddrval = IDirectDrawClipper_SetHWnd( DirectDrawState.lpDDC, 0, hWnd ); } return ddrval; } @@ -1436,11 +1433,10 @@ HRESULT DirectDraw_CreatePalette( LPPALETTEENTRY pal ) { HRESULT ddrval; ddrval = IDirectDraw_CreatePalette( DirectDrawState.directdraw.dd, - DDPCAPS_8BIT | DDPCAPS_ALLOW256, - pal, &DirectDrawState.lpDDP, NULL); + DDPCAPS_8BIT | DDPCAPS_ALLOW256, pal, &DirectDrawState.lpDDP, NULL); if(SUCCEEDED(ddrval)) { - ddrval = DirectDraw_SetPalette(0); + ddrval = DirectDraw_SetPalette(0); } return ddrval; } @@ -1464,7 +1460,7 @@ HRESULT DirectDraw_SetPaletteEntries( int start, int count, PALETTEENTRY *palett { HRESULT ddrval = DDERR_NOPALETTEATTACHED; if( DirectDrawState.lpDDP ) - ddrval = IDirectDrawPalette_SetEntries( DirectDrawState.lpDDP, 0, start, count, palette ); + ddrval = IDirectDrawPalette_SetEntries( DirectDrawState.lpDDP, 0, start, count, palette ); return ddrval; } @@ -1654,20 +1650,20 @@ static int DirectDraw_BltFastStub4(LPDIRECTDRAWSURFACE7 dstsurf, DWORD x, DWORD while(FAILED(ddrval = IDirectDrawSurface7_BltFast( dstsurf, x, y, srcsurf, srcrect, DDBLTFAST_NOCOLORKEY | DDBLTFAST_WAIT ))) { - if (ddrval == DDERR_SURFACELOST) - { - ddrval = restoresurface ( dstsurf ); - if (FAILED(ddrval)) - break; - } - else if (ddrval != DDERR_SURFACEBUSY) - { + if (ddrval == DDERR_SURFACELOST) + { + ddrval = restoresurface ( dstsurf ); + if (FAILED(ddrval)) + break; + } + else if (ddrval != DDERR_SURFACEBUSY) + { write_log("BltFastStub7(): DirectDrawSURFACE7_BltFast() failed with %s\n", DXError (ddrval)); - break; - } + break; + } } if(SUCCEEDED(ddrval)) - result = 1; + result = 1; return result; } @@ -1691,27 +1687,27 @@ HRESULT DirectDraw_BltFast( surface_type_e dsttype, DWORD left, DWORD top, surfa LPDIRECTDRAWSURFACE7 lpDDS4_dst, lpDDS4_src; if( dsttype == primary_surface ) { - lpDDS4_dst = DirectDrawState.primary.surface; + lpDDS4_dst = DirectDrawState.primary.surface; } else if (dsttype == temporary_surface) { - lpDDS4_dst = DirectDrawState.temporary.surface; + lpDDS4_dst = DirectDrawState.temporary.surface; } else { - lpDDS4_dst = DirectDrawState.secondary.surface; + lpDDS4_dst = DirectDrawState.secondary.surface; } if( srctype == primary_surface ) { - lpDDS4_src = DirectDrawState.primary.surface; + lpDDS4_src = DirectDrawState.primary.surface; } else if (srctype == temporary_surface) { - lpDDS4_src = DirectDrawState.temporary.surface; + lpDDS4_src = DirectDrawState.temporary.surface; } else { - lpDDS4_src = DirectDrawState.secondary.surface; + lpDDS4_src = DirectDrawState.secondary.surface; } return DirectDraw_BltFastStub4( lpDDS4_dst, left, top, lpDDS4_src, srcrect ); } @@ -1738,22 +1734,22 @@ static HRESULT DirectDraw_BltStub(LPDIRECTDRAWSURFACE7 dstsurf, LPRECT dstrect, while(FAILED(ddrval = IDirectDrawSurface7_Blt(dstsurf, dstrect, srcsurf, srcrect, flags, ddbltfx))) { - if (ddrval == DDERR_SURFACELOST) - { + if (ddrval == DDERR_SURFACELOST) + { if (errcnt > 10) return 1; errcnt++; - ddrval = restoresurface ( dstsurf ); - if (FAILED(ddrval)) - { - break; - } - } - else if (ddrval != DDERR_SURFACEBUSY) - { + ddrval = restoresurface ( dstsurf ); + if (FAILED(ddrval)) + { + break; + } + } + else if (ddrval != DDERR_SURFACEBUSY) + { write_log("BltStub(): DirectDrawSURFACE7_Blt() failed with %s\n", DXError (ddrval)); - break; - } + break; + } } return ddrval; } @@ -1789,7 +1785,7 @@ int DirectDraw_Flip(int wait) } else if (currprefs.gfx_vsync) { if (vblank_skip >= 0) { skip++; - if (vblank_skip > skip) { + if (vblank_skip > skip) { ddrval = IDirectDrawSurface7_Flip(DirectDrawState.primary.surface, NULL, flags | DDFLIP_NOVSYNC); } else { skip = 0; @@ -1823,7 +1819,7 @@ int DirectDraw_Flip(int wait) return 1; } if(SUCCEEDED(ddrval)) { - result = 1; + result = 1; } else { if (ddrval == DDERR_SURFACELOST) { static int recurse; @@ -1856,8 +1852,8 @@ int DirectDraw_Flip(int wait) * */ HRESULT DirectDraw_Blt(surface_type_e dsttype, LPRECT dstrect, - surface_type_e srctype, LPRECT srcrect, - DWORD flags, LPDDBLTFX fx) + surface_type_e srctype, LPRECT srcrect, + DWORD flags, LPDDBLTFX fx) { LPDIRECTDRAWSURFACE7 lpDDS4_dst, lpDDS4_src; @@ -1870,15 +1866,15 @@ HRESULT DirectDraw_Blt(surface_type_e dsttype, LPRECT dstrect, } else if( dsttype == secondary_surface ) { - lpDDS4_dst = DirectDrawState.secondary.surface; + lpDDS4_dst = DirectDrawState.secondary.surface; } else if( dsttype == tertiary_surface ) { - lpDDS4_dst = DirectDrawState.tertiary.surface; + lpDDS4_dst = DirectDrawState.tertiary.surface; } else if( dsttype == temporary_surface ) { - lpDDS4_dst = DirectDrawState.temporary.surface; + lpDDS4_dst = DirectDrawState.temporary.surface; } else { @@ -1887,15 +1883,15 @@ HRESULT DirectDraw_Blt(surface_type_e dsttype, LPRECT dstrect, if( srctype == primary_surface ) { - lpDDS4_src = DirectDrawState.primary.surface; + lpDDS4_src = DirectDrawState.primary.surface; } else if( srctype == secondary_surface ) { - lpDDS4_src = DirectDrawState.secondary.surface; + lpDDS4_src = DirectDrawState.secondary.surface; } else if( srctype == tertiary_surface ) { - lpDDS4_src = DirectDrawState.tertiary.surface; + lpDDS4_src = DirectDrawState.tertiary.surface; } else if( srctype == temporary_surface ) { @@ -2007,11 +2003,11 @@ HRESULT DirectDraw_GetDC( HDC *hdc, surface_type_e surface ) { HRESULT result = ~DD_OK; if( surface == primary_surface ) - result = IDirectDrawSurface7_GetDC (DirectDrawState.primary.surface, hdc); + result = IDirectDrawSurface7_GetDC (DirectDrawState.primary.surface, hdc); else if (surface == overlay_surface) - result = IDirectDrawSurface7_GetDC (DirectDrawState.overlay.surface, hdc); + result = IDirectDrawSurface7_GetDC (DirectDrawState.overlay.surface, hdc); else if (surface == secondary_surface) - result = IDirectDrawSurface7_GetDC (DirectDrawState.secondary.surface, hdc); + result = IDirectDrawSurface7_GetDC (DirectDrawState.secondary.surface, hdc); return result; } @@ -2034,11 +2030,11 @@ HRESULT DirectDraw_ReleaseDC( HDC hdc, surface_type_e surface ) { HRESULT result; if( surface == primary_surface ) - result = IDirectDrawSurface7_ReleaseDC( DirectDrawState.primary.surface, hdc ); + result = IDirectDrawSurface7_ReleaseDC( DirectDrawState.primary.surface, hdc ); else if (surface == overlay_surface) - result = IDirectDrawSurface7_ReleaseDC( DirectDrawState.overlay.surface, hdc ); + result = IDirectDrawSurface7_ReleaseDC( DirectDrawState.overlay.surface, hdc ); else - result = IDirectDrawSurface7_ReleaseDC( DirectDrawState.secondary.surface, hdc ); + result = IDirectDrawSurface7_ReleaseDC( DirectDrawState.secondary.surface, hdc ); return result; } diff --git a/od-win32/fsdb_win32.c b/od-win32/fsdb_win32.c index 96f7997f..75088912 100755 --- a/od-win32/fsdb_win32.c +++ b/od-win32/fsdb_win32.c @@ -21,7 +21,7 @@ #define TRACING_ENABLED 0 #if TRACING_ENABLED -#define TRACE(x) do { write_log x; } while(0) +#define TRACE(x) do { write_log x; } while(0) #else #define TRACE(x) #endif @@ -93,14 +93,14 @@ static int write_uaefsdb (const char *dir, uae_u8 *fsdb) p = make_uaefsdbpath (dir, NULL); h = CreateFile (dir, GENERIC_READ, 0, - NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (h != INVALID_HANDLE_VALUE) { if (GetFileTime (h, &t1, &t2, &t3)) time_valid = TRUE; CloseHandle (h); } h = CreateFile (p, GENERIC_WRITE, 0, - NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (h == INVALID_HANDLE_VALUE && GetLastError () == ERROR_ACCESS_DENIED) { attr = GetFileAttributes (p); if (attr != INVALID_FILE_ATTRIBUTES) { @@ -183,11 +183,11 @@ int fsdb_name_invalid (const char *n) int l = strlen (n), ll; if (a >= 'a' && a <= 'z') - a -= 32; + a -= 32; if (b >= 'a' && b <= 'z') - b -= 32; + b -= 32; if (c >= 'a' && c <= 'z') - c -= 32; + c -= 32; /* reserved dos devices */ ll = 0; @@ -208,8 +208,8 @@ int fsdb_name_invalid (const char *n) /* these characters are *never* allowed */ for (i = 0; i < NUM_EVILCHARS; i++) { - if (strchr (n, evilchars[i]) != 0) - return 1; + if (strchr (n, evilchars[i]) != 0) + return 1; } /* the reserved fsdb filename */ @@ -349,13 +349,13 @@ char *fsdb_create_unique_nname (a_inode *base, const char *suggestion) /* replace the evil ones... */ for (i=0; i < NUM_EVILCHARS; i++) - while ((c = strchr (tmp, evilchars[i])) != 0) - *c = '_'; + while ((c = strchr (tmp, evilchars[i])) != 0) + *c = '_'; while ((c = strchr (tmp, '.')) != 0) - *c = '_'; + *c = '_'; while ((c = strchr (tmp, ' ')) != 0) - *c = '_'; + *c = '_'; for (;;) { char *p = build_nname (base->nname, tmp); @@ -658,15 +658,15 @@ int my_truncate (const char *name, long int len) if ((hFile = CreateFile (name, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ) ) != INVALID_HANDLE_VALUE ) { - if (SetFilePointer (hFile, len, NULL, FILE_BEGIN) == (DWORD)len) { - if (SetEndOfFile (hFile) == TRUE) - result = 0; - } else { - write_log ("truncate: SetFilePointer() failure for %s to posn %d\n", name, len); - } - CloseHandle( hFile ); + if (SetFilePointer (hFile, len, NULL, FILE_BEGIN) == (DWORD)len) { + if (SetEndOfFile (hFile) == TRUE) + result = 0; + } else { + write_log ("truncate: SetFilePointer() failure for %s to posn %d\n", name, len); + } + CloseHandle( hFile ); } else { - write_log ("truncate: CreateFile() failed to open %s\n", name); + write_log ("truncate: CreateFile() failed to open %s\n", name); } return result; } @@ -708,8 +708,8 @@ int dos_errno (void) return ERROR_SEEK_ERROR; default: - write_log ("Unimplemented error %d\n", e); - return ERROR_NOT_IMPLEMENTED; + write_log ("Unimplemented error %d\n", e); + return ERROR_NOT_IMPLEMENTED; } } diff --git a/od-win32/ioport.c b/od-win32/ioport.c index a89347b6..6816480a 100755 --- a/od-win32/ioport.c +++ b/od-win32/ioport.c @@ -47,9 +47,9 @@ int ioport_init (void) return 0; } __try { - initialized = pInitializeWinIo(); + initialized = pInitializeWinIo(); } __except (EXCEPTION_EXECUTE_HANDLER) { - initialized = 0; + initialized = 0; } #else initialized = 1; @@ -64,7 +64,7 @@ void ioport_free (void) if (initialized) { pShutdownWinIo(); FreeLibrary (ioh); - io_log ("io freed\n"); + io_log ("io freed\n"); } #endif initialized = 0; @@ -119,7 +119,7 @@ void paraport_free (void) if (para) { if (pport) pp_closeport (pport); - pport = 0; + pport = 0; FreeLibrary (para); para = 0; } diff --git a/od-win32/keyboard_win32.c b/od-win32/keyboard_win32.c index e91997a5..4196318a 100755 --- a/od-win32/keyboard_win32.c +++ b/od-win32/keyboard_win32.c @@ -165,16 +165,14 @@ static struct uae_input_device_kbr_default keytrans[] = { { DIK_SYSRQ, INPUTEVENT_KEY_6E }, { DIK_F12, INPUTEVENT_KEY_6F }, { DIK_INSERT, INPUTEVENT_KEY_47 }, - { DIK_NEXT, INPUTEVENT_KEY_48 }, - { DIK_PRIOR, INPUTEVENT_KEY_49 }, + { DIK_PRIOR, INPUTEVENT_KEY_48 }, + { DIK_NEXT, INPUTEVENT_KEY_49 }, { DIK_F11, INPUTEVENT_KEY_4B }, - { DIK_STOP, INPUTEVENT_KEY_CDTV_STOP }, + { DIK_MEDIASTOP, INPUTEVENT_KEY_CDTV_STOP }, { DIK_PLAYPAUSE, INPUTEVENT_KEY_CDTV_PLAYPAUSE }, - { DIK_PREVTRACK, INPUTEVENT_KEY_CDTV_REW }, - { DIK_NEXTTRACK, INPUTEVENT_KEY_CDTV_FF }, - { DIK_WEBBACK, INPUTEVENT_KEY_76 }, - { DIK_WEBFORWARD, INPUTEVENT_KEY_77 }, + { DIK_PREVTRACK, INPUTEVENT_KEY_CDTV_PREV }, + { DIK_NEXTTRACK, INPUTEVENT_KEY_CDTV_NEXT }, { -1, 0 } }; @@ -220,7 +218,7 @@ int getcapslock (void) GetKeyboardState (keyState); newstate = keyState[VK_CAPITAL] & 1; if (newstate != capslockstate) - inputdevice_translatekeycode (0, DIK_CAPITAL, newstate); + inputdevice_translatekeycode (0, DIK_CAPITAL, newstate); capslockstate = newstate; return capslockstate; } @@ -312,69 +310,19 @@ static int np[] = { DIK_NUMPAD0, 0, DIK_NUMPADPERIOD, 0, DIK_NUMPAD1, 1, DIK_NUM #define STEALTHF_SPECIAL 0x02 #define STEALTHF_E1KEY 0x01 -#define RAW_HOME 0x70 -#define RAW_END 0x71 -#define RAW_BREAK 0x6e -#define RAW_F12 0x6f -#define RAW_INSERT 0x47 -#define RAW_PAGEUP 0x48 -#define RAW_PAGEDOWN 0x49 -#define RAW_F11 0x4b -#define RAW_STOP 0x72 -#define RAW_PLAY 0x73 -#define RAW_PREVIOUS 0x74 -#define RAW_NEXT 0x75 -#define RAW_REWIND 0x76 -#define RAW_FORWARD 0x77 - static void sendmmcodes(int code, int newstate) { uae_u8 b; - switch (code) - { - case DIK_END: - code=RAW_END; - break; - case DIK_HOME: - code=RAW_HOME; - break; - case DIK_F11: - code=RAW_F11; - break; - case DIK_INSERT: - code=RAW_INSERT; - break; - case DIK_PRIOR: - code=RAW_PAGEUP; - break; - case DIK_PAUSE: - code=RAW_BREAK; - break; - case DIK_MEDIASTOP: - code=RAW_STOP; - break; - case DIK_PLAYPAUSE: - code=RAW_PLAY; - break; - case DIK_NEXTTRACK: - code=RAW_NEXT; - break; - case DIK_PREVTRACK: - code=RAW_PREVIOUS; - break; - } - - code |= 0xe000; b = RAW_STEALTH | IECODE_UP_PREFIX; record_key(((b << 1) | (b >> 7)) & 0xff); b = IECODE_UP_PREFIX; - if ((code >> 8) == 0xe0) - b |= STEALTHF_E0KEY; - if ((code >> 8) == 0xe1) - b |= STEALTHF_E1KEY; + if ((code >> 8) == 0x01) + b |= STEALTHF_E0KEY; + if ((code >> 8) == 0x02) + b |= STEALTHF_E1KEY; if (!newstate) - b |= STEALTHF_UPSTROKE; + b |= STEALTHF_UPSTROKE; record_key(((b << 1) | (b >> 7)) & 0xff); b = ((code >> 4) & 0x0f) | IECODE_UP_PREFIX; record_key(((b << 1) | (b >> 7)) & 0xff); @@ -395,7 +343,7 @@ void my_kbd_handler (int keyboard, int scancode, int newstate) if (ctrlpressed ()) { code = AKS_TOGGLEFULLSCREEN; } else if (shiftpressed () || endpressed ()) { - disablecapture (); + disablecapture (); code = AKS_ENTERDEBUGGER; } else { code = AKS_ENTERGUI; @@ -539,11 +487,11 @@ void my_kbd_handler (int keyboard, int scancode, int newstate) if (currprefs.input_selected_setting == 0) { #ifdef CD32 - if (handlecd32 (scancode, newstate)) + if (handlecd32 (scancode, newstate)) return; #endif #ifdef ARCADIA - if (handlearcadia (scancode, newstate)) + if (handlearcadia (scancode, newstate)) return; #endif } @@ -551,7 +499,7 @@ void my_kbd_handler (int keyboard, int scancode, int newstate) return; if (currprefs.mmkeyboard) - sendmmcodes(scancode, newstate); + sendmmcodes(scancode, newstate); } void keyboard_settrans (void) diff --git a/od-win32/midi.c b/od-win32/midi.c index 6e776f66..c0e57311 100755 --- a/od-win32/midi.c +++ b/od-win32/midi.c @@ -42,15 +42,15 @@ //#define TRACING_ENABLED #ifdef TRACING_ENABLED -#define TRACE(x) do { write_log x; } while(0) +#define TRACE(x) do { write_log x; } while(0) #else #define TRACE(x) #endif #define MIDI_INBUFFERS 800 //use 13 MB Buffer with this settings - //on my system it work ok with 10 but who - //know when windows rest for a while - //with sysex size of 40 win can 8 sec sleep -#define INBUFFLEN 16000 //if this is not enough a warning come + //on my system it work ok with 10 but who + //know when windows rest for a while + //with sysex size of 40 win can 8 sec sleep +#define INBUFFLEN 16000 //if this is not enough a warning come static int overflow,only_one_time; BOOL midi_ready = FALSE; BOOL midi_in_ready = FALSE; @@ -122,27 +122,27 @@ static int MidiOut_Alloc( void ) if( !out_allocated ) { - for( i = 0; i < MIDI_BUFFERS; i++ ) - { - if( !outbuffer[ i ] ) - { - outbuffer[ i ] = (char *)xmalloc( BUFFLEN ); - if( outbuffer[ i ] ) - { - outbufferlength[ i ] = BUFFLEN; - out_allocated++; - } - else - { - outbufferlength[ i ] = 0; - } - } - } - outbufferselect = 0; + for( i = 0; i < MIDI_BUFFERS; i++ ) + { + if( !outbuffer[ i ] ) + { + outbuffer[ i ] = (char *)xmalloc( BUFFLEN ); + if( outbuffer[ i ] ) + { + outbufferlength[ i ] = BUFFLEN; + out_allocated++; + } + else + { + outbufferlength[ i ] = 0; + } + } + } + outbufferselect = 0; } else { - write_log( "MIDI: ERROR - MidiOutAlloc() called twice?\n" ); + write_log( "MIDI: ERROR - MidiOutAlloc() called twice?\n" ); } return( out_allocated ); } @@ -168,16 +168,16 @@ static void MidiOut_Free( void ) for( i = 0; i < out_allocated; i++ ) { - if( outbuffer[ i ] ) + if( outbuffer[ i ] ) { - //out_allocated--; - free( outbuffer[i] ); - outbufferlength[ i ] = 0; - outbuffer[ i ] = NULL; - } + //out_allocated--; + free( outbuffer[i] ); + outbufferlength[ i ] = 0; + outbuffer[ i ] = NULL; + } } outbufferselect = 0; - out_allocated = 0; + out_allocated = 0; } /* @@ -211,8 +211,8 @@ static int MidiOut_PrepareHeader( LPMIDIHDR out, LPSTR data, DWORD length ) if( ( result = midiOutPrepareHeader( outHandle, out, sizeof( MIDIHDR ) ) ) ) { - write_log( "MIDI: error %s / %d\n", getmidiouterr(result), result ); - result = 0; + write_log( "MIDI: error %s / %d\n", getmidiouterr(result), result ); + result = 0; } return result; } @@ -266,26 +266,26 @@ static int MidiIn_Alloc( void ) if( !in_allocated ) { - for( i = 0; i < MIDI_INBUFFERS; i++ ) - { - if( !inbuffer[ i ] ) + for( i = 0; i < MIDI_INBUFFERS; i++ ) + { + if( !inbuffer[ i ] ) { - inbuffer[ i ] = (char *)xmalloc( INBUFFLEN ); - if( inbuffer[ i ] ) - { - inbufferlength[ i ] = INBUFFLEN; - in_allocated++; - } - else - { - inbufferlength[ i ] = 0; - } - } - } + inbuffer[ i ] = (char *)xmalloc( INBUFFLEN ); + if( inbuffer[ i ] ) + { + inbufferlength[ i ] = INBUFFLEN; + in_allocated++; + } + else + { + inbufferlength[ i ] = 0; + } + } + } } else { - write_log( "MIDI: ERROR - MidiInAlloc() called twice?\n" ); + write_log( "MIDI: ERROR - MidiInAlloc() called twice?\n" ); } return( in_allocated ); } @@ -311,13 +311,13 @@ static void MidiIn_Free( void ) for( i = 0; i < in_allocated; i++ ) { - if( inbuffer[ i ] ) - { - //in_allocated--; - free( inbuffer[i] ); - inbufferlength[ i ] = 0; - inbuffer[ i ] = NULL; - } + if( inbuffer[ i ] ) + { + //in_allocated--; + free( inbuffer[i] ); + inbufferlength[ i ] = 0; + inbuffer[ i ] = NULL; + } } in_allocated = 0; only_one_time = 0; @@ -363,126 +363,126 @@ int Midi_Parse( midi_direction_e direction, BYTE *dataptr ) if( direction == midi_output ) { BYTE data = *dataptr; - DBGOUT_MIDI_BYTE( data ); - if( data >= 0x80 ) - { - if( data >= MIDI_CLOCK ) - { - switch( data ) - { - case MIDI_CLOCK: + DBGOUT_MIDI_BYTE( data ); + if( data >= 0x80 ) + { + if( data >= MIDI_CLOCK ) + { + switch( data ) + { + case MIDI_CLOCK: - TRACE(( "MIDI: MIDI_CLOCK\n" )); - break; - case MIDI_START: + TRACE(( "MIDI: MIDI_CLOCK\n" )); + break; + case MIDI_START: - TRACE(( "MIDI: MIDI_START\n" )); - break; - case MIDI_CONTINUE: + TRACE(( "MIDI: MIDI_START\n" )); + break; + case MIDI_CONTINUE: - TRACE(( "MIDI: MIDI_CONTINUE\n" )); - break; - case MIDI_STOP: + TRACE(( "MIDI: MIDI_CONTINUE\n" )); + break; + case MIDI_STOP: - TRACE(( "MIDI: MIDI_STOP\n" )); - break; - default: + TRACE(( "MIDI: MIDI_STOP\n" )); + break; + default: - break; - } - } + break; + } + } /* - else if( data == MIDI_MTC ) - { - out_status.timecode = 1; - } + else if( data == MIDI_MTC ) + { + out_status.timecode = 1; + } */ - else if( out_status.sysex ) - { - if( out_allocated ) - { - bufferpoint[ bufferindex++ ] = (char)MIDI_EOX; - if( bufferindex >= BUFFLEN ) - bufferindex = BUFFLEN - 1; - out_status.status = MIDI_SYSX; - // Flush this buffer using midiOutLongMsg - MidiOut_PrepareHeader( &midiout[ outbufferselect ], bufferpoint, bufferindex ); - midiOutLongMsg( outHandle, &midiout[ outbufferselect ], sizeof( MIDIHDR ) ); - - outbufferselect = !outbufferselect; - bufferpoint = outbuffer[ outbufferselect ]; - midiOutUnprepareHeader( outHandle, &midiout[ outbufferselect ], sizeof( MIDIHDR ) ); - } - out_status.sysex = 0; // turn off MIDI_SYSX mode - out_status.unknown = 1; // now in an unknown state - if( data == MIDI_EOX ) - return 0; - } - out_status.status = data; - out_status.length = plen[ data & 0x7F ]; - out_status.posn = 0; - out_status.unknown = 0; - if( data == MIDI_SYSX ) - { - out_status.sysex = 1; // turn on MIDI_SYSX mode - if( out_allocated ) - { - bufferindex = 0; - bufferpoint = outbuffer[ outbufferselect ]; - bufferpoint[ bufferindex++ ] = (char)MIDI_SYSX; - } - return 0; - } - } // data & 0x80 + else if( out_status.sysex ) + { + if( out_allocated ) + { + bufferpoint[ bufferindex++ ] = (char)MIDI_EOX; + if( bufferindex >= BUFFLEN ) + bufferindex = BUFFLEN - 1; + out_status.status = MIDI_SYSX; + // Flush this buffer using midiOutLongMsg + MidiOut_PrepareHeader( &midiout[ outbufferselect ], bufferpoint, bufferindex ); + midiOutLongMsg( outHandle, &midiout[ outbufferselect ], sizeof( MIDIHDR ) ); + + outbufferselect = !outbufferselect; + bufferpoint = outbuffer[ outbufferselect ]; + midiOutUnprepareHeader( outHandle, &midiout[ outbufferselect ], sizeof( MIDIHDR ) ); + } + out_status.sysex = 0; // turn off MIDI_SYSX mode + out_status.unknown = 1; // now in an unknown state + if( data == MIDI_EOX ) + return 0; + } + out_status.status = data; + out_status.length = plen[ data & 0x7F ]; + out_status.posn = 0; + out_status.unknown = 0; + if( data == MIDI_SYSX ) + { + out_status.sysex = 1; // turn on MIDI_SYSX mode + if( out_allocated ) + { + bufferindex = 0; + bufferpoint = outbuffer[ outbufferselect ]; + bufferpoint[ bufferindex++ ] = (char)MIDI_SYSX; + } + return 0; + } + } // data & 0x80 /* - else if( out_status.timecode ) - { - out_status.timecode = 0; - out_status.status = MIDI_MTC; - out_status.byte1 = data; - // process MIDI_MTC msg - write_log( "MIDI OUT: MIDI_MTC message\n" ); - return 0; - }*/ - else if( out_status.sysex ) - { - if( out_allocated ) - { - bufferpoint[ bufferindex++ ] = data; - if( bufferindex >= BUFFLEN ) - bufferindex = BUFFLEN - 1; - } - return 0; - } - else if( out_status.unknown ) - { - return 0; - } - else if( ++out_status.posn == 1 ) - { - out_status.byte1 = data; - } - else - { - out_status.byte2 = data; - } - if( out_status.posn >= out_status.length ) - { - out_status.posn = 0; - /* if( out_status.status == MIDI_SONGPP ) - { - // Handle this by doing a process-midi-clock ?? - write_log( "MIDI OUT: MIDI_SONGPP message\n" ); - return 0; - } - else*/ - { - // flush the packet using midiOutShortMessage - DWORD shortMsg = MAKELONG( MAKEWORD( out_status.status, out_status.byte1 ), MAKEWORD( out_status.byte2, 0 ) ); - midiOutShortMsg( outHandle, shortMsg ); + else if( out_status.timecode ) + { + out_status.timecode = 0; + out_status.status = MIDI_MTC; + out_status.byte1 = data; + // process MIDI_MTC msg + write_log( "MIDI OUT: MIDI_MTC message\n" ); + return 0; + }*/ + else if( out_status.sysex ) + { + if( out_allocated ) + { + bufferpoint[ bufferindex++ ] = data; + if( bufferindex >= BUFFLEN ) + bufferindex = BUFFLEN - 1; + } + return 0; + } + else if( out_status.unknown ) + { + return 0; + } + else if( ++out_status.posn == 1 ) + { + out_status.byte1 = data; + } + else + { + out_status.byte2 = data; + } + if( out_status.posn >= out_status.length ) + { + out_status.posn = 0; + /* if( out_status.status == MIDI_SONGPP ) + { + // Handle this by doing a process-midi-clock ?? + write_log( "MIDI OUT: MIDI_SONGPP message\n" ); + return 0; + } + else*/ + { + // flush the packet using midiOutShortMessage + DWORD shortMsg = MAKELONG( MAKEWORD( out_status.status, out_status.byte1 ), MAKEWORD( out_status.byte2, 0 ) ); + midiOutShortMsg( outHandle, shortMsg ); - } - } + } + } } else // handle input-data { @@ -557,8 +557,8 @@ LONG getmidibyte(void) //return midibyte or -1 if none TRACE(("getmidibyte(%02.2X)\n", midibuf[midi_inptr])); if (midibuf[midi_inptr] >= 0xf0) // only check for free buffers if status sysex { - for (i = 0;i < MIDI_INBUFFERS;i++) - { + for (i = 0;i < MIDI_INBUFFERS;i++) + { if (midiin[i].dwFlags==(MHDR_DONE|MHDR_PREPARED)){ // add a buffer if one is free /* midiInUnprepareHeader( inHandle,&midiin[i], sizeof(MIDIHDR)); @@ -582,7 +582,7 @@ LONG getmidibyte(void) //return midibyte or -1 if none return rv; } -static void CALLBACK MidiInProc(HMIDIIN hMidiIn,UINT wMsg,DWORD_PTR dwInstance,DWORD_PTR dwParam1,DWORD_PTR dwParam2) +static void CALLBACK MidiInProc(HMIDIIN hMidiIn,UINT wMsg,DWORD_PTR dwInstance,DWORD_PTR dwParam1,DWORD_PTR dwParam2) { EnterCriticalSection (&cs_proc); if(wMsg == MIM_ERROR) @@ -599,7 +599,7 @@ static void CALLBACK MidiInProc(HMIDIIN hMidiIn,UINT wMsg,DWORD_PTR dwInstance,D { overflow = 1; TRACE(("MIDI overflow1\n")); - //for safeness if buffer too full (should not occur) + //for safeness if buffer too full (should not occur) goto end; } @@ -623,7 +623,7 @@ static void CALLBACK MidiInProc(HMIDIIN hMidiIn,UINT wMsg,DWORD_PTR dwInstance,D TRACE(("%s %08.8X\n", wMsg == MM_MIM_DATA ? "MM_MIM_DATA" : "MM_MIM_MOREDATA", dwParam1)); if(state == 254) goto end; if(state < 0xf0) state = state & 0xf0; - //else {add1byte(state); goto end;} + //else {add1byte(state); goto end;} switch (state) { case 0x80: //Note OFF @@ -707,21 +707,21 @@ int Midi_Open( void ) if( ( result = midiOutOpen( &outHandle, currprefs.win32_midioutdev, 0, 0,CALLBACK_NULL ) ) ) { - write_log( "MIDI OUT: error %s / %d while opening port %d\n", getmidiouterr(result), result, currprefs.win32_midioutdev ); - result = 0; + write_log( "MIDI OUT: error %s / %d while opening port %d\n", getmidiouterr(result), result, currprefs.win32_midioutdev ); + result = 0; } else { - InitializeCriticalSection(&cs_proc); + InitializeCriticalSection(&cs_proc); // We don't need input for output... - if( ( currprefs.win32_midiindev >= 0 ) && + if( ( currprefs.win32_midiindev >= 0 ) && ( result = midiInOpen( &inHandle, currprefs.win32_midiindev, (DWORD_PTR)MidiInProc, 0, CALLBACK_FUNCTION|MIDI_IO_STATUS) ) ) - { - write_log( "MIDI IN: error %s / %d while opening port %d\n", getmidiinerr(result), result, currprefs.win32_midiindev ); - } - else - { - + { + write_log( "MIDI IN: error %s / %d while opening port %d\n", getmidiinerr(result), result, currprefs.win32_midiindev ); + } + else + { + midi_in_ready = TRUE; result=midiInStart(inHandle); } @@ -747,7 +747,7 @@ int Midi_Open( void ) result=midiInPrepareHeader(inHandle,&midiin[i], sizeof(MIDIHDR)); result=midiInAddBuffer(inHandle,&midiin[i],sizeof(MIDIHDR)); } - } + } } midi_ready = TRUE; result = 1; @@ -792,11 +792,11 @@ void Midi_Close( void ) for( i = 0; i < MIDI_BUFFERS; i++ ) { while( MIDIERR_STILLPLAYING == midiOutUnprepareHeader( outHandle, &midiout[i], sizeof(MIDIHDR) ) ) - { + { Sleep(100); } } - MidiOut_Free(); + MidiOut_Free(); midiOutClose( outHandle ); if( midi_in_ready ) @@ -804,7 +804,7 @@ void Midi_Close( void ) //while( MIDIERR_STILLPLAYING == midiInUnprepareHeader( inHandle, &midiin, sizeof(MIDIHDR)) ) - exitin=1;//for safeness sure no callback come now + exitin=1;//for safeness sure no callback come now midiInReset(inHandle); for (i=0;i> 20); } @@ -153,7 +153,7 @@ void mapped_free(uae_u8 *mem) else { //free( x->native_address ); - VirtualFree((LPVOID)mem, 0, os_winnt ? MEM_RESET : (MEM_DECOMMIT | MEM_RELEASE)); + VirtualFree((LPVOID)mem, 0, os_winnt ? MEM_RESET : (MEM_DECOMMIT | MEM_RELEASE)); } } x = x->next; @@ -242,7 +242,7 @@ void *shmat(int shmid, void *shmaddr, int shmflg) if(!strcmp(shmids[shmid].name,"z3")) { shmaddr=natmem_offset+0x10000000; if (allocated_z3fastmem<0x1000000) - gfxoffs=0x1000000; + gfxoffs=0x1000000; else gfxoffs=allocated_z3fastmem; got = TRUE; @@ -314,18 +314,15 @@ int shmget(key_t key, size_t size, int shmflg, char *name) { write_log( "shmget of size %d (%dk) for %s\n", size, size >> 10, name ); if( ( result = get_next_shmkey() ) != -1 ) - { - - //blah = VirtualAlloc( 0, size,MEM_COMMIT, PAGE_EXECUTE_READWRITE ); - - shmids[result].size = size; - strcpy( shmids[result].name, name ); - } - - else - { - result = -1; - } + { + //blah = VirtualAlloc( 0, size,MEM_COMMIT, PAGE_EXECUTE_READWRITE ); + shmids[result].size = size; + strcpy( shmids[result].name, name ); + } + else + { + result = -1; + } } return result; } @@ -359,12 +356,11 @@ int isinf( double x ) const int nClass = _fpclass(x); int result; if (nClass == _FPCLASS_NINF || nClass == _FPCLASS_PINF) result = 1; - else - result = 0; + else + result = 0; #else int result = 0; #endif - return result; } @@ -375,7 +371,6 @@ int isnan( double x ) #else int result = 0; #endif - return result; } diff --git a/od-win32/parser.c b/od-win32/parser.c index eace8349..12f00c7f 100755 --- a/od-win32/parser.c +++ b/od-win32/parser.c @@ -119,15 +119,15 @@ static void freepsbuffers (void) static int openprinter_ps (void) { char *gsargv[] = { - "-dNOPAUSE", "-dBATCH", "-dNOPAGEPROMPT", "-dNOPROMPT", "-dQUIET", "-dNoCancel", - "-sDEVICE=mswinpr2", NULL + "-dNOPAUSE", "-dBATCH", "-dNOPAGEPROMPT", "-dNOPROMPT", "-dQUIET", "-dNoCancel", + "-sDEVICE=mswinpr2", NULL }; int gsargc, gsargc2, i; char *tmpparms[100]; char tmp[MAX_DPATH]; if (ptr_gsapi_new_instance (&gsinstance, NULL) < 0) - return 0; + return 0; tmpparms[0] = "WinUAE"; gsargc2 = cmdlineparser (currprefs.ghostscript_parameters, tmpparms + 1, 100 - 10) + 1; for (gsargc = 0; gsargv[gsargc]; gsargc++); @@ -156,8 +156,8 @@ static void *prt_thread (void *p) prt_started = 1; SetThreadPriority (GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL); if (load_ghostscript ()) { - if (openprinter_ps ()) { - write_log ("PostScript printing emulation started..\n"); + if (openprinter_ps ()) { + write_log ("PostScript printing emulation started..\n"); cnt = 0; while (buffers[cnt]) { uae_u8 *p = buffers[cnt]; @@ -177,22 +177,20 @@ static void *prt_thread (void *p) } free (buffers); if (ok) { - write_log ("PostScript printing emulation finished..\n"); + write_log ("PostScript printing emulation finished..\n"); ptr_gsapi_run_string_end (gsinstance, 0, &gs_exitcode); } } else { write_log ("gsdll32.dll failed to initialize\n"); } } else { - write_log ("gsdll32.dll failed to load\n"); + write_log ("gsdll32.dll failed to load\n"); } unload_ghostscript (); prt_running--; return 0; } - - static void flushprtbuf (void) { DWORD written = 0; @@ -329,10 +327,10 @@ int load_ghostscript (void) while (cnt-- > 0) { DWORD size1 = sizeof (tmp1); FILETIME ft; - if (RegEnumKeyEx (key, idx, tmp1, &size1, NULL, NULL, NULL, &ft) == ERROR_SUCCESS) { + if (RegEnumKeyEx (key, idx, tmp1, &size1, NULL, NULL, NULL, &ft) == ERROR_SUCCESS) { HKEY key2; if (RegOpenKeyEx (key, tmp1, 0, KEY_ALL_ACCESS, &key2) == ERROR_SUCCESS) { - DWORD type = REG_SZ; + DWORD type = REG_SZ; DWORD size = sizeof (path); if (RegQueryValueEx (key2, "GS_DLL", 0, &type, (LPBYTE)path, &size) == ERROR_SUCCESS) gsdll = LoadLibrary (path); @@ -351,7 +349,7 @@ int load_ghostscript (void) ptr_gsapi_revision = (GSAPI_REVISION)GetProcAddress (gsdll, "gsapi_revision"); if (!ptr_gsapi_revision) { unload_ghostscript (); - return -1; + return -1; } if (ptr_gsapi_revision(&r, sizeof(r))) { unload_ghostscript (); @@ -378,12 +376,12 @@ int load_ghostscript (void) void unload_ghostscript (void) { if (gsinstance) { - ptr_gsapi_exit (gsinstance); - ptr_gsapi_delete_instance (gsinstance); + ptr_gsapi_exit (gsinstance); + ptr_gsapi_delete_instance (gsinstance); } gsinstance = NULL; if (gsdll) - FreeLibrary (gsdll); + FreeLibrary (gsdll); gsdll = NULL; psmode = 0; } @@ -430,7 +428,7 @@ void flushprinter (void) closeprinter(); } -void closeprinter( void ) +void closeprinter( void ) { #ifdef PRINT_DUMP zfile_fclose (prtdump); @@ -467,7 +465,7 @@ int doprinter (uae_u8 val) if (!prtopen) openprinter (); if (prtopen) - putprinter (val); + putprinter (val); return prtopen; } @@ -521,9 +519,9 @@ int openser (char *sername) dcb.Parity = NOPARITY; dcb.StopBits = ONESTOPBIT; - dcb.fDsrSensitivity = FALSE; - dcb.fOutxDsrFlow = FALSE; - dcb.fDtrControl = DTR_CONTROL_DISABLE; + dcb.fDsrSensitivity = FALSE; + dcb.fOutxDsrFlow = FALSE; + dcb.fDtrControl = DTR_CONTROL_DISABLE; if (currprefs.serial_hwctsrts) { dcb.fOutxCtsFlow = TRUE; @@ -562,7 +560,7 @@ void closeser (void) hCom = INVALID_HANDLE_VALUE; } if (midi_ready) - Midi_Close(); + Midi_Close(); if( writeevent ) CloseHandle( writeevent ); writeevent = 0; @@ -573,9 +571,9 @@ static void outser (void) { DWORD actual; if (WaitForSingleObject (writeevent, 0) == WAIT_OBJECT_0 && datainoutput > 0) { - memcpy (outputbufferout, outputbuffer, datainoutput); - WriteFile (hCom, outputbufferout, datainoutput, &actual, &writeol); - datainoutput = 0; + memcpy (outputbufferout, outputbuffer, datainoutput); + WriteFile (hCom, outputbufferout, datainoutput, &actual, &writeol); + datainoutput = 0; } } @@ -584,7 +582,7 @@ void writeser (int c) if (midi_ready) { BYTE outchar = (BYTE)c; - Midi_Parse( midi_output, &outchar ); + Midi_Parse( midi_output, &outchar ); } else { @@ -607,7 +605,7 @@ int checkserwrite (void) if (midi_ready) { return 1; } else { - outser (); + outser (); if (datainoutput >= sizeof (outputbuffer) - 1) return 0; } @@ -657,7 +655,7 @@ int readser (int *buffer) *buffer = inputbuffer[dataininputcnt++]; return 1; } - dataininput = 0; + dataininput = 0; dataininputcnt = 0; if (hCom != INVALID_HANDLE_VALUE) { @@ -705,13 +703,13 @@ void getserstat (int *pstatus) GetCommModemStatus (hCom, &stat); if (stat & MS_CTS_ON) - status |= TIOCM_CTS; + status |= TIOCM_CTS; if (stat & MS_RLSD_ON) - status |= TIOCM_CAR; + status |= TIOCM_CAR; if (stat & MS_DSR_ON) - status |= TIOCM_DSR; + status |= TIOCM_DSR; if (stat & MS_RING_ON) - status |= TIOCM_RI; + status |= TIOCM_RI; *pstatus = status; } @@ -722,7 +720,7 @@ void setserstat (int mask, int onoff) return; if (mask & TIOCM_DTR) - EscapeCommFunction (hCom, onoff ? SETDTR : CLRDTR); + EscapeCommFunction (hCom, onoff ? SETDTR : CLRDTR); if (!currprefs.serial_hwctsrts) { if (mask & TIOCM_RTS) EscapeCommFunction (hCom, onoff ? SETRTS : CLRRTS); @@ -733,36 +731,36 @@ int setbaud (long baud) { if( baud == 31400 && currprefs.win32_midioutdev >= -1) /* MIDI baud-rate */ { - if (!midi_ready) - { - if (Midi_Open()) + if (!midi_ready) + { + if (Midi_Open()) write_log ("Midi enabled\n"); - } - return 1; + } + return 1; } else { - if (midi_ready) - { - Midi_Close(); - } - if (!currprefs.use_serial) + if (midi_ready) + { + Midi_Close(); + } + if (!currprefs.use_serial) return 1; if (hCom != INVALID_HANDLE_VALUE) - { + { if (GetCommState (hCom, &dcb)) - { + { dcb.BaudRate = baud; - if (!SetCommState (hCom, &dcb)) { + if (!SetCommState (hCom, &dcb)) { write_log ("SERIAL: Error setting baud rate %d!\n", baud); return 0; } } - else - { + else + { write_log ("SERIAL: setbaud internal error!\n"); - } - } + } + } } return 1; } @@ -801,8 +799,8 @@ void hsyncstuff(void) keycheck++; if(keycheck==1000) { - flushprtbuf (); - { + flushprtbuf (); + { #if defined(AHI) extern flashscreen; int DX_Fill( int , int , int, int, uae_u32 , enum RGBFTYPE ); @@ -817,8 +815,8 @@ void hsyncstuff(void) keycheck = 0; } if (currprefs.parallel_autoflush_time) { - parflush++; - if (parflush / ((currprefs.ntscmode ? MAXVPOS_NTSC : MAXVPOS_PAL) * MAXHPOS_PAL / maxhpos) >= currprefs.parallel_autoflush_time * 50) { + parflush++; + if (parflush / ((currprefs.ntscmode ? MAXVPOS_NTSC : MAXVPOS_PAL) * MAXHPOS_PAL / maxhpos) >= currprefs.parallel_autoflush_time * 50) { flushprinter (); parflush = 0; } diff --git a/od-win32/picasso96_win.c b/od-win32/picasso96_win.c index 46ce1719..8d042391 100755 --- a/od-win32/picasso96_win.c +++ b/od-win32/picasso96_win.c @@ -10,12 +10,12 @@ * On the Amiga side, a Picasso card consists mainly of a memory area that * contains the frame buffer. On the UAE side, we allocate a block of memory * that will hold the frame buffer. This block is in normal memory, it is -* never directly on the graphics card. All graphics operations, which are +* never directly on the graphics card. All graphics operations, which are * mainly reads and writes into this block and a few basic operations like * filling a rectangle, operate on this block of memory. * Since the memory is not on the graphics card, some work must be done to * synchronize the display with the data in the Picasso frame buffer. There -* are various ways to do this. One possibility is to allocate a second +* are various ways to do this. One possibility is to allocate a second * buffer of the same size, and perform all write operations twice. Since * we never read from the second buffer, it can actually be placed in video * memory. The X11 driver could be made to use the Picasso frame buffer as @@ -65,18 +65,18 @@ int p96hsync_counter; #define P96TRACING_LEVEL 1 #endif #define LOCK_UNLOCK_MADNESS //need for 7 times faster linedraw -#define PIXEL_LOCK //and scrollable screens +#define PIXEL_LOCK //and scrollable screens #define MAXFLUSHPIXEL 3200 //pixel draw in a lock static void flushpixels(void); int pixelcount,palette_changed; struct pixel32{ - uaecptr addr; + uaecptr addr; uae_u32 value; - int size; + int size; }; struct pixel32 pixelbase[MAXFLUSHPIXEL+2]; #ifdef P96TRACING_ENABLED -#define P96TRACE(x) do { write_log x; } while(0) +#define P96TRACE(x) do { write_log x; } while(0) #else #define P96TRACE(x) #endif @@ -203,7 +203,7 @@ void PICASSO96_Lock( void ) #endif } -#ifdef P96TRACING_ENABLED +#ifdef P96TRACING_ENABLED /* * Debugging dumps */ @@ -262,8 +262,6 @@ static void DumpLibResolutionStructure (uaecptr amigalibresptr) } } -v - static char binary_byte[9] = { 0,0,0,0,0,0,0,0,0 }; static char *BuildBinaryString (uae_u8 value) @@ -549,21 +547,21 @@ static void do_fillrect( uae_u8 *src, unsigned int x, unsigned int y, unsigned i * the pen values if we're doing 8-bit display-emulation on a 16-bit or higher screen. */ #ifdef PIXEL_LOCK flushpixels(); -#endif +#endif if( picasso_vidinfo.rgbformat == picasso96_state.RGBFormat ) { - if( DX_Fill( x, y, width, height, pen, rgbtype ) ) - { + if( DX_Fill( x, y, width, height, pen, rgbtype ) ) + { #ifdef LOCK_UNLOCK_MADNESS //PICASSO96_Unlock(); #endif - return; + return; } } else { - if( DX_Fill( x, y, width, height, picasso_vidinfo.clut[src[0]], rgbtype ) ) + if( DX_Fill( x, y, width, height, picasso_vidinfo.clut[src[0]], rgbtype ) ) { #ifdef LOCK_UNLOCK_MADNESS //PICASSO96_Unlock(); @@ -603,37 +601,37 @@ static void do_fillrect( uae_u8 *src, unsigned int x, unsigned int y, unsigned i dst += y*picasso_vidinfo.rowbytes + x*picasso_vidinfo.pixbytes; if (picasso_vidinfo.rgbformat == picasso96_state.RGBFormat) { - if( Bpp == 1 ) - { + if( Bpp == 1 ) + { while (height-- > 0) - { + { memset( dst, pen, width ); dst += picasso_vidinfo.rowbytes; - } - } - else - { + } + } + else + { while (height-- > 0) - { + { memcpy (dst, src, width); dst += picasso_vidinfo.rowbytes; - } - } + } + } } else { int psiz = GetBytesPerPixel (picasso_vidinfo.rgbformat); if (picasso96_state.RGBFormat != RGBFB_CHUNKY) - { - write_log ("ERROR - do_fillrect() calling abort 1!\n"); + { + write_log ("ERROR - do_fillrect() calling abort 1!\n"); abort (); - } + } while (height-- > 0) - { + { unsigned int i; switch (psiz) - { + { case 2: for (i = 0; i < width; i++) *((uae_u16 *)dst + i) = picasso_vidinfo.clut[src[i]]; @@ -645,17 +643,17 @@ static void do_fillrect( uae_u8 *src, unsigned int x, unsigned int y, unsigned i default: write_log ("ERROR - do_fillrect() calling abort 2!\n"); abort (); - break; + break; } dst += picasso_vidinfo.rowbytes; } } out:; -#ifndef LOCK_UNLOCK_MADNESS +#ifndef LOCK_UNLOCK_MADNESS gfx_unlock_picasso (); #else PICASSO96_Unlock(); -#endif +#endif } /* @@ -666,12 +664,12 @@ out:; * the RenderInfo data and our coordinates. */ static void do_blit( struct RenderInfo *ri, int Bpp, - unsigned int srcx, unsigned int srcy, unsigned int dstx, unsigned int dsty, - unsigned int width, unsigned int height, BLIT_OPCODE opcode, int can_do_blit) + unsigned int srcx, unsigned int srcy, unsigned int dstx, unsigned int dsty, + unsigned int width, unsigned int height, BLIT_OPCODE opcode, int can_do_blit) { uae_u8 *dstp, *srcp; int orig_height = height; - + if( picasso96_state.BigAssBitmap && can_do_blit){ srcx=dstx; srcy=dsty; @@ -694,7 +692,7 @@ static void do_blit( struct RenderInfo *ri, int Bpp, flushpixels(); #endif //PICASSO96_Lock(); -#endif +#endif /* Is our x/y origin on-screen? */ if( dsty >= picasso_vidinfo.height ) return; @@ -713,11 +711,11 @@ static void do_blit( struct RenderInfo *ri, int Bpp, // Call OS blitting function that can do it in video memory. // Should return if it was successful // - if( DX_Blit( srcx, srcy, dstx, dsty, width, height, opcode ) ) + if( DX_Blit( srcx, srcy, dstx, dsty, width, height, opcode ) ) return; } #ifdef LOCK_UNLOCK_MADNESS - PICASSO96_Lock(); + PICASSO96_Lock(); #endif srcp = ri->Memory + srcx*Bpp + srcy*ri->BytesPerRow; @@ -726,10 +724,10 @@ static void do_blit( struct RenderInfo *ri, int Bpp, if (! picasso_vidinfo.extra_mem) { #ifdef LOCK_UNLOCK_MADNESS - goto out; + goto out; #else return; - #endif + #endif } #ifdef LOCK_UNLOCK_MADNESS @@ -739,7 +737,7 @@ static void do_blit( struct RenderInfo *ri, int Bpp, #endif if (dstp == 0) { - write_log ("WARNING: do_blit() couldn't lock\n"); + write_log ("WARNING: do_blit() couldn't lock\n"); goto out; } @@ -747,35 +745,35 @@ static void do_blit( struct RenderInfo *ri, int Bpp, * and the destination is a different buffer owned by the graphics code. */ dstp += dsty * picasso_vidinfo.rowbytes + dstx * picasso_vidinfo.pixbytes; P96TRACE(("do_blit with srcp 0x%x, dstp 0x%x, dst_rowbytes %d, srcx %d, srcy %d, dstx %d, dsty %d, w %d, h %d, dst_pixbytes %d\n", - srcp, dstp, picasso_vidinfo.rowbytes, srcx, srcy, dstx, dsty, width, height, picasso_vidinfo.pixbytes)); + srcp, dstp, picasso_vidinfo.rowbytes, srcx, srcy, dstx, dsty, width, height, picasso_vidinfo.pixbytes)); P96TRACE(("gfxmem is at 0x%x\n",gfxmemory)); if (picasso_vidinfo.rgbformat == picasso96_state.RGBFormat) { - P96TRACE(("do_blit type-a\n")); - width *= Bpp; - while (height-- > 0) - { - memcpy (dstp, srcp, width); - srcp += ri->BytesPerRow; - dstp += picasso_vidinfo.rowbytes; - - } + P96TRACE(("do_blit type-a\n")); + width *= Bpp; + while (height-- > 0) + { + memcpy (dstp, srcp, width); + srcp += ri->BytesPerRow; + dstp += picasso_vidinfo.rowbytes; + + } } else { - int psiz = GetBytesPerPixel (picasso_vidinfo.rgbformat); + int psiz = GetBytesPerPixel (picasso_vidinfo.rgbformat); P96TRACE(("do_blit type-b\n")); - if (picasso96_state.RGBFormat != RGBFB_CHUNKY) - { - write_log ("ERROR: do_blit() calling abort 1!\n"); - abort (); - } - while (height-- > 0) - { + if (picasso96_state.RGBFormat != RGBFB_CHUNKY) + { + write_log ("ERROR: do_blit() calling abort 1!\n"); + abort (); + } + while (height-- > 0) + { unsigned int i; switch (psiz) - { + { case 2: for (i = 0; i < width; i++) *((uae_u16 *)dstp + i) = picasso_vidinfo.clut[srcp[i]]; @@ -787,7 +785,7 @@ static void do_blit( struct RenderInfo *ri, int Bpp, default: write_log ("ERROR - do_blit() calling abort 2!\n"); abort (); - break; + break; } srcp += ri->BytesPerRow; dstp += picasso_vidinfo.rowbytes; @@ -814,7 +812,7 @@ static void do_invertrect( struct RenderInfo *ri, int Bpp, int x, int y, int wid P96TRACE(("do_invertrect falling back to do_blit!\n")); do_blit (ri, Bpp, x, y, x, y, width, height, BLIT_SRC, 0); } - + static uaecptr wgfx_linestart; static uaecptr wgfx_lineend; static uaecptr wgfx_min, wgfx_max; @@ -823,7 +821,7 @@ static unsigned long wgfx_y; static void wgfx_do_flushline (void) { uae_u8 *src, *dstp; - + /* Mark these lines as "dirty" */ DX_Invalidate (wgfx_y, wgfx_y); @@ -832,7 +830,7 @@ static void wgfx_do_flushline (void) #ifdef LOCK_UNLOCK_MADNESS dstp = picasso96_state.HostAddress; - + #else dstp = gfx_lock_picasso (); #endif @@ -884,7 +882,7 @@ out: #ifndef LOCK_UNLOCK_MADNESS gfx_unlock_picasso (); #endif - + wgfx_linestart = 0xFFFFFFFF; } @@ -922,14 +920,14 @@ STATIC_INLINE void do_fillrect_frame_buffer( struct RenderInfo *ri, int X, int Y { case 1: memset (start, Pen, Width); - break; + break; case 2: for (cols = 0; cols < Width; cols++) { do_put_mem_word ((uae_u16 *)start, (uae_u16)Pen); start += 2; } - break; + break; case 3: for (cols = 0; cols < Width; cols++) { @@ -938,7 +936,7 @@ STATIC_INLINE void do_fillrect_frame_buffer( struct RenderInfo *ri, int X, int Y *(uae_u16 *)(start) = (Pen & 0x00FFFF00) >> 8; start+=2; } - break; + break; case 4: for (cols = 0; cols < Width; cols++) { @@ -946,7 +944,7 @@ STATIC_INLINE void do_fillrect_frame_buffer( struct RenderInfo *ri, int X, int Y do_put_mem_long ((uae_u32 *)start, Pen); start += 4; } - break; + break; } src = oldstart; dst = src + ri->BytesPerRow; @@ -968,8 +966,8 @@ void picasso_handle_vsync (void) DX_Invalidate(0,4000); //so a flushpixel is done every vsync if pixel are in buffer PICASSO96_Unlock(); if (palette_changed) { - DX_SetPalette (0,256); - palette_changed = 0; + DX_SetPalette (0,256); + palette_changed = 0; } if (vsyncgfxwrite==1) { @@ -1092,191 +1090,191 @@ long height, uae_u8 mask, BLIT_OPCODE opcode ) { if( opcode == BLIT_SRC ) { - /* handle normal case efficiently */ - if (ri->Memory == dstri->Memory && dsty == srcy) - { - unsigned long i; - for (i = 0; i < height; i++, src += ri->BytesPerRow, dst += dstri->BytesPerRow) - memmove (dst, src, total_width); - } - else if (dsty < srcy) - { - unsigned long i; - for (i = 0; i < height; i++, src += ri->BytesPerRow, dst += dstri->BytesPerRow) - memcpy (dst, src, total_width); - } - else - { - unsigned long i; - src += (height-1) * ri->BytesPerRow; - dst += (height-1) * dstri->BytesPerRow; - for (i = 0; i < height; i++, src -= ri->BytesPerRow, dst -= dstri->BytesPerRow) - memcpy (dst, src, total_width); - } - return; + /* handle normal case efficiently */ + if (ri->Memory == dstri->Memory && dsty == srcy) + { + unsigned long i; + for (i = 0; i < height; i++, src += ri->BytesPerRow, dst += dstri->BytesPerRow) + memmove (dst, src, total_width); + } + else if (dsty < srcy) + { + unsigned long i; + for (i = 0; i < height; i++, src += ri->BytesPerRow, dst += dstri->BytesPerRow) + memcpy (dst, src, total_width); + } + else + { + unsigned long i; + src += (height-1) * ri->BytesPerRow; + dst += (height-1) * dstri->BytesPerRow; + for (i = 0; i < height; i++, src -= ri->BytesPerRow, dst -= dstri->BytesPerRow) + memcpy (dst, src, total_width); + } + return; } else { - uae_u8 *src2 = src; - uae_u8 *dst2 = dst; - uae_u32 *src2_32 = (uae_u32*)src; - uae_u32 *dst2_32 = (uae_u32*)dst; - unsigned int y; - - for( y = 0; y < height; y++ ) /* Vertical lines */ - { - uae_u8 *bound = src + total_width - 4; - //copy now the longs - for( src2_32 = src, dst2_32 = dst; src2_32 < bound; src2_32++, dst2_32++ ) /* Horizontal bytes */ - { - switch( opcode ) - { - case BLIT_FALSE: - *dst2_32 = 0; - break; - case BLIT_NOR: - *dst2_32 = ~(*src2_32 | *dst2_32); - break; - case BLIT_ONLYDST: - *dst2_32 = *dst2_32 & ~(*src2_32); - break; - case BLIT_NOTSRC: - *dst2_32 = ~(*src2_32); - break; - case BLIT_ONLYSRC: - *dst2_32 = *src2_32 & ~(*dst2_32); - break; - case BLIT_NOTDST: - *dst2_32 = ~(*dst2_32); - break; - case BLIT_EOR: - *dst2_32 = *src2_32 ^ *dst2_32; - break; - case BLIT_NAND: - *dst2_32 = ~(*src2_32 & *dst2_32); - break; - case BLIT_AND: - *dst2_32 = *src2_32 & *dst2_32; - break; - case BLIT_NEOR: - *dst2_32 = ~(*src2_32 ^ *dst2_32); - break; - case BLIT_DST: - write_log( "do_blitrect_frame_buffer shouldn't get BLIT_DST!\n"); - break; - case BLIT_NOTONLYSRC: - *dst2_32 = ~(*src2_32) | *dst2_32; - break; - case BLIT_SRC: - write_log( "do_blitrect_frame_buffer shouldn't get BLIT_SRC!\n"); - break; - case BLIT_NOTONLYDST: - *dst2_32 = ~(*dst2_32) | *src2_32; - break; - case BLIT_OR: - *dst2_32 = *src2_32 | *dst2_32; - break; - case BLIT_TRUE: - *dst2_32 = 0xFFFFFFFF; - break; + uae_u8 *src2 = src; + uae_u8 *dst2 = dst; + uae_u32 *src2_32 = (uae_u32*)src; + uae_u32 *dst2_32 = (uae_u32*)dst; + unsigned int y; + + for( y = 0; y < height; y++ ) /* Vertical lines */ + { + uae_u8 *bound = src + total_width - 4; + //copy now the longs + for( src2_32 = src, dst2_32 = dst; src2_32 < bound; src2_32++, dst2_32++ ) /* Horizontal bytes */ + { + switch( opcode ) + { + case BLIT_FALSE: + *dst2_32 = 0; + break; + case BLIT_NOR: + *dst2_32 = ~(*src2_32 | *dst2_32); + break; + case BLIT_ONLYDST: + *dst2_32 = *dst2_32 & ~(*src2_32); + break; + case BLIT_NOTSRC: + *dst2_32 = ~(*src2_32); + break; + case BLIT_ONLYSRC: + *dst2_32 = *src2_32 & ~(*dst2_32); + break; + case BLIT_NOTDST: + *dst2_32 = ~(*dst2_32); + break; + case BLIT_EOR: + *dst2_32 = *src2_32 ^ *dst2_32; + break; + case BLIT_NAND: + *dst2_32 = ~(*src2_32 & *dst2_32); + break; + case BLIT_AND: + *dst2_32 = *src2_32 & *dst2_32; + break; + case BLIT_NEOR: + *dst2_32 = ~(*src2_32 ^ *dst2_32); + break; + case BLIT_DST: + write_log( "do_blitrect_frame_buffer shouldn't get BLIT_DST!\n"); + break; + case BLIT_NOTONLYSRC: + *dst2_32 = ~(*src2_32) | *dst2_32; + break; + case BLIT_SRC: + write_log( "do_blitrect_frame_buffer shouldn't get BLIT_SRC!\n"); + break; + case BLIT_NOTONLYDST: + *dst2_32 = ~(*dst2_32) | *src2_32; + break; + case BLIT_OR: + *dst2_32 = *src2_32 | *dst2_32; + break; + case BLIT_TRUE: + *dst2_32 = 0xFFFFFFFF; + break; case 30: //code for swap source with dest in byte { uae_u32 temp; temp = *src2_32; - *src2_32 = *dst2_32; + *src2_32 = *dst2_32; *dst2_32 = temp; } break; - case BLIT_LAST: - write_log( "do_blitrect_frame_buffer shouldn't get BLIT_LAST!\n"); - break; - } /* switch opcode */ - }// for end - //now copy the rest few bytes - for( src2 = src2_32, dst2 = dst2_32; src2 < src + total_width; src2++, dst2++ ) /* Horizontal bytes */ - { - switch( opcode ) - { - case BLIT_FALSE: - *dst2 = 0; - break; - case BLIT_NOR: - *dst2 = ~(*src2 | *dst2); - break; - case BLIT_ONLYDST: - *dst2 = *dst2 & ~(*src2); - break; - case BLIT_NOTSRC: - *dst2 = ~(*src2); - break; - case BLIT_ONLYSRC: - *dst2 = *src2 & ~(*dst2); - break; - case BLIT_NOTDST: - *dst2 = ~(*dst2); - break; - case BLIT_EOR: - *dst2 = *src2 ^ *dst2; - break; - case BLIT_NAND: - *dst2 = ~(*src2 & *dst2); - break; - case BLIT_AND: - *dst2 = *src2 & *dst2; - break; - case BLIT_NEOR: - *dst2 = ~(*src2 ^ *dst2); - break; - case BLIT_DST: - write_log( "do_blitrect_frame_buffer shouldn't get BLIT_DST!\n"); - break; - case BLIT_NOTONLYSRC: - *dst2 = ~(*src2) | *dst2; - break; - case BLIT_SRC: - write_log( "do_blitrect_frame_buffer shouldn't get BLIT_SRC!\n"); - break; - case BLIT_NOTONLYDST: - *dst2 = ~(*dst2) | *src2; - break; - case BLIT_OR: - *dst2 = *src2 | *dst2; - break; - case BLIT_TRUE: - *dst2 = 0xFF; - break; - case BLIT_LAST: - write_log( "do_blitrect_frame_buffer shouldn't get BLIT_LAST!\n"); - break; - case 30: //code for swap source with dest in long - { - uae_u8 temp; - temp = *src2; - *src2 = *dst2; - *dst2 = temp; - } - break; - } /* switch opcode */ - } /* for width */ - src += ri->BytesPerRow; - dst += dstri->BytesPerRow; - } /* for height */ + case BLIT_LAST: + write_log( "do_blitrect_frame_buffer shouldn't get BLIT_LAST!\n"); + break; + } /* switch opcode */ + }// for end + //now copy the rest few bytes + for( src2 = src2_32, dst2 = dst2_32; src2 < src + total_width; src2++, dst2++ ) /* Horizontal bytes */ + { + switch( opcode ) + { + case BLIT_FALSE: + *dst2 = 0; + break; + case BLIT_NOR: + *dst2 = ~(*src2 | *dst2); + break; + case BLIT_ONLYDST: + *dst2 = *dst2 & ~(*src2); + break; + case BLIT_NOTSRC: + *dst2 = ~(*src2); + break; + case BLIT_ONLYSRC: + *dst2 = *src2 & ~(*dst2); + break; + case BLIT_NOTDST: + *dst2 = ~(*dst2); + break; + case BLIT_EOR: + *dst2 = *src2 ^ *dst2; + break; + case BLIT_NAND: + *dst2 = ~(*src2 & *dst2); + break; + case BLIT_AND: + *dst2 = *src2 & *dst2; + break; + case BLIT_NEOR: + *dst2 = ~(*src2 ^ *dst2); + break; + case BLIT_DST: + write_log( "do_blitrect_frame_buffer shouldn't get BLIT_DST!\n"); + break; + case BLIT_NOTONLYSRC: + *dst2 = ~(*src2) | *dst2; + break; + case BLIT_SRC: + write_log( "do_blitrect_frame_buffer shouldn't get BLIT_SRC!\n"); + break; + case BLIT_NOTONLYDST: + *dst2 = ~(*dst2) | *src2; + break; + case BLIT_OR: + *dst2 = *src2 | *dst2; + break; + case BLIT_TRUE: + *dst2 = 0xFF; + break; + case BLIT_LAST: + write_log( "do_blitrect_frame_buffer shouldn't get BLIT_LAST!\n"); + break; + case 30: //code for swap source with dest in long + { + uae_u8 temp; + temp = *src2; + *src2 = *dst2; + *dst2 = temp; + } + break; + } /* switch opcode */ + } /* for width */ + src += ri->BytesPerRow; + dst += dstri->BytesPerRow; + } /* for height */ } return; - } - + } + tmp3 = tmp2 = tmp = xmalloc (linewidth * height); /* allocate enough -memory for the src-rect */ +memory for the src-rect */ if (!tmp) return; - + /* copy the src-rect into our temporary buffer space */ for (lines = 0; lines < height; lines++, src += ri->BytesPerRow, tmp2 += linewidth) { memcpy (tmp2, src, total_width); } - + /* copy the temporary buffer to the destination */ for (lines = 0; lines < height; lines++, dst += dstri->BytesPerRow, tmp += linewidth) @@ -1284,8 +1282,8 @@ linewidth) unsigned long cols; for (cols = 0; cols < width; cols++) { - dst[cols] &= ~mask; - dst[cols] |= tmp[cols] & mask; + dst[cols] &= ~mask; + dst[cols] |= tmp[cols] & mask; } } /* free the temp-buf */ @@ -1411,18 +1409,18 @@ STATIC_INLINE void do_blitrect_frame_buffer( struct RenderInfo *ri, struct Rende } /* for height */ } return; - } - + } + tmp3 = tmp2 = tmp = xmalloc (linewidth * height); /* allocate enough memory for the src-rect */ if (!tmp) return; - + /* copy the src-rect into our temporary buffer space */ for (lines = 0; lines < height; lines++, src += ri->BytesPerRow, tmp2 += linewidth) { memcpy (tmp2, src, total_width); } - + /* copy the temporary buffer to the destination */ for (lines = 0; lines < height; lines++, dst += dstri->BytesPerRow, tmp += linewidth) { @@ -1582,7 +1580,7 @@ uae_u32 picasso_SetSpriteColor (void) #endif /* -* BOOL FindCard(struct BoardInfo *bi); and +* BOOL FindCard(struct BoardInfo *bi); and * * FindCard is called in the first stage of the board initialisation and * configuration and is used to look if there is a free and unconfigured @@ -1659,23 +1657,23 @@ static int AssignModeID( int i, int count ) { int result; if( DisplayModes[i].res.width == 320 && DisplayModes[i].res.height == 200 ) - result = 0x50001000; + result = 0x50001000; else if( DisplayModes[i].res.width == 320 && DisplayModes[i].res.height == 240 ) - result = 0x50011000; + result = 0x50011000; else if( DisplayModes[i].res.width == 640 && DisplayModes[i].res.height == 400 ) - result = 0x50021000; + result = 0x50021000; else if( DisplayModes[i].res.width == 640 && DisplayModes[i].res.height == 480 ) result = 0x50031000; else if( DisplayModes[i].res.width == 800 && DisplayModes[i].res.height == 600 ) result = 0x50041000; else if( DisplayModes[i].res.width == 1024 && DisplayModes[i].res.height == 768 ) - result = 0x50051000; + result = 0x50051000; else if( DisplayModes[i].res.width == 1152 && DisplayModes[i].res.height == 864 ) - result = 0x50061000; + result = 0x50061000; else if( DisplayModes[i].res.width == 1280 && DisplayModes[i].res.height == 1024 ) - result = 0x50071000; + result = 0x50071000; else if( DisplayModes[i].res.width == 1600 && DisplayModes[i].res.height == 1280 ) - result = 0x50081000; + result = 0x50081000; else result = 0x50091000 + count * 0x10000; return result; @@ -1690,8 +1688,8 @@ static int AssignModeID( int i, int count ) * gbi_RGBFormats: the pixel formats that the host-OS of UAE supports * If UAE is running in a window, it should ONLY report the pixel format of the host-OS desktop * If UAE is running full-screen, it should report ALL pixel formats that the host-OS can handle in full-screen -* NOTE: If full-screen, and the user toggles to windowed-mode, all hell will break loose visually. Must inform -* user that they're doing something stupid (unless their desktop and full-screen colour modes match). +* NOTE: If full-screen, and the user toggles to windowed-mode, all hell will break loose visually. Must inform +* user that they're doing something stupid (unless their desktop and full-screen colour modes match). * gbi_SoftSpriteFlags: should be the same as above for now, until actual cursor support is added * gbi_BitsPerCannon: could be 6 or 8 or ???, depending on the host-OS gfx-card * gbi_MaxHorResolution: fill this in for all modes (even if you don't support them) @@ -1770,8 +1768,8 @@ extern int x_size, y_size; /* * SetSwitch: -* a0: struct BoardInfo -* d0.w: BOOL state +* a0: struct BoardInfo +* d0.w: BOOL state * this function should set a board switch to let the Amiga signal pass * through when supplied with a 0 in d0 and to show the board signal if * a 1 is passed in d0. You should remember the current state of the @@ -1791,7 +1789,7 @@ uae_u32 picasso_SetSwitch (void) write_log ("SetSwitch() - trying to show %s screen\n", flag ? "picasso96":"amiga"); /* Put old switch-state in D0 */ - + return !flag; } @@ -1945,7 +1943,7 @@ uae_u32 picasso_SetPanning (void) uaecptr bi = m68k_areg( regs, 0 ); uaecptr bmeptr = get_long( bi + PSSO_BoardInfo_BitMapExtra ); /* Get our BoardInfo ptr's BitMapExtra ptr */ uae_u16 bme_width, bme_height; - + if(oldscr==0){ oldscr=start_of_screen; } @@ -2051,7 +2049,7 @@ uae_u32 picasso_InvertRect (void) if ( CopyRenderInfoStructureA2U (renderinfo, &ri)) { - P96TRACE(("InvertRect %dbpp 0x%lx\n", Bpp, (long)mask)); + P96TRACE(("InvertRect %dbpp 0x%lx\n", Bpp, (long)mask)); if (mask != 0xFF && Bpp > 1) { @@ -2082,15 +2080,15 @@ uae_u32 picasso_InvertRect (void) /*********************************************************** FillRect: *********************************************************** -* a0: struct BoardInfo * -* a1: struct RenderInfo * -* d0: WORD X -* d1: WORD Y -* d2: WORD Width -* d3: WORD Height -* d4: uae_u32 Pen -* d5: UBYTE Mask -* d7: uae_u32 RGBFormat +* a0: struct BoardInfo * +* a1: struct RenderInfo * +* d0: WORD X +* d1: WORD Y +* d2: WORD Width +* d3: WORD Height +* d4: uae_u32 Pen +* d5: UBYTE Mask +* d7: uae_u32 RGBFormat ***********************************************************/ uae_u32 picasso_FillRect (void) { @@ -2308,12 +2306,12 @@ STATIC_INLINE int BlitRectHelper( void ) //if (dstri->Memory == ri->Memory) if (dstri == NULL || dstri->Memory == ri->Memory) { - if( mask != 0xFF && Bpp > 1 ) - { - mask = 0xFF; - } - dstri = ri; - can_do_visible_blit = 1; + if( mask != 0xFF && Bpp > 1 ) + { + mask = 0xFF; + } + dstri = ri; + can_do_visible_blit = 1; } /* Do our virtual frame-buffer memory first */ @@ -2322,27 +2320,27 @@ STATIC_INLINE int BlitRectHelper( void ) if (vsyncgfxwrite==1)return 1; if (renderinfo_is_current_screen (dstri)) { - if (mask == 0xFF || Bpp > 1) { + if (mask == 0xFF || Bpp > 1) { if( can_do_visible_blit ) do_blit( dstri, Bpp, srcx, srcy, dstx, dsty, width, height, opcode, 1 ); else do_blit( dstri, Bpp, dstx, dsty, dstx, dsty, width, height, opcode, 0 ); - } else { - do_blit( dstri, Bpp, dstx, dsty, dstx, dsty, width, height, opcode, 0 ); - } - P96TRACE(("Did do_blit 1 in BlitRect()\n")); + } else { + do_blit( dstri, Bpp, dstx, dsty, dstx, dsty, width, height, opcode, 0 ); + } + P96TRACE(("Did do_blit 1 in BlitRect()\n")); } else { - P96TRACE(("Did not do_blit 1 in BlitRect()\n")); + P96TRACE(("Did not do_blit 1 in BlitRect()\n")); } return 1; } STATIC_INLINE int BlitRect (uaecptr ri, uaecptr dstri, - unsigned long srcx, unsigned long srcy, unsigned long dstx, unsigned long dsty, - unsigned long width, unsigned long height, uae_u8 mask, BLIT_OPCODE opcode ) + unsigned long srcx, unsigned long srcy, unsigned long dstx, unsigned long dsty, + unsigned long width, unsigned long height, uae_u8 mask, BLIT_OPCODE opcode ) { /* Set up the params */ CopyRenderInfoStructureA2U( ri, &blitrectdata.ri_struct ); @@ -2371,14 +2369,14 @@ STATIC_INLINE int BlitRect (uaecptr ri, uaecptr dstri, /*********************************************************** BlitRect: *********************************************************** -* a0: struct BoardInfo +* a0: struct BoardInfo * a1: struct RenderInfo -* d0: WORD SrcX -* d1: WORD SrcY -* d2: WORD DstX -* d3: WORD DstY -* d4: WORD Width -* d5: WORD Height +* d0: WORD SrcX +* d1: WORD SrcY +* d2: WORD DstX +* d3: WORD DstY +* d4: WORD Width +* d5: WORD Height * d6: UBYTE Mask * d7: uae_u32 RGBFormat ***********************************************************/ @@ -2414,20 +2412,20 @@ uae_u32 picasso_BlitRect (void) /*********************************************************** BlitRectNoMaskComplete: *********************************************************** -* a0: struct BoardInfo +* a0: struct BoardInfo * a1: struct RenderInfo (src) -* a2: struct RenderInfo (dst) -* d0: WORD SrcX -* d1: WORD SrcY -* d2: WORD DstX -* d3: WORD DstY -* d4: WORD Width -* d5: WORD Height +* a2: struct RenderInfo (dst) +* d0: WORD SrcX +* d1: WORD SrcY +* d2: WORD DstX +* d3: WORD DstY +* d4: WORD Width +* d5: WORD Height * d6: UBYTE OpCode * d7: uae_u32 RGBFormat -* NOTE: MUST return 0 in D0 if we're not handling this operation -* because the RGBFormat or opcode aren't supported. -* OTHERWISE return 1 +* NOTE: MUST return 0 in D0 if we're not handling this operation +* because the RGBFormat or opcode aren't supported. +* OTHERWISE return 1 ***********************************************************/ uae_u32 picasso_BlitRectNoMaskComplete (void) { @@ -2447,11 +2445,11 @@ uae_u32 picasso_BlitRectNoMaskComplete (void) #ifdef LOCK_UNLOCK_MADNESS //PICASSO96_Unlock(); - -#else + +#else wgfx_flushline (); #endif - + P96TRACE(("BlitRectNoMaskComplete() op 0x%2x, xy(%4d,%4d) --> xy(%4d,%4d), wh(%4d,%4d)\n", OpCode, srcx, srcy, dstx, dsty, width, height)); @@ -2555,7 +2553,7 @@ uae_u32 picasso_BlitPattern (void) #ifdef LOCK_UNLOCK_MADNESS //PICASSO96_Unlock(); - + #else wgfx_flushline (); #endif @@ -2590,7 +2588,7 @@ uae_u32 picasso_BlitPattern (void) if( result ) { - /* write_log ("BlitPattern() xy(%d,%d), wh(%d,%d) draw 0x%x, off(%d,%d), ph %d\n", + /* write_log ("BlitPattern() xy(%d,%d), wh(%d,%d) draw 0x%x, off(%d,%d), ph %d\n", X, Y, W, H, pattern.DrawMode, pattern.XOffset, pattern.YOffset, 1 << pattern.Size); */ #ifdef P96TRACING_ENABLED DumpPattern(&pattern); @@ -2778,7 +2776,7 @@ uae_u32 picasso_BlitTemplate (void) bitoffset = tmp.XOffset % 8; -#if defined( P96TRACING_ENABLED ) && ( P96TRACING_LEVEL > 0 ) +#if defined( P96TRACING_ENABLED ) && ( P96TRACING_LEVEL > 0 ) DumpTemplate(&tmp, W, H); #endif @@ -2876,8 +2874,8 @@ uae_u32 picasso_BlitTemplate (void) /* * CalculateBytesPerRow: -* a0: struct BoardInfo -* d0: uae_u16 Width +* a0: struct BoardInfo +* d0: uae_u16 Width * d7: RGBFTYPE RGBFormat * This function calculates the amount of bytes needed for a line of * "Width" pixels in the given RGBFormat. @@ -2895,8 +2893,8 @@ uae_u32 picasso_CalculateBytesPerRow (void) /* * SetDisplay: -* a0: struct BoardInfo -* d0: BOOL state +* a0: struct BoardInfo +* d0: BOOL state * This function enables and disables the video display. * * NOTE: return the opposite of the state @@ -2922,7 +2920,7 @@ void picasso_handle_hsync (void) } if (p96hsync <= 0) { rtarea[get_long (RTAREA_BASE + 36) + 12 - 1]++; - p96hsync = p96syncrate; + p96hsync = p96syncrate; } } @@ -2935,7 +2933,7 @@ void init_hz_p96 (void) else rate = abs (currprefs.gfx_refreshrate); if (rate <= 0) - rate = 60; + rate = 60; p96syncrate /= rate; } @@ -3047,10 +3045,10 @@ uae_u32 picasso_BlitPlanar2Chunky (void) #ifdef LOCK_UNLOCK_MADNESS //PICASSO96_Unlock(); -#else +#else wgfx_flushline (); #endif - + if (minterm != 0x0C) { write_log ("ERROR - BlitPlanar2Chunky() has minterm 0x%x, which I don't handle. Using fall-back routine.\n", minterm); @@ -3091,7 +3089,7 @@ static void PlanarToDirect(struct RenderInfo *ri, struct BitMap *bm, long eol_offset; if( !bpp ) - return; + return; /* Set up our bm->Planes[] pointers to the right horizontal offset */ for (j = 0; j < Depth; j++) { @@ -3204,7 +3202,7 @@ uae_u32 picasso_BlitPlanar2Direct (void) #ifdef LOCK_UNLOCK_MADNESS //PICASSO96_Unlock(); -#else +#else wgfx_flushline (); #endif @@ -3250,7 +3248,7 @@ static void flushpixels( void ) if (pixelcount==0)return; if (!picasso_on) { - pixelcount=0; + pixelcount=0; return; } xmaxaddr=0; @@ -3258,7 +3256,7 @@ static void flushpixels( void ) // +(picasso96_state.YOffset*picasso96_state.BytesPerRow); DX_Invalidate (0,4000); -#ifndef _DEBUG +#ifndef _DEBUG if(DirectDraw_IsLocked()==FALSE) { dst = gfx_lock_picasso (); lock=1; @@ -3368,7 +3366,7 @@ next2:;} if(pixelbase[i].size==4){ #ifdef SWAPSPEEDUP *(uae_u32 *)((addr-xminaddr)+ydestaddr)=value; -#else +#else do_put_mem_long ((uae_u32 *)((addr-xminaddr)+ydestaddr),value); #endif goto next; @@ -3422,7 +3420,7 @@ next2:;} } next:; } -out:;if(lock)gfx_unlock_picasso (); +out:;if(lock)gfx_unlock_picasso (); pixelcount=0; } #endif @@ -3450,7 +3448,7 @@ static void write_gfx_long (uaecptr addr, uae_u32 value) return; #endif #endif - + if (!picasso_on) return; @@ -3494,7 +3492,7 @@ static void write_gfx_long (uaecptr addr, uae_u32 value) if (xbytes < (picasso96_state.Width*picasso96_state.BytesPerPixel) && y < picasso96_state.Height) { - + dst = picasso96_state.HostAddress; //dst = gfx_lock_picasso (); if (dst) { @@ -3536,7 +3534,7 @@ static void write_gfx_word (uaecptr addr, uae_u16 value) pixelbase[pixelcount++].size=2; } return; -#endif +#endif #endif if (!picasso_on) return; @@ -3604,7 +3602,7 @@ static void write_gfx_byte (uaecptr addr, uae_u8 value) int x, xbytes; uae_u8 *dst; #ifdef PIXEL_LOCK - addr += gfxmem_start; + addr += gfxmem_start; /* Check to see if this needs to be written through to the display, or was it an "offscreen" area? */ if (addr > picasso96_state.Address && addr + 4 < picasso96_state.Extent) { @@ -3720,7 +3718,7 @@ static void REGPARAM2 gfxmem_lput (uaecptr addr, uae_u32 l) addr &= gfxmem_mask; m = (uae_u32 *)(gfxmemory + addr); -/* //only write difference +/* //only write difference __asm { mov eax,m mov eax,[eax] @@ -3732,7 +3730,7 @@ l2: } if (!m) return; */ -#ifdef SWAPSPEEDUP +#ifdef SWAPSPEEDUP *m=l; #else do_put_mem_long(m, l); @@ -3781,8 +3779,8 @@ static uae_u8 *REGPARAM2 gfxmem_xlate (uaecptr addr) addrbank gfxmem_bank = { gfxmem_lget, gfxmem_wget, gfxmem_bget, - gfxmem_lput, gfxmem_wput, gfxmem_bput, - gfxmem_xlate, gfxmem_check, NULL + gfxmem_lput, gfxmem_wput, gfxmem_bput, + gfxmem_xlate, gfxmem_check, NULL }; /* Call this function first, near the beginning of code flow diff --git a/od-win32/resources/resource.h b/od-win32/resources/resource.h index 52efc784..cd398937 100755 --- a/od-win32/resources/resource.h +++ b/od-win32/resources/resource.h @@ -348,6 +348,8 @@ #define IDC_CYCLEEXACT 1219 #define IDC_CS_CPU_TEXT2 1219 #define IDC_CPUIDLE 1220 +#define IDC_CYCLEEXACT2 1220 +#define IDC_GENLOCK 1220 #define IDC_SOUNDSETTINGS 1229 #define IDC_8BIT 1230 #define IDC_16BIT 1231 diff --git a/od-win32/resources/winuae.rc b/od-win32/resources/winuae.rc index 218f83e4..ddef077b 100755 --- a/od-win32/resources/winuae.rc +++ b/od-win32/resources/winuae.rc @@ -465,11 +465,11 @@ BEGIN "Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,63,50,10 GROUPBOX "Misc chipset options",IDC_STATIC,168,11,114,82 CONTROL "Fast Copper [] Faster but less compatible copper emulation.",IDC_FASTCOPPER, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,174,31,98,10 + "Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,176,198,98,10 CONTROL "Immediate Blitter [] Faster but less compatible blitter emulation.",IDC_BLITIMM, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,174,47,96,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,174,30,96,10 CONTROL "Cycle exact CPU and Blitter [] The most compatible A500 emulation mode. Very fast CPU recommended.",IDC_CYCLEEXACT, - "Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,174,64,100,10 + "Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,174,43,100,10 GROUPBOX "Collision level",IDC_STATIC,14,97,267,48 CONTROL "None [] Collision hardware emulation disabled.",IDC_COLLISION0, "Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,40,113,50,10 @@ -483,6 +483,8 @@ BEGIN CONTROL "Disabled",IDC_CS_SOUND0,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,39,167,102,10 CONTROL "Emulated",IDC_CS_SOUND1,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,39,182,91,10 CONTROL "Emulated, 100% accurate",IDC_CS_SOUND2,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,39,197,95,10 + CONTROL "Genlock connected [] Allow Kickstart to detect genlock. Genlock is not emulated.",IDC_GENLOCK, + "Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,174,56,100,10 END IDD_AVIOUTPUT DIALOGEX 0, 0, 197, 233 @@ -827,11 +829,6 @@ BEGIN BOTTOMMARGIN, 212 END - IDD_FILESYS, DIALOG - BEGIN - RIGHTMARGIN, 229 - END - IDD_INPUT, DIALOG BEGIN BOTTOMMARGIN, 187 diff --git a/od-win32/serial_win32.c b/od-win32/serial_win32.c index 67e253a5..94868205 100755 --- a/od-win32/serial_win32.c +++ b/od-win32/serial_win32.c @@ -44,7 +44,7 @@ uae_u16 serper, serdat, serdatr; static int allowed_baudrates[] = { 0, 110, 300, 600, 1200, 2400, 4800, 9600, 14400, - 19200, 31400, 38400, 57600, 115200, 128000, 256000, -1 }; + 19200, 31400, 38400, 57600, 115200, 128000, 256000, -1 }; void SERPER (uae_u16 w) { diff --git a/od-win32/win32.c b/od-win32/win32.c index 75db4905..5edef7be 100755 --- a/od-win32/win32.c +++ b/od-win32/win32.c @@ -191,9 +191,9 @@ static uae_u64 win32_read_processor_time (void) uae_u32 foo, bar; __asm { - rdtsc - mov foo, eax - mov bar, edx + rdtsc + mov foo, eax + mov bar, edx } return ((uae_u64)bar << 32) | foo; #else @@ -253,6 +253,8 @@ static int figure_processor_speed (void) qpfrate >>= 6; qpc_avail = -1; } + if (SystemInfo.dwNumberOfProcessors > 1) + rpt_available = 0; /* RDTSC is weird in SMP-systems */ } else { write_log("CLOCKREQ: QPF not supported\n"); } @@ -304,7 +306,7 @@ static int figure_processor_speed (void) clockrate = qpfrate; clockrate1000 = clockrate / 1000.0; if (dummythread_die < 0) { - dummythread_die = 0; + dummythread_die = 0; _beginthread(&dummythread, 0, 0); } if (!qpc_avail) @@ -401,11 +403,8 @@ void setmouseactive (int active) char txt[100], txt2[110]; if (active > 0 && mousehack_allowed () && mousehack_alive ()) { - mousehack_set (mousehack_follow); if (!isfullscreen ()) return; - } else { - mousehack_set (mousehack_dontcare); } inputdevice_unacquire (); @@ -413,7 +412,7 @@ void setmouseactive (int active) strcpy (txt, "WinUAE"); if (mouseactive > 0) { focus = 1; - WIN32GUI_LoadUIString (currprefs.win32_middle_mouse ? IDS_WINUAETITLE_MMB : IDS_WINUAETITLE_NORMAL, + WIN32GUI_LoadUIString (currprefs.win32_middle_mouse ? IDS_WINUAETITLE_MMB : IDS_WINUAETITLE_NORMAL, txt2, sizeof (txt2)); strcat (txt, " - "); strcat (txt, txt2); @@ -482,14 +481,14 @@ static void winuae_active (HWND hWnd, int minimized) focus = 1; write_log ("WinUAE now active via WM_ACTIVATE\n"); pri = &priorities[currprefs.win32_inactive_priority]; -#ifndef _DEBUG +#ifndef _DEBUG if (!minimized) pri = &priorities[currprefs.win32_active_priority]; #endif setpriority (pri); if (!minimized) { - if (!avioutput_video) { + if (!avioutput_video) { clear_inhibit_frame (IHF_WINDOWHIDDEN); } } @@ -646,9 +645,9 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, write_log ("WM_ACTIVE %d %d %d\n", HIWORD (wParam), LOWORD (wParam), minimized); #endif if (!isfullscreen ()) { - minimized = HIWORD (wParam); + minimized = HIWORD (wParam); if (LOWORD (wParam) != WA_INACTIVE) { - winuae_active (hWnd, minimized); + winuae_active (hWnd, minimized); } else { winuae_inactive (hWnd, minimized); } @@ -681,14 +680,14 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, if (normal_display_change_starting) { if (isfullscreen () && is3dmode () && normal_display_change_starting == 4) WIN32GFX_DisplayChangeRequested (); - normal_display_change_starting--; + normal_display_change_starting--; } } - manual_palette_refresh_needed = 1; + manual_palette_refresh_needed = 1; return 0; case WM_PALETTECHANGED: - if ((HWND)wParam != hWnd) + if ((HWND)wParam != hWnd) manual_palette_refresh_needed = 1; break; @@ -727,10 +726,10 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, case WM_MBUTTONDOWN: case WM_MBUTTONDBLCLK: if (currprefs.win32_middle_mouse) { - if (isfullscreen ()) - minimizewindow (); + if (isfullscreen ()) + minimizewindow (); if (mouseactive) - setmouseactive(0); + setmouseactive(0); } else { if (dinput_winmouse () >= 0) setmousebuttonstate (dinput_winmouse(), 2, 1); @@ -759,7 +758,7 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, static int recursive = 0; if (recursive == 0) { recursive++; - notice_screen_contents_lost (); + notice_screen_contents_lost (); hDC = BeginPaint (hWnd, &ps); /* Check to see if this WM_PAINT is coming while we've got the GUI visible */ if (manual_painting_needed) @@ -792,7 +791,7 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, break; case WM_CLOSE: - uae_quit (); + uae_quit (); return 0; case WM_WINDOWPOSCHANGED: @@ -800,24 +799,24 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, break; case WM_MOUSEMOVE: - mx = (signed short) LOWORD (lParam); - my = (signed short) HIWORD (lParam); + mx = (signed short) LOWORD (lParam); + my = (signed short) HIWORD (lParam); if (dinput_winmouse () >= 0) { if (dinput_winmousemode ()) { - /* absolete + mousehack */ - setmousestate (dinput_winmouse (), 0, mx, 1); + /* absolete + mousehack */ + setmousestate (dinput_winmouse (), 0, mx, 1); setmousestate (dinput_winmouse (), 1, my, 1); return 0; } else { /* relative */ - int mxx = (amigawin_rect.right - amigawin_rect.left) / 2; + int mxx = (amigawin_rect.right - amigawin_rect.left) / 2; int myy = (amigawin_rect.bottom - amigawin_rect.top) / 2; mx = mx - mxx; my = my - myy; setmousestate (dinput_winmouse (), 0, mx, 0); setmousestate (dinput_winmouse (), 1, my, 0); } - } else if ((!mouseactive && !isfullscreen())) { + } else if ((!mouseactive && !isfullscreen())) { setmousestate (0, 0, mx, 1); setmousestate (0, 1, my, 1); } @@ -888,7 +887,7 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, break; case WM_SYSKEYDOWN: - if(currprefs.win32_ctrl_F11_is_quit && wParam == VK_F4) + if(currprefs.win32_ctrl_F11_is_quit && wParam == VK_F4) return 0; break; @@ -898,8 +897,8 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, case WM_NOTIFY: { - LPNMHDR nm = (LPNMHDR)lParam; - if (nm->hwndFrom == hStatusWnd) { + LPNMHDR nm = (LPNMHDR)lParam; + if (nm->hwndFrom == hStatusWnd) { switch (nm->code) { /* status bar clicks */ @@ -942,7 +941,7 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, if (!gui_active) systraymenu (hWnd); else - SetForegroundWindow (hWnd); + SetForegroundWindow (hWnd); break; } break; @@ -1061,8 +1060,8 @@ static LRESULT CALLBACK MainWindowProc (HWND hWnd, UINT message, WPARAM wParam, break; if (!isfullscreen() && hAmigaWnd) { - static int store_xy; - RECT rc2; + static int store_xy; + RECT rc2; if (GetWindowRect(hMainWnd, &rc2)) { if (amigawin_rect.left & 3) { MoveWindow (hMainWnd, rc2.left+ 4 - amigawin_rect.left % 4, rc2.top, @@ -1127,24 +1126,24 @@ void handle_events (void) gui_fps (0, 0); } if (PeekMessage (&msg, 0, 0, 0, PM_REMOVE)) { - TranslateMessage (&msg); + TranslateMessage (&msg); DispatchMessage (&msg); } sleep_millis (50); inputdevicefunc_keyboard.read(); inputdevicefunc_mouse.read(); inputdevicefunc_joystick.read(); - inputdevice_handle_inputcode (); + inputdevice_handle_inputcode (); check_prefs_changed_gfx (); } while (PeekMessage (&msg, 0, 0, 0, PM_REMOVE)) { - TranslateMessage (&msg); - DispatchMessage (&msg); + TranslateMessage (&msg); + DispatchMessage (&msg); } if (was_paused) { init_sound (); #ifdef AHI - ahi_open_sound (); + ahi_open_sound (); #endif emulation_paused = 0; manual_painting_needed--; @@ -1166,7 +1165,7 @@ int WIN32_RegisterClasses( void ) HDC hDC = GetDC( NULL ); if (GetDeviceCaps (hDC, NUMCOLORS) != -1) - g_dwBackgroundColor = RGB (255, 0, 255); + g_dwBackgroundColor = RGB (255, 0, 255); ReleaseDC (NULL, hDC); wc.style = CS_BYTEALIGNCLIENT | CS_BYTEALIGNWINDOW | CS_DBLCLKS | CS_OWNDC; @@ -1209,11 +1208,11 @@ int WIN32_RegisterClasses( void ) return 0; hHiddenWnd = CreateWindowEx (0, - "Useless", "You don't see me", - WS_POPUP, - 0, 0, - 1, 1, - NULL, NULL, 0, NULL); + "Useless", "You don't see me", + WS_POPUP, + 0, 0, + 1, 1, + NULL, NULL, 0, NULL); if (!hHiddenWnd) return 0; @@ -1233,7 +1232,7 @@ int WIN32_CleanupLibraries( void ) FreeLibrary(hRichEdit); if (hHtmlHelp) - FreeLibrary(hHtmlHelp); + FreeLibrary(hHtmlHelp); if (hUIDLL) FreeLibrary(hUIDLL); @@ -1246,7 +1245,7 @@ int WIN32_InitHtmlHelp( void ) { int result = 0; if (zfile_exists (help_file)) { - if (hHtmlHelp = LoadLibrary("HHCTRL.OCX")) { + if (hHtmlHelp = LoadLibrary("HHCTRL.OCX")) { pHtmlHelp = (HWND(WINAPI *)(HWND, LPCSTR, UINT, LPDWORD))GetProcAddress(hHtmlHelp, "HtmlHelpA"); result = 1; } @@ -1487,7 +1486,7 @@ static HMODULE LoadGUI( void ) BOOL success = FALSE; int fail = 1; - if (language == 0x400) + if (language == 0x400) sprintf (dllbuf, "%sguidll.dll", start_path_exe); else sprintf (dllbuf, "%sWinUAE_%s.dll", start_path_exe, dllname); @@ -1551,7 +1550,7 @@ static void pritransla (void) for (i = 0; priorities[i].id; i++) { char tmp[MAX_DPATH]; - WIN32GUI_LoadUIString (priorities[i].id, tmp, sizeof (tmp)); + WIN32GUI_LoadUIString (priorities[i].id, tmp, sizeof (tmp)); priorities[i].name = my_strdup (tmp); } } @@ -1602,9 +1601,9 @@ void logging_init( void ) if (first == 1) { if (debugfile) fclose (debugfile); - debugfile = 0; + debugfile = 0; } -#ifndef SINGLEFILE +#ifndef SINGLEFILE if (currprefs.win32_logfile) { sprintf (debugfilename, "%swinuaelog.txt", start_path_data); if (!debugfile) @@ -1640,14 +1639,14 @@ void logging_init( void ) void logging_cleanup( void ) { if (debugfile) - fclose (debugfile); + fclose (debugfile); debugfile = 0; } void target_default_options (struct uae_prefs *p, int type) { if (type == 2 || type == 0) { - p->win32_middle_mouse = 1; + p->win32_middle_mouse = 1; p->win32_logfile = 0; p->win32_iconified_nosound = 1; p->win32_iconified_pause = 1; @@ -1663,7 +1662,7 @@ void target_default_options (struct uae_prefs *p, int type) p->win32_alwaysontop = 0; } if (type == 1 || type == 0) { - p->win32_midioutdev = -2; + p->win32_midioutdev = -2; p->win32_midiindev = 0; } } @@ -1700,9 +1699,9 @@ static int fetchpri (int pri, int defpri) { int i = 0; while (priorities[i].name) { - if (priorities[i].value == pri) + if (priorities[i].value == pri) return i; - i++; + i++; } return defpri; } @@ -1780,7 +1779,7 @@ void fetch_saveimagepath (char *out, int size, int dir) if (dir) { out[strlen (out) - 1] = 0; CreateDirectory (out, NULL); - fetch_path ("SaveimagePath", out, size); + fetch_path ("SaveimagePath", out, size); } } void fetch_configurationpath (char *out, int size) @@ -1815,7 +1814,7 @@ void fetch_path (char *name, char *out, int size) RegQueryValueEx (hWinUAEKey, name, 0, NULL, out, &size); if (out[0] == '\\') { /* relative? */ strcpy (out, start_path_data); - if (hWinUAEKey) { + if (hWinUAEKey) { size2 -= strlen (out); RegQueryValueEx (hWinUAEKey, name, 0, NULL, out + strlen (out) - 1, &size2); } @@ -1889,13 +1888,13 @@ void read_rom_list (int force) scan_roms (NULL); idx = 0; for (;;) { - int err; - size = sizeof (tmp); - size2 = sizeof (tmp2); - err = RegEnumValue(fkey, idx, tmp, &size, NULL, NULL, tmp2, &size2); - if (err != ERROR_SUCCESS) + int err; + size = sizeof (tmp); + size2 = sizeof (tmp2); + err = RegEnumValue(fkey, idx, tmp, &size, NULL, NULL, tmp2, &size2); + if (err != ERROR_SUCCESS) break; - if (strlen (tmp) == 5) { + if (strlen (tmp) == 5) { idx2 = atol (tmp + 3); if (idx2 >= 0 && strlen (tmp2) > 0) { struct romdata *rd = getromdatabyid (idx2); @@ -1978,68 +1977,68 @@ static void WIN32_HandleRegistryStuff( void ) // Regardless of opening the existing key, or creating a new key, we will write the .uae filename-extension // commands in. This way, we're always up to date. - /* Set our (default) sub-key to point to the "WinUAE" key, which we then create */ - RegSetValueEx(hWinUAEKey, "", 0, REG_SZ, (CONST BYTE *)"WinUAE", strlen( "WinUAE" ) + 1); + /* Set our (default) sub-key to point to the "WinUAE" key, which we then create */ + RegSetValueEx(hWinUAEKey, "", 0, REG_SZ, (CONST BYTE *)"WinUAE", strlen( "WinUAE" ) + 1); - if((RegCreateKeyEx(rkey, rpath2, 0, "", REG_OPTION_NON_VOLATILE, - KEY_WRITE | KEY_READ, NULL, &hWinUAEKeyLocal, &disposition) == ERROR_SUCCESS)) - { - /* Set our (default) sub-key to BE the "WinUAE" command for editing a configuration */ - sprintf(path, "%sWinUAE.exe -f \"%%1\" -s use_gui=yes", start_path_data); - RegSetValueEx(hWinUAEKeyLocal, "", 0, REG_SZ, (CONST BYTE *)path, strlen(path) + 1); + if((RegCreateKeyEx(rkey, rpath2, 0, "", REG_OPTION_NON_VOLATILE, + KEY_WRITE | KEY_READ, NULL, &hWinUAEKeyLocal, &disposition) == ERROR_SUCCESS)) + { + /* Set our (default) sub-key to BE the "WinUAE" command for editing a configuration */ + sprintf(path, "%sWinUAE.exe -f \"%%1\" -s use_gui=yes", start_path_data); + RegSetValueEx(hWinUAEKeyLocal, "", 0, REG_SZ, (CONST BYTE *)path, strlen(path) + 1); RegCloseKey(hWinUAEKeyLocal); - } - - if((RegCreateKeyEx(rkey, rpath3, 0, "", REG_OPTION_NON_VOLATILE, - KEY_WRITE | KEY_READ, NULL, &hWinUAEKeyLocal, &disposition) == ERROR_SUCCESS)) - { - /* Set our (default) sub-key to BE the "WinUAE" command for launching a configuration */ - sprintf(path, "%sWinUAE.exe -f \"%%1\"", start_path_data); - RegSetValueEx(hWinUAEKeyLocal, "", 0, REG_SZ, (CONST BYTE *)path, strlen( path ) + 1); + } + + if((RegCreateKeyEx(rkey, rpath3, 0, "", REG_OPTION_NON_VOLATILE, + KEY_WRITE | KEY_READ, NULL, &hWinUAEKeyLocal, &disposition) == ERROR_SUCCESS)) + { + /* Set our (default) sub-key to BE the "WinUAE" command for launching a configuration */ + sprintf(path, "%sWinUAE.exe -f \"%%1\"", start_path_data); + RegSetValueEx(hWinUAEKeyLocal, "", 0, REG_SZ, (CONST BYTE *)path, strlen( path ) + 1); RegCloseKey(hWinUAEKeyLocal); - } - RegCloseKey(hWinUAEKey); + } + RegCloseKey(hWinUAEKey); } hWinUAEKey = NULL; /* Create/Open the hWinUAEKey which points our config-info */ if (RegCreateKeyEx(HKEY_CURRENT_USER, "Software\\Arabuusimiehet\\WinUAE", 0, "", REG_OPTION_NON_VOLATILE, - KEY_WRITE | KEY_READ, NULL, &hWinUAEKey, &disposition) == ERROR_SUCCESS) + KEY_WRITE | KEY_READ, NULL, &hWinUAEKey, &disposition) == ERROR_SUCCESS) { - initpath ("FloppyPath", start_path_data); - initpath ("KickstartPath", start_path_data); - initpath ("hdfPath", start_path_data); - initpath ("ConfigurationPath", start_path_data); - initpath ("ScreenshotPath", start_path_data); - initpath ("StatefilePath", start_path_data); - initpath ("SaveimagePath", start_path_data); - initpath ("VideoPath", start_path_data); - if (disposition == REG_CREATED_NEW_KEY) - { - /* Create and initialize all our sub-keys to the default values */ - colortype = 0; - RegSetValueEx(hWinUAEKey, "DisplayInfo", 0, REG_DWORD, (CONST BYTE *)&colortype, sizeof(colortype)); - RegSetValueEx(hWinUAEKey, "xPos", 0, REG_DWORD, (CONST BYTE *)&colortype, sizeof(colortype)); - RegSetValueEx(hWinUAEKey, "yPos", 0, REG_DWORD, (CONST BYTE *)&colortype, sizeof(colortype)); - RegSetValueEx(hWinUAEKey, "xPosGUI", 0, REG_DWORD, (CONST BYTE *)&colortype, sizeof(colortype)); - RegSetValueEx(hWinUAEKey, "yPosGUI", 0, REG_DWORD, (CONST BYTE *)&colortype, sizeof(colortype)); - } + initpath ("FloppyPath", start_path_data); + initpath ("KickstartPath", start_path_data); + initpath ("hdfPath", start_path_data); + initpath ("ConfigurationPath", start_path_data); + initpath ("ScreenshotPath", start_path_data); + initpath ("StatefilePath", start_path_data); + initpath ("SaveimagePath", start_path_data); + initpath ("VideoPath", start_path_data); + if (disposition == REG_CREATED_NEW_KEY) + { + /* Create and initialize all our sub-keys to the default values */ + colortype = 0; + RegSetValueEx(hWinUAEKey, "DisplayInfo", 0, REG_DWORD, (CONST BYTE *)&colortype, sizeof(colortype)); + RegSetValueEx(hWinUAEKey, "xPos", 0, REG_DWORD, (CONST BYTE *)&colortype, sizeof(colortype)); + RegSetValueEx(hWinUAEKey, "yPos", 0, REG_DWORD, (CONST BYTE *)&colortype, sizeof(colortype)); + RegSetValueEx(hWinUAEKey, "xPosGUI", 0, REG_DWORD, (CONST BYTE *)&colortype, sizeof(colortype)); + RegSetValueEx(hWinUAEKey, "yPosGUI", 0, REG_DWORD, (CONST BYTE *)&colortype, sizeof(colortype)); + } size = sizeof (version); if (RegQueryValueEx (hWinUAEKey, "Version", 0, &dwType, (LPBYTE)&version, &size) == ERROR_SUCCESS) { if (checkversion (version)) - RegSetValueEx (hWinUAEKey, "Version", 0, REG_SZ, (CONST BYTE *)VersionStr, strlen (VersionStr) + 1); + RegSetValueEx (hWinUAEKey, "Version", 0, REG_SZ, (CONST BYTE *)VersionStr, strlen (VersionStr) + 1); } size = sizeof (version); if (RegQueryValueEx (hWinUAEKey, "ROMCheckVersion", 0, &dwType, (LPBYTE)&version, &size) == ERROR_SUCCESS) { if (checkversion (version)) { - if (RegSetValueEx (hWinUAEKey, "ROMCheckVersion", 0, REG_SZ, (CONST BYTE *)VersionStr, strlen (VersionStr) + 1) == ERROR_SUCCESS) + if (RegSetValueEx (hWinUAEKey, "ROMCheckVersion", 0, REG_SZ, (CONST BYTE *)VersionStr, strlen (VersionStr) + 1) == ERROR_SUCCESS) forceroms = 1; } } else { if (RegSetValueEx (hWinUAEKey, "ROMCheckVersion", 0, REG_SZ, (CONST BYTE *)VersionStr, strlen (VersionStr) + 1) == ERROR_SUCCESS) - forceroms = 1; + forceroms = 1; } - + RegQueryValueEx(hWinUAEKey, "DisplayInfo", 0, &dwType, (LPBYTE)&colortype, &dwDisplayInfoSize); if (colortype == 0) /* No color information stored in the registry yet */ { @@ -2049,8 +2048,8 @@ static void WIN32_HandleRegistryStuff( void ) WIN32GUI_LoadUIString(IDS_GFXCARDTITLE, szTitle, MAX_DPATH); if(MessageBox(NULL, szMessage, szTitle, MB_YESNO | MB_ICONWARNING | MB_TASKMODAL | MB_SETFOREGROUND ) == IDYES) { - colortype = WIN32GFX_FigurePixelFormats(0); - RegSetValueEx( hWinUAEKey, "DisplayInfo", 0, REG_DWORD, (CONST BYTE *)&colortype, sizeof( colortype ) ); + colortype = WIN32GFX_FigurePixelFormats(0); + RegSetValueEx( hWinUAEKey, "DisplayInfo", 0, REG_DWORD, (CONST BYTE *)&colortype, sizeof( colortype ) ); } } if (colortype) { @@ -2058,7 +2057,7 @@ static void WIN32_HandleRegistryStuff( void ) WIN32GFX_FigurePixelFormats(colortype); } size = sizeof (quickstart); - RegQueryValueEx(hWinUAEKey, "QuickStartMode", 0, &dwType, (LPBYTE)&quickstart, &size); + RegQueryValueEx(hWinUAEKey, "QuickStartMode", 0, &dwType, (LPBYTE)&quickstart, &size); } fetch_path ("ConfigurationPath", path, sizeof (path)); path[strlen (path) - 1] = 0; @@ -2138,10 +2137,10 @@ static int isadminpriv (void) // Create a SID for the BUILTIN\Administrators group. if(! AllocateAndInitializeSid( &SIDAuth, 2, - SECURITY_BUILTIN_DOMAIN_RID, - DOMAIN_ALIAS_RID_ADMINS, - 0, 0, 0, 0, 0, 0, - &pSID) ) { + SECURITY_BUILTIN_DOMAIN_RID, + DOMAIN_ALIAS_RID_ADMINS, + 0, 0, 0, 0, 0, 0, + &pSID) ) { write_log( "AllocateAndInitializeSid Error %u\n", GetLastError() ); return FALSE; } @@ -2210,12 +2209,12 @@ static void getstartpaths(int start_data) GetModuleHandle("shell32.dll"), "SHGetSpecialFolderPathA"); GetModuleFileName(NULL, start_path_exe, MAX_DPATH); if((posn = strrchr (start_path_exe, '\\'))) - posn[1] = 0; + posn[1] = 0; p = getenv("AMIGAFOREVERDATA"); if (start_data == 0 && p) { strcpy (start_path_data, p); v = GetFileAttributes(start_path_data); - strcat(start_path_data, "\\WinUAE"); + strcat(start_path_data, "\\WinUAE"); if (v != INVALID_FILE_ATTRIBUTES && (v & FILE_ATTRIBUTE_DIRECTORY)) start_data = 1; } @@ -2234,7 +2233,7 @@ static void getstartpaths(int start_data) } v = GetFileAttributes(start_path_data); if (v == INVALID_FILE_ATTRIBUTES || !(v & FILE_ATTRIBUTE_DIRECTORY) || start_data <= 0) - strcpy(start_path_data, start_path_exe); + strcpy(start_path_data, start_path_exe); if (strlen(start_path_data) > 0 && (start_path_data[strlen(start_path_data) - 1] != '\\' && start_path_data[strlen(start_path_data) - 1] != '/')) strcat(start_path_data, "\\"); @@ -2323,37 +2322,37 @@ static int PASCAL WinMain2 (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR if(WIN32_RegisterClasses() && WIN32_InitLibraries() && DirectDraw_Start(NULL)) { - DEVMODE devmode; - DWORD i = 0; - - DirectDraw_Release (); - write_log ("Enumerating display devices.. \n"); - enumeratedisplays (multi_display); - write_log ("Sorting devices and modes..\n"); - sortdisplays (); - write_log ("done\n"); + DEVMODE devmode; + DWORD i = 0; + + DirectDraw_Release (); + write_log ("Enumerating display devices.. \n"); + enumeratedisplays (multi_display); + write_log ("Sorting devices and modes..\n"); + sortdisplays (); + write_log ("done\n"); - memset (&devmode, 0, sizeof(devmode)); - devmode.dmSize = sizeof(DEVMODE); - if (EnumDisplaySettings (NULL, ENUM_CURRENT_SETTINGS, &devmode)) { + memset (&devmode, 0, sizeof(devmode)); + devmode.dmSize = sizeof(DEVMODE); + if (EnumDisplaySettings (NULL, ENUM_CURRENT_SETTINGS, &devmode)) { default_freq = devmode.dmDisplayFrequency; if( default_freq >= 70 ) - default_freq = 70; + default_freq = 70; else - default_freq = 60; + default_freq = 60; } - WIN32_HandleRegistryStuff(); - WIN32_InitHtmlHelp(); - DirectDraw_Release(); - betamessage (); - keyboard_settrans (); + WIN32_HandleRegistryStuff(); + WIN32_InitHtmlHelp(); + DirectDraw_Release(); + betamessage (); + keyboard_settrans (); #ifdef CATWEASEL catweasel_init(); #endif #ifdef PARALLEL_PORT - paraport_mask = paraport_init (); + paraport_mask = paraport_init (); #endif - real_main (argc, argv); + real_main (argc, argv); } if (mm_timerres && timermode == 0) @@ -2412,7 +2411,7 @@ int driveclick_loadresource (struct drvsample *sp, int drivetype) ok = 1; for (i = 0; drvsampleres[i] >= 0; i += 2) { struct drvsample *s = sp + drvsampleres[i + 1]; - HRSRC res = FindResource(NULL, MAKEINTRESOURCE(drvsampleres[i + 0]), "WAVE"); + HRSRC res = FindResource(NULL, MAKEINTRESOURCE(drvsampleres[i + 0]), "WAVE"); if (res != 0) { HANDLE h = LoadResource(NULL, res); int len = SizeofResource(NULL, res); @@ -2497,7 +2496,7 @@ static LONG WINAPI ExceptionFilter( struct _EXCEPTION_POINTERS * pExceptionPoint } } } -#ifndef _DEBUG +#ifndef _DEBUG if (lRet == EXCEPTION_CONTINUE_SEARCH) { char path[MAX_DPATH]; char path2[MAX_DPATH]; @@ -2614,7 +2613,7 @@ void systraymenu (HWND hwnd) if (!isfullscreen ()) SetForegroundWindow (hwnd); TrackPopupMenu (menu2, TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RIGHTBUTTON, - pt.x, pt.y, 0, hwnd, NULL); + pt.x, pt.y, 0, hwnd, NULL); PostMessage (hwnd, WM_NULL, 0, 0); DestroyMenu (menu); winuae_active (hwnd, FALSE); @@ -2634,7 +2633,9 @@ HMODULE WIN32_LoadLibrary (const char *name) HMODULE m = NULL; char *newname; DWORD err = -1; +#ifdef CPU_64_BIT char *p; +#endif int round; newname = xmalloc(strlen(name) + 1 + 10); @@ -2674,11 +2675,11 @@ HMODULE WIN32_LoadLibrary (const char *name) LLError(s); xfree (s); } - m = LoadLibrary (newname); + m = LoadLibrary (newname); if (m) goto end; LLError(newname); -#ifndef CPU_64_BIT +#ifndef CPU_64_BIT break; #endif } @@ -2689,8 +2690,7 @@ end: uae_u8 *win32_stackbase; -int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, - int nCmdShow) +int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { HANDLE thread; DWORD_PTR oldaff; diff --git a/od-win32/win32gfx.c b/od-win32/win32gfx.c index b17b7893..8938d9a3 100755 --- a/od-win32/win32gfx.c +++ b/od-win32/win32gfx.c @@ -282,8 +282,8 @@ static void cdsthread (void *dummy) { int ret = ChangeDisplaySettings (&dmScreenSettings, CDS_FULLSCREEN); if (ret != DISP_CHANGE_SUCCESSFUL && dmScreenSettings.dmDisplayFrequency > 0) { - dmScreenSettings.dmFields &= ~DM_DISPLAYFREQUENCY; - ret = ChangeDisplaySettings (&dmScreenSettings, CDS_FULLSCREEN); + dmScreenSettings.dmFields &= ~DM_DISPLAYFREQUENCY; + ret = ChangeDisplaySettings (&dmScreenSettings, CDS_FULLSCREEN); } if (ret != DISP_CHANGE_SUCCESSFUL) { cdsthread_ret = 0; @@ -329,22 +329,22 @@ static int set_ddraw (void) goto oops; if (dxfullscreen) { - write_log( "set_ddraw: Trying %dx%d, bits=%d, refreshrate=%d\n", width, height, bits, freq ); - ddrval = DirectDraw_SetDisplayMode (width, height, bits, freq); - if (FAILED(ddrval)) { + write_log( "set_ddraw: Trying %dx%d, bits=%d, refreshrate=%d\n", width, height, bits, freq ); + ddrval = DirectDraw_SetDisplayMode (width, height, bits, freq); + if (FAILED(ddrval)) { write_log ("set_ddraw: failed, trying without forced refresh rate\n"); - ddrval = DirectDraw_SetDisplayMode (width, height, bits, 0); + ddrval = DirectDraw_SetDisplayMode (width, height, bits, 0); if (FAILED(ddrval)) { write_log( "set_ddraw: Couldn't SetDisplayMode()\n" ); goto oops; } - } + } ddrval = DirectDraw_GetDisplayMode(); if (FAILED(ddrval)) { - write_log( "set_ddraw: Couldn't GetDisplayMode()\n" ); + write_log( "set_ddraw: Couldn't GetDisplayMode()\n" ); goto oops; - } + } #if 0 } else if (wfullscreen) { if (!do_changedisplaysettings (width, height, bits, currentmode->frequency)) @@ -353,8 +353,8 @@ static int set_ddraw (void) } if (dd) { - ddrval = DirectDraw_CreateClipper(); - if (FAILED(ddrval)) { + ddrval = DirectDraw_CreateClipper(); + if (FAILED(ddrval)) { write_log( "set_ddraw: No clipping support\n" ); goto oops; } @@ -374,7 +374,7 @@ static int set_ddraw (void) overlay = 0; } - DirectDraw_ClearSurfaces(); + DirectDraw_ClearSurfaces(); if (!DirectDraw_DetermineLocking (dxfullscreen)) { @@ -389,7 +389,7 @@ static int set_ddraw (void) goto oops; } - if (bits == 8) { + if (bits == 8) { ddrval = DirectDraw_CreatePalette (currentmode->pal); if (FAILED(ddrval)) { @@ -425,7 +425,7 @@ static void dhack(void) DisplayModes[i].colormodes = DisplayModes[i - 1].colormodes; DisplayModes[i + 1].depth = -1; sprintf(DisplayModes[i].name, "%dx%d, %d-bit", - DisplayModes[i].res.width, DisplayModes[i].res.height, DisplayModes[i].depth * 8); + DisplayModes[i].res.width, DisplayModes[i].res.height, DisplayModes[i].depth * 8); } */ @@ -478,7 +478,7 @@ static HRESULT CALLBACK modesCallback( LPDDSURFACEDESC2 modeDesc, LPVOID context DisplayModes[i].colormodes = ct; DisplayModes[i + 1].depth = -1; sprintf(DisplayModes[i].name, "%dx%d, %d-bit", - DisplayModes[i].res.width, DisplayModes[i].res.height, DisplayModes[i].depth * 8); + DisplayModes[i].res.width, DisplayModes[i].res.height, DisplayModes[i].depth * 8); return DDENUMRET_OK; } @@ -572,8 +572,8 @@ void sortdisplays (void) } md1 = Displays; while (md1->name) { - DisplayModes = md1->DisplayModes = xmalloc (sizeof (struct PicassoResolution) * MAX_PICASSO_MODES); - DisplayModes[0].depth = -1; + DisplayModes = md1->DisplayModes = xmalloc (sizeof (struct PicassoResolution) * MAX_PICASSO_MODES); + DisplayModes[0].depth = -1; md1->disabled = 1; if (DirectDraw_Start (md1->primary ? NULL : &md1->guid)) { if (SUCCEEDED(DirectDraw_GetDisplayMode())) { @@ -594,7 +594,7 @@ void sortdisplays (void) while (DisplayModes[i].depth > 0) i++; write_log ("'%s', %d display modes (%s)\n", md1->name, i, md1->disabled ? "disabled" : "enabled"); - md1++; + md1++; } DisplayModes = Displays[0].DisplayModes; displayGUID = NULL; @@ -614,38 +614,38 @@ RGBFTYPE WIN32GFX_FigurePixelFormats( RGBFTYPE colortype ) DirectDraw_Start (NULL); if(colortype == 0) /* Need to query a 16-bit display mode for its pixel-format. Do this by opening such a screen */ { - hAmigaWnd = CreateWindowEx (WS_EX_TOPMOST, + hAmigaWnd = CreateWindowEx (WS_EX_TOPMOST, "AmigaPowah", VersionStr, WS_VISIBLE | WS_POPUP, CW_USEDEFAULT, CW_USEDEFAULT, 1,//GetSystemMetrics (SM_CXSCREEN), 1,//GetSystemMetrics (SM_CYSCREEN), hHiddenWnd, NULL, 0, NULL); - if(hAmigaWnd) - { - window_created = 1; - ddrval = DirectDraw_SetCooperativeLevel( hAmigaWnd, TRUE ); /* TRUE indicates full-screen */ - if(FAILED(ddrval)) - { - gui_message("WIN32GFX_FigurePixelFormats: ERROR - %s\n", DXError(ddrval)); - goto out; - } - } - else - { - gui_message("WIN32GFX_FigurePixelFormats: ERROR - test-window could not be created.\n"); - } + if(hAmigaWnd) + { + window_created = 1; + ddrval = DirectDraw_SetCooperativeLevel( hAmigaWnd, TRUE ); /* TRUE indicates full-screen */ + if(FAILED(ddrval)) + { + gui_message("WIN32GFX_FigurePixelFormats: ERROR - %s\n", DXError(ddrval)); + goto out; + } + } + else + { + gui_message("WIN32GFX_FigurePixelFormats: ERROR - test-window could not be created.\n"); + } } else { - got_16bit_mode = 1; + got_16bit_mode = 1; } i = 0; while (DisplayModes[i].depth >= 0) { dm = &DisplayModes[i++]; - if (!got_16bit_mode) { - write_log ("figure_pixel_formats: Attempting %dx%d..\n", dm->res.width, dm->res.height); + if (!got_16bit_mode) { + write_log ("figure_pixel_formats: Attempting %dx%d..\n", dm->res.width, dm->res.height); ddrval = DirectDraw_SetDisplayMode (dm->res.width, dm->res.height, 16, 0); /* 0 for default freq */ if (FAILED(ddrval)) @@ -657,24 +657,24 @@ RGBFTYPE WIN32GFX_FigurePixelFormats( RGBFTYPE colortype ) colortype = DirectDraw_GetPixelFormat(); if (colortype != RGBFB_NONE) { - /* Clear the 16-bit information, and get the real stuff! */ - dm->colormodes &= ~(RGBFF_R5G6B5PC|RGBFF_R5G5B5PC|RGBFF_R5G6B5|RGBFF_R5G5B5|RGBFF_B5G6R5PC|RGBFF_B5G5R5PC); - dm->colormodes |= 1 << colortype; - got_16bit_mode = 1; - write_log( "Got real 16-bit colour-depth information: 0x%x\n", colortype ); - } - } else if (dm->colormodes & (RGBFF_R5G6B5PC|RGBFF_R5G5B5PC|RGBFF_R5G6B5|RGBFF_R5G5B5|RGBFF_B5G6R5PC|RGBFF_B5G5R5PC) ) { - /* Clear the 16-bit information, and set the real stuff! */ - dm->colormodes &= ~(RGBFF_R5G6B5PC|RGBFF_R5G5B5PC|RGBFF_R5G6B5|RGBFF_R5G5B5|RGBFF_B5G6R5PC|RGBFF_B5G5R5PC); - dm->colormodes |= 1 << colortype; - } + /* Clear the 16-bit information, and get the real stuff! */ + dm->colormodes &= ~(RGBFF_R5G6B5PC|RGBFF_R5G5B5PC|RGBFF_R5G6B5|RGBFF_R5G5B5|RGBFF_B5G6R5PC|RGBFF_B5G5R5PC); + dm->colormodes |= 1 << colortype; + got_16bit_mode = 1; + write_log( "Got real 16-bit colour-depth information: 0x%x\n", colortype ); + } + } else if (dm->colormodes & (RGBFF_R5G6B5PC|RGBFF_R5G5B5PC|RGBFF_R5G6B5|RGBFF_R5G5B5|RGBFF_B5G6R5PC|RGBFF_B5G5R5PC) ) { + /* Clear the 16-bit information, and set the real stuff! */ + dm->colormodes &= ~(RGBFF_R5G6B5PC|RGBFF_R5G5B5PC|RGBFF_R5G6B5|RGBFF_R5G5B5|RGBFF_B5G6R5PC|RGBFF_B5G5R5PC); + dm->colormodes |= 1 << colortype; + } } out: if (window_created) { - Sleep (1000); - DestroyWindow (hAmigaWnd); + Sleep (1000); + DestroyWindow (hAmigaWnd); hAmigaWnd = NULL; } DirectDraw_Release (); @@ -700,8 +700,8 @@ int WIN32GFX_AdjustScreenmode(uae_u32 *pwidth, uae_u32 *pheight, uae_u32 *ppixbi uae_u32 mask = (pass == 0 ? selected_mask : RGBMASK_8BIT | RGBMASK_15BIT | RGBMASK_16BIT | RGBMASK_24BIT | RGBMASK_32BIT); /* %%% - BERND, were you missing 15-bit here??? */ - i = 0; - index = 0; + i = 0; + index = 0; best = &DisplayModes[0]; dm = &DisplayModes[1]; @@ -715,25 +715,25 @@ int WIN32GFX_AdjustScreenmode(uae_u32 *pwidth, uae_u32 *pheight, uae_u32 *ppixbi if ((dm->colormodes & mask) != 0) { if (dm->res.width <= best->res.width && dm->res.height <= best->res.height && dm->res.width >= *pwidth && dm->res.height >= *pheight) - { + { best = dm; - index = i; - } + index = i; + } if (dm->res.width >= best->res.width && dm->res.height >= best->res.height && dm->res.width <= *pwidth && dm->res.height <= *pheight) - { + { best = dm; - index = i; - } + index = i; + } } dm++; - i++; + i++; } if (best->res.width == *pwidth && best->res.height == *pheight) { - selected_mask = mask; /* %%% - BERND, I added this - does it make sense? Otherwise, I'd specify a 16-bit display-mode for my + selected_mask = mask; /* %%% - BERND, I added this - does it make sense? Otherwise, I'd specify a 16-bit display-mode for my Workbench (using -H 2, but SHOULD have been -H 1), and end up with an 8-bit mode instead*/ break; - } + } } *pwidth = best->res.width; *pheight = best->res.height; @@ -752,15 +752,15 @@ int WIN32GFX_AdjustScreenmode(uae_u32 *pwidth, uae_u32 *pheight, uae_u32 *ppixbi else if (best->colormodes & RGBMASK_24BIT) *ppixbits = 24; else - index = -1; + index = -1; return index; } // This function is only called for full-screen Amiga screen-modes, and simply flips -// the front and back buffers. Additionally, because the emulation is not always drawing +// the front and back buffers. Additionally, because the emulation is not always drawing // complete frames, we also need to update the back-buffer with the new contents we just -// flipped to. Thus, after our flip, we blit. +// flipped to. Thus, after our flip, we blit. static int DX_Flip(void) { int result = 0; @@ -771,7 +771,7 @@ static int DX_Flip(void) start = read_processor_time(); used = start - end; if (used > 0 && used < vsynctime * 2) { - int pct = used * 100 / vsynctime; + int pct = used * 100 / vsynctime; write_log ("%d\n", pct); if (pct < 95) sleep_millis_busy (2 + (95 - pct) / 10); @@ -822,7 +822,7 @@ void flush_screen (int a, int b) } else if ((currentmode->flags & DM_DDRAW) && DirectDraw_GetLockableType() == secondary_surface ) { if (currentmode->flags & DM_DX_FULLSCREEN) { if( turbo_emulation || DX_Flip() == 0 ) - DX_Blit (0, a, 0, a, currentmode->current_width, b - a + 1, BLIT_SRC); + DX_Blit (0, a, 0, a, currentmode->current_width, b - a + 1, BLIT_SRC); } else if(DirectDraw_GetLockableType() != overlay_surface) DX_Blit (0, a, 0, a, currentmode->current_width, b - a + 1, BLIT_SRC); } @@ -831,7 +831,7 @@ void flush_screen (int a, int b) static uae_u8 *ddraw_dolock (void) { if (!DirectDraw_SurfaceLock(lockable_surface)) - return 0; + return 0; gfxvidinfo.bufmem = DirectDraw_GetSurfacePointer(); init_row_map (); clear_inhibit_frame (IHF_WINDOWHIDDEN); @@ -894,7 +894,7 @@ void gfx_unlock_picasso (void) if( p96_double_buffer_needs_flushing ) { /* Here, our flush_block() will deal with a offscreen-plain (back-buffer) to visible-surface (front-buffer) */ - if( DirectDraw_GetLockableType() == secondary_surface ) + if( DirectDraw_GetLockableType() == secondary_surface ) { BOOL relock = FALSE; if( DirectDraw_IsLocked() ) @@ -911,7 +911,7 @@ void gfx_unlock_picasso (void) lockscr(); } } - p96_double_buffer_needs_flushing = 0; + p96_double_buffer_needs_flushing = 0; } } @@ -925,8 +925,8 @@ static void close_hwnds( void ) if (hMainWnd) systray (hMainWnd, TRUE); if (hStatusWnd) { - ShowWindow (hStatusWnd, SW_HIDE); - DestroyWindow (hStatusWnd); + ShowWindow (hStatusWnd, SW_HIDE); + DestroyWindow (hStatusWnd); } if (hAmigaWnd) { #ifdef OPENGL @@ -942,7 +942,7 @@ static void close_hwnds( void ) hAmigaWnd = 0; } if (hMainWnd) { - ShowWindow (hMainWnd, SW_HIDE); + ShowWindow (hMainWnd, SW_HIDE); DestroyWindow (hMainWnd); } hMainWnd = 0; @@ -982,7 +982,7 @@ static int open_windows (void) #ifdef PICASSO96 } #endif - currentmode->amiga_width = currentmode->current_width; + currentmode->amiga_width = currentmode->current_width; currentmode->amiga_height = currentmode->current_height; } ret = doInit (); @@ -1030,18 +1030,18 @@ int check_prefs_changed_gfx (void) currprefs.gfx_width_fs = changed_prefs.gfx_width_fs; currprefs.gfx_height_fs = changed_prefs.gfx_height_fs; currprefs.color_mode = changed_prefs.color_mode; - currprefs.gfx_afullscreen = changed_prefs.gfx_afullscreen; - currprefs.gfx_pfullscreen = changed_prefs.gfx_pfullscreen; - updatewinfsmode (&currprefs); - currprefs.gfx_vsync = changed_prefs.gfx_vsync; - currprefs.gfx_refreshrate = changed_prefs.gfx_refreshrate; + currprefs.gfx_afullscreen = changed_prefs.gfx_afullscreen; + currprefs.gfx_pfullscreen = changed_prefs.gfx_pfullscreen; + updatewinfsmode (&currprefs); + currprefs.gfx_vsync = changed_prefs.gfx_vsync; + currprefs.gfx_refreshrate = changed_prefs.gfx_refreshrate; currprefs.gfx_filter = changed_prefs.gfx_filter; currprefs.gfx_filter_filtermode = changed_prefs.gfx_filter_filtermode; currprefs.gfx_lores = changed_prefs.gfx_lores; currprefs.gfx_linedbl = changed_prefs.gfx_linedbl; currprefs.gfx_display = changed_prefs.gfx_display; currprefs.win32_alwaysontop = changed_prefs.win32_alwaysontop; - inputdevice_unacquire (); + inputdevice_unacquire (); close_windows (); graphics_init (); #ifdef PICASSO96 @@ -1055,9 +1055,9 @@ int check_prefs_changed_gfx (void) } if (currprefs.chipset_refreshrate != changed_prefs.chipset_refreshrate) { - currprefs.chipset_refreshrate = changed_prefs.chipset_refreshrate; - init_hz (); - return 1; + currprefs.chipset_refreshrate = changed_prefs.chipset_refreshrate; + init_hz (); + return 1; } if (currprefs.gfx_correct_aspect != changed_prefs.gfx_correct_aspect || @@ -1071,10 +1071,10 @@ int check_prefs_changed_gfx (void) } if (currprefs.leds_on_screen != changed_prefs.leds_on_screen || - currprefs.keyboard_leds[0] != changed_prefs.keyboard_leds[0] || - currprefs.keyboard_leds[1] != changed_prefs.keyboard_leds[1] || - currprefs.keyboard_leds[2] != changed_prefs.keyboard_leds[2] || - currprefs.win32_middle_mouse != changed_prefs.win32_middle_mouse || + currprefs.keyboard_leds[0] != changed_prefs.keyboard_leds[0] || + currprefs.keyboard_leds[1] != changed_prefs.keyboard_leds[1] || + currprefs.keyboard_leds[2] != changed_prefs.keyboard_leds[2] || + currprefs.win32_middle_mouse != changed_prefs.win32_middle_mouse || currprefs.win32_active_priority != changed_prefs.win32_active_priority || currprefs.win32_inactive_priority != changed_prefs.win32_inactive_priority || currprefs.win32_iconified_priority != changed_prefs.win32_iconified_priority || @@ -1084,11 +1084,11 @@ int check_prefs_changed_gfx (void) currprefs.win32_iconified_pause != changed_prefs.win32_iconified_pause || currprefs.win32_ctrl_F11_is_quit != changed_prefs.win32_ctrl_F11_is_quit) { - currprefs.leds_on_screen = changed_prefs.leds_on_screen; - currprefs.keyboard_leds[0] = changed_prefs.keyboard_leds[0]; - currprefs.keyboard_leds[1] = changed_prefs.keyboard_leds[1]; - currprefs.keyboard_leds[2] = changed_prefs.keyboard_leds[2]; - currprefs.win32_middle_mouse = changed_prefs.win32_middle_mouse; + currprefs.leds_on_screen = changed_prefs.leds_on_screen; + currprefs.keyboard_leds[0] = changed_prefs.keyboard_leds[0]; + currprefs.keyboard_leds[1] = changed_prefs.keyboard_leds[1]; + currprefs.keyboard_leds[2] = changed_prefs.keyboard_leds[2]; + currprefs.win32_middle_mouse = changed_prefs.win32_middle_mouse; currprefs.win32_active_priority = changed_prefs.win32_active_priority; currprefs.win32_inactive_priority = changed_prefs.win32_inactive_priority; currprefs.win32_iconified_priority = changed_prefs.win32_iconified_priority; @@ -1097,12 +1097,12 @@ int check_prefs_changed_gfx (void) currprefs.win32_iconified_nosound = changed_prefs.win32_iconified_nosound; currprefs.win32_iconified_pause = changed_prefs.win32_iconified_pause; currprefs.win32_ctrl_F11_is_quit = changed_prefs.win32_ctrl_F11_is_quit; - inputdevice_unacquire (); - currprefs.keyboard_leds_in_use = currprefs.keyboard_leds[0] | currprefs.keyboard_leds[1] | currprefs.keyboard_leds[2]; + inputdevice_unacquire (); + currprefs.keyboard_leds_in_use = currprefs.keyboard_leds[0] | currprefs.keyboard_leds[1] | currprefs.keyboard_leds[2]; pause_sound (); resume_sound (); inputdevice_acquire (); -#ifndef _DEBUG +#ifndef _DEBUG setpriority (&priorities[currprefs.win32_active_priority]); #endif return 1; @@ -1136,7 +1136,7 @@ int check_prefs_changed_gfx (void) #endif } if (currprefs.win32_midiindev != changed_prefs.win32_midiindev || - currprefs.win32_midioutdev != changed_prefs.win32_midioutdev) + currprefs.win32_midioutdev != changed_prefs.win32_midioutdev) { currprefs.win32_midiindev = changed_prefs.win32_midiindev; currprefs.win32_midioutdev = changed_prefs.win32_midioutdev; @@ -1230,7 +1230,7 @@ void init_colors (void) red_bits = green_bits = blue_bits = 8; red_shift = 16; green_shift = 8; blue_shift = 0; } - } + } } alloc_colors64k (red_bits, green_bits, blue_bits, red_shift,green_shift, blue_shift, alpha_bits, alpha_shift, alpha); #ifdef GFXFILTER @@ -1269,17 +1269,17 @@ void DX_SetPalette (int start, int count) HRESULT ddrval; if (!screen_is_picasso) - return; + return; if( picasso96_state.RGBFormat != RGBFB_CHUNKY ) - return; + return; if (picasso_vidinfo.pixbytes != 1) { /* write_log ("DX Setpalette emulation\n"); */ /* This is the case when we're emulating a 256 color display. */ while (count-- > 0) - { + { int r = picasso96_state.CLUT[start].Red; int g = picasso96_state.CLUT[start].Green; int b = picasso96_state.CLUT[start].Blue; @@ -1328,9 +1328,9 @@ static COLORREF BuildColorRef( int color, RGBFTYPE pixelformat ) /* Do special case first */ if( pixelformat == RGBFB_CHUNKY ) - result = color; + result = color; else - result = do_get_mem_long( &color ); + result = do_get_mem_long( &color ); return result; #if 0 int r,g,b; @@ -1338,49 +1338,49 @@ static COLORREF BuildColorRef( int color, RGBFTYPE pixelformat ) switch( pixelformat ) { - case RGBFB_R5G6B5PC: - r = color & 0xF800 >> 11; - g = color & 0x07E0 >> 5; - b = color & 0x001F; - break; - case RGBFB_R5G5B5PC: - r = color & 0x7C00 >> 10; - g = color & 0x03E0 >> 5; - b = color & 0x001F; - break; - case RGBFB_B5G6R5PC: - r = color & 0x001F; - g = color & 0x07E0 >> 5; - b = color & 0xF800 >> 11; - break; - case RGBFB_B5G5R5PC: - r = color & 0x001F; - g = color & 0x03E0 >> 5; - b = color & 0x7C00 >> 10; - break; - case RGBFB_B8G8R8: - r = color & 0x00FF0000 >> 16; - g = color & 0x0000FF00 >> 8; - b = color & 0x000000FF; - break; - case RGBFB_A8B8G8R8: - r = color & 0xFF000000 >> 24; - g = color & 0x00FF0000 >> 16; - b = color & 0x0000FF00 >> 8; - break; - case RGBFB_R8G8B8: - r = color & 0x000000FF; - g = color & 0x0000FF00 >> 8; - b = color & 0x00FF0000 >> 16; - break; - case RGBFB_A8R8G8B8: - r = color & 0x0000FF00 >> 8; - g = color & 0x00FF0000 >> 16; - b = color & 0xFF000000 >> 24; - break; - default: - write_log( "Uknown 0x%x pixel-format\n", pixelformat ); - break; + case RGBFB_R5G6B5PC: + r = color & 0xF800 >> 11; + g = color & 0x07E0 >> 5; + b = color & 0x001F; + break; + case RGBFB_R5G5B5PC: + r = color & 0x7C00 >> 10; + g = color & 0x03E0 >> 5; + b = color & 0x001F; + break; + case RGBFB_B5G6R5PC: + r = color & 0x001F; + g = color & 0x07E0 >> 5; + b = color & 0xF800 >> 11; + break; + case RGBFB_B5G5R5PC: + r = color & 0x001F; + g = color & 0x03E0 >> 5; + b = color & 0x7C00 >> 10; + break; + case RGBFB_B8G8R8: + r = color & 0x00FF0000 >> 16; + g = color & 0x0000FF00 >> 8; + b = color & 0x000000FF; + break; + case RGBFB_A8B8G8R8: + r = color & 0xFF000000 >> 24; + g = color & 0x00FF0000 >> 16; + b = color & 0x0000FF00 >> 8; + break; + case RGBFB_R8G8B8: + r = color & 0x000000FF; + g = color & 0x0000FF00 >> 8; + b = color & 0x00FF0000 >> 16; + break; + case RGBFB_A8R8G8B8: + r = color & 0x0000FF00 >> 8; + g = color & 0x00FF0000 >> 16; + b = color & 0xFF000000 >> 24; + break; + default: + write_log( "Uknown 0x%x pixel-format\n", pixelformat ); + break; } result = RGB(r,g,b); write_log( "R = 0x%02x, G = 0x%02x, B = 0x%02x - result = 0x%08x\n", r, g, b, result ); @@ -1482,7 +1482,7 @@ int DX_Blit(int srcx, int srcy, int dstx, int dsty, int width, int height, BLIT_ * NOTE: reset our destination rectangle again if its been modified above... */ if((srcx != dstx) || (srcy != dsty)) { SetRect(&dstrect, dstx, dsty, dstx+width, dsty+height); - result = DirectDraw_Blt(secondary_surface, &dstrect, secondary_surface, &srcrect, DDBLT_WAIT | DDBLT_ROP, &fx); + result = DirectDraw_Blt(secondary_surface, &dstrect, secondary_surface, &srcrect, DDBLT_WAIT | DDBLT_ROP, &fx); if (FAILED(result)) { write_log("DX_Blit2() failed %s\n", DXError(result)); } @@ -1584,7 +1584,7 @@ static void gfxmode_reset (void) currentmode->amode[1] = &wmodes[SM_FULLSCREEN_DX]; currentmode->pmode[0] = &wmodes[currprefs.win32_no_overlay ? SM_WINDOW : SM_WINDOW_OVERLAY]; currentmode->pmode[1] = &wmodes[SM_FULLSCREEN_DX]; -#if defined (OPENGL) && defined (GFXFILTER) +#if defined (OPENGL) && defined (GFXFILTER) if (usedfilter && usedfilter->type == UAE_FILTER_OPENGL) { currentmode->amode[0] = &wmodes[SM_OPENGL_WINDOW]; currentmode->amode[1] = &wmodes[SM_OPENGL_FULLSCREEN_DX]; @@ -1667,7 +1667,7 @@ static void createstatuswindow (void) hStatusWnd = CreateWindowEx( 0, STATUSCLASSNAME, (LPCTSTR) NULL, SBT_TOOLTIPS | WS_CHILD | WS_VISIBLE, - 0, 0, 0, 0, hMainWnd, (HMENU) 1, hInst, NULL); + 0, 0, 0, 0, hMainWnd, (HMENU) 1, hInst, NULL); if (!hStatusWnd) return; @@ -1713,16 +1713,16 @@ static int create_windows (void) HWND hhWnd = currprefs.win32_notaskbarbutton ? hHiddenWnd : NULL; if (!fs) { - RECT rc; - LONG stored_x = 1, stored_y = GetSystemMetrics (SM_CYMENU) + GetSystemMetrics (SM_CYBORDER); - DWORD regkeytype; - DWORD regkeysize = sizeof (LONG); + RECT rc; + LONG stored_x = 1, stored_y = GetSystemMetrics (SM_CYMENU) + GetSystemMetrics (SM_CYBORDER); + DWORD regkeytype; + DWORD regkeysize = sizeof (LONG); int cx = GetSystemMetrics(SM_CXBORDER), cy = GetSystemMetrics(SM_CYBORDER); int oldx, oldy; int first = 2; - RegQueryValueEx( hWinUAEKey, "xPos", 0, ®keytype, (LPBYTE)&stored_x, ®keysize ); - RegQueryValueEx( hWinUAEKey, "yPos", 0, ®keytype, (LPBYTE)&stored_y, ®keysize ); + RegQueryValueEx( hWinUAEKey, "xPos", 0, ®keytype, (LPBYTE)&stored_x, ®keysize ); + RegQueryValueEx( hWinUAEKey, "yPos", 0, ®keytype, (LPBYTE)&stored_y, ®keysize ); while (first) { first--; @@ -1735,7 +1735,7 @@ static int create_windows (void) rc.left = 1; else rc.left = stored_x; - + if (stored_y > GetSystemMetrics (SM_CYVIRTUALSCREEN)) rc.top = 1; else @@ -1753,12 +1753,12 @@ static int create_windows (void) if (MonitorFromRect (&rc, MONITOR_DEFAULTTONULL) == NULL) { write_log ("window coordinates are not visible on any monitor, reseting..\n"); stored_x = stored_y = 0; - continue; + continue; } break; } - hMainWnd = CreateWindowEx (WS_EX_ACCEPTFILES | exstyle | (currprefs.win32_alwaysontop ? WS_EX_TOPMOST : 0), + hMainWnd = CreateWindowEx (WS_EX_ACCEPTFILES | exstyle | (currprefs.win32_alwaysontop ? WS_EX_TOPMOST : 0), "PCsuxRox", "WinUAE", NORMAL_WINDOW_STYLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, rc.left, rc.top, @@ -1785,17 +1785,17 @@ static int create_windows (void) if (! hAmigaWnd) { write_log ("creation of amiga window failed\n"); - close_hwnds(); + close_hwnds(); return 0; } systray (hMainWnd, FALSE); if (hMainWnd != hAmigaWnd) { ShowWindow (hMainWnd, SW_SHOWNORMAL); - UpdateWindow (hMainWnd); + UpdateWindow (hMainWnd); } if (hAmigaWnd) { - UpdateWindow (hAmigaWnd); + UpdateWindow (hAmigaWnd); ShowWindow (hAmigaWnd, SW_SHOWNORMAL); } @@ -1877,7 +1877,7 @@ static void setoverlay(void) static void updatemodes (void) { if (screen_is_picasso) { - currentmode->mode = currentmode->pmode[currprefs.gfx_pfullscreen]; + currentmode->mode = currentmode->pmode[currprefs.gfx_pfullscreen]; currentmode->flags = currentmode->mode->pflags; } else { currentmode->mode = currentmode->amode[currprefs.gfx_afullscreen]; @@ -1888,8 +1888,8 @@ static void updatemodes (void) currentmode->flags &= ~DM_SWSCALE; #if defined (GFXFILTER) if (usedfilter && !usedfilter->x[0]) { - currentmode->flags |= DM_SWSCALE; - if (currentmode->current_depth < 15) + currentmode->flags |= DM_SWSCALE; + if (currentmode->current_depth < 15) currentmode->current_depth = 16; } #endif @@ -1912,7 +1912,7 @@ static BOOL doInit (void) currentmode->real_depth = 0; tmp_depth = currentmode->current_depth; - write_log("W=%d H=%d B=%d CT=%d\n", + write_log("W=%d H=%d B=%d CT=%d\n", DirectDraw_CurrentWidth (), DirectDraw_CurrentHeight (), DirectDraw_GetSurfaceBitCount (), colortype); if (currentmode->current_depth < 15 && (currprefs.chipset_mask & CSMASK_AGA) && isfullscreen () && !WIN32GFX_IsPicassoScreen()) { @@ -1920,7 +1920,7 @@ static BOOL doInit (void) if (!warned) { char szMessage[MAX_DPATH]; currentmode->current_depth = 16; - WIN32GUI_LoadUIString(IDS_AGA8BIT, szMessage, MAX_DPATH); + WIN32GUI_LoadUIString(IDS_AGA8BIT, szMessage, MAX_DPATH); gui_message(szMessage); } warned = 1; @@ -1946,7 +1946,7 @@ static BOOL doInit (void) fs_warning = IDS_UNSUPPORTEDSCREENMODE_2; } else if (currentmode->current_width >= GetSystemMetrics(SM_CXVIRTUALSCREEN) || currentmode->current_height >= GetSystemMetrics(SM_CXVIRTUALSCREEN)) { if (!console_logging) - fs_warning = IDS_UNSUPPORTEDSCREENMODE_3; + fs_warning = IDS_UNSUPPORTEDSCREENMODE_3; #ifdef PICASSO96 } else if (screen_is_picasso && !currprefs.gfx_pfullscreen && ( picasso_vidinfo.selected_rgbformat != RGBFB_CHUNKY ) && @@ -1965,7 +1965,7 @@ static BOOL doInit (void) sprintf (tmpstr, szMessage, szMessage2); gui_message (tmpstr); DirectDraw_Start(displayGUID); - if (screen_is_picasso) + if (screen_is_picasso) changed_prefs.gfx_pfullscreen = currprefs.gfx_pfullscreen = 1; else changed_prefs.gfx_afullscreen = currprefs.gfx_afullscreen = 1; @@ -1977,7 +1977,7 @@ static BOOL doInit (void) goto oops; } if (! create_windows ()) - goto oops; + goto oops; #ifdef PICASSO96 if (screen_is_picasso) { currentmode->pal = (LPPALETTEENTRY) & picasso96_state.CLUT; @@ -2009,7 +2009,7 @@ static BOOL doInit (void) currentmode->amiga_height = AMIGA_HEIGHT_MAX >> (currprefs.gfx_linedbl ? 0 : 1); if (usedfilter) { if (usedfilter->x[0]) { - currentmode->current_depth = (currprefs.gfx_filter_filtermode / 2) ? 32 : 16; + currentmode->current_depth = (currprefs.gfx_filter_filtermode / 2) ? 32 : 16; } else { int j = 0, i = currprefs.gfx_filter_filtermode; while (i >= 0) { @@ -2025,13 +2025,13 @@ static BOOL doInit (void) mult = j; } } - currentmode->pitch = currentmode->amiga_width * currentmode->current_depth >> 3; + currentmode->pitch = currentmode->amiga_width * currentmode->current_depth >> 3; } else #endif { - currentmode->amiga_width = currentmode->current_width; - currentmode->amiga_height = currentmode->current_height; + currentmode->amiga_width = currentmode->current_width; + currentmode->amiga_height = currentmode->current_height; } gfxvidinfo.pixbytes = currentmode->current_depth >> 3; gfxvidinfo.bufmem = 0; @@ -2053,7 +2053,7 @@ static BOOL doInit (void) goto oops; flags = DirectDraw_GetPixelFormatFlags(); DirectDraw_SurfaceUnlock(); - if (flags & (DDPF_RGB | DDPF_PALETTEINDEXED8 | DDPF_RGBTOYUV )) { + if (flags & (DDPF_RGB | DDPF_PALETTEINDEXED8 | DDPF_RGBTOYUV )) { write_log( "%s mode (bits: %d, pixbytes: %d)\n", currentmode->flags & DM_DX_FULLSCREEN ? "Full screen" : "Window", DirectDraw_GetSurfaceBitCount(), currentmode->current_depth >> 3 ); } else { @@ -2167,7 +2167,7 @@ int WIN32GFX_SetPalette( void ) write_log ("SetPalette(0) failed, %s\n", DXError (hr)); return SUCCEEDED(hr); } -void WIN32GFX_WindowMove ( void ) +void WIN32GFX_WindowMove ( void ) { if (currentmode->flags & DM_OVERLAY) setoverlay(); @@ -2265,7 +2265,7 @@ HDC gethdc (void) return D3D_getDC (0); #endif if(FAILED(DirectDraw_GetDC(&hdc, DirectDraw_GetLockableType()))) - hdc = 0; + hdc = 0; return hdc; } diff --git a/od-win32/win32gui.c b/od-win32/win32gui.c index fbacf197..b6229a33 100755 --- a/od-win32/win32gui.c +++ b/od-win32/win32gui.c @@ -167,27 +167,27 @@ static int drag_start (HWND hWnd, HWND hListView, LPARAM lParam) bFirst = TRUE; iPos = ListView_GetNextItem(hListView, -1, LVNI_SELECTED); while (iPos != -1) { - if (bFirst) { - // For the first selected item, - // we simply create a single-line drag image - hDragImageList = ListView_CreateDragImage(hListView, iPos, &p); - ImageList_GetImageInfo(hDragImageList, 0, &imf); - iHeight = imf.rcImage.bottom; - bFirst = FALSE; - } else { - // For the rest selected items, - // we create a single-line drag image, then - // append it to the bottom of the complete drag image - hOneImageList = ListView_CreateDragImage(hListView, iPos, &p); - hTempImageList = ImageList_Merge(hDragImageList, - 0, hOneImageList, 0, 0, iHeight); - ImageList_Destroy(hDragImageList); - ImageList_Destroy(hOneImageList); - hDragImageList = hTempImageList; - ImageList_GetImageInfo(hDragImageList, 0, &imf); - iHeight = imf.rcImage.bottom; - } - iPos = ListView_GetNextItem(hListView, iPos, LVNI_SELECTED); + if (bFirst) { + // For the first selected item, + // we simply create a single-line drag image + hDragImageList = ListView_CreateDragImage(hListView, iPos, &p); + ImageList_GetImageInfo(hDragImageList, 0, &imf); + iHeight = imf.rcImage.bottom; + bFirst = FALSE; + } else { + // For the rest selected items, + // we create a single-line drag image, then + // append it to the bottom of the complete drag image + hOneImageList = ListView_CreateDragImage(hListView, iPos, &p); + hTempImageList = ImageList_Merge(hDragImageList, + 0, hOneImageList, 0, 0, iHeight); + ImageList_Destroy(hDragImageList); + ImageList_Destroy(hOneImageList); + hDragImageList = hTempImageList; + ImageList_GetImageInfo(hDragImageList, 0, &imf); + iHeight = imf.rcImage.bottom; + } + iPos = ListView_GetNextItem(hListView, iPos, LVNI_SELECTED); } // Now we can initialize then start the drag action @@ -364,7 +364,7 @@ static int scan_rom_2 (struct zfile *f, struct romscandata *rsd) struct romdata *rd = scan_single_rom_2 (f, rsd->keybuf, rsd->keysize); if (rd) { addrom (rsd->fkey, rd, zfile_getname (f)); - rsd->got = 1; + rsd->got = 1; } return 1; } @@ -390,8 +390,8 @@ static int listrom (int *roms) i = 0; while (roms[i] >= 0) { - struct romdata *rd = getromdatabyid (roms[i]); - if (rd && romlist_get (rd)) + struct romdata *rd = getromdatabyid (roms[i]); + if (rd && romlist_get (rd)) return 1; i++; } @@ -655,7 +655,7 @@ int target_cfgfile_load (struct uae_prefs *p, char *filename, int type, int isde fetch_path ("ConfigurationPath", tmp2, sizeof (tmp2)); strcat (tmp2, tmp1); v = i; - cfgfile_load (p, tmp2, &v, 1); + cfgfile_load (p, tmp2, &v, 1); } } } @@ -698,10 +698,10 @@ void gui_display( int shortcut ) if ((!WIN32GFX_IsPicassoScreen() && currprefs.gfx_afullscreen && (currprefs.gfx_width < gui_width || currprefs.gfx_height < gui_height)) #ifdef PICASSO96 - || (WIN32GFX_IsPicassoScreen() && currprefs.gfx_pfullscreen && (picasso96_state.Width < gui_width || picasso96_state.Height < gui_height)) + || (WIN32GFX_IsPicassoScreen() && currprefs.gfx_pfullscreen && (picasso96_state.Width < gui_width || picasso96_state.Height < gui_height)) #endif ) { - flipflop = 1; + flipflop = 1; } WIN32GFX_ClearPalette(); @@ -724,12 +724,12 @@ void gui_display( int shortcut ) savestate_state = 0; } } else if (shortcut >= 0 && shortcut < 4) { - DiskSelection(hAmigaWnd, IDC_DF0+shortcut, 0, &changed_prefs, 0); + DiskSelection(hAmigaWnd, IDC_DF0+shortcut, 0, &changed_prefs, 0); } else if (shortcut == 5) { - if (DiskSelection(hAmigaWnd, IDC_DOSAVESTATE, 9, &changed_prefs, 0)) + if (DiskSelection(hAmigaWnd, IDC_DOSAVESTATE, 9, &changed_prefs, 0)) save_state (savestate_fname, "Description!"); } else if (shortcut == 4) { - if (DiskSelection(hAmigaWnd, IDC_DOLOADSTATE, 10, &changed_prefs, 0)) + if (DiskSelection(hAmigaWnd, IDC_DOLOADSTATE, 10, &changed_prefs, 0)) savestate_state = STATE_DORESTORE; } manual_painting_needed--; /* So that WM_PAINT doesn't need to use custom refreshing */ @@ -746,7 +746,7 @@ void gui_display( int shortcut ) akiko_exitgui (); #endif if (flipflop >= 0) - setmouseactive (1); + setmouseactive (1); #ifdef D3D D3D_guimode (FALSE); #endif @@ -920,10 +920,10 @@ int DiskSelection_2 (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs sprintf( szFilter, "%s ", szFormat ); memcpy( szFilter + strlen( szFilter ), ROM_FORMAT_STRING, sizeof (ROM_FORMAT_STRING) + 1); - openFileName.lpstrTitle = szTitle; - openFileName.lpstrDefExt = "ROM"; - openFileName.lpstrFilter = szFilter; - break; + openFileName.lpstrTitle = szTitle; + openFileName.lpstrDefExt = "ROM"; + openFileName.lpstrFilter = szFilter; + break; case 7: WIN32GUI_LoadUIString( IDS_SELECTKEY, szTitle, MAX_DPATH ); WIN32GUI_LoadUIString( IDS_KEY, szFormat, MAX_DPATH ); @@ -932,8 +932,8 @@ int DiskSelection_2 (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs openFileName.lpstrTitle = szTitle; openFileName.lpstrDefExt = "KEY"; - openFileName.lpstrFilter = szFilter; - break; + openFileName.lpstrFilter = szFilter; + break; case 9: case 10: WIN32GUI_LoadUIString(flag == 10 ? IDS_RESTOREUSS : IDS_SAVEUSS, szTitle, MAX_DPATH); @@ -993,7 +993,7 @@ int DiskSelection_2 (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs openFileName.lpstrDefExt = NULL; break; case 12: - WIN32GUI_LoadUIString( IDS_SELECTFS, szTitle, MAX_DPATH ); + WIN32GUI_LoadUIString( IDS_SELECTFS, szTitle, MAX_DPATH ); openFileName.lpstrTitle = szTitle; openFileName.lpstrFilter = NULL; @@ -1001,7 +1001,7 @@ int DiskSelection_2 (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs openFileName.lpstrInitialDir = path_out; break; case 13: - WIN32GUI_LoadUIString( IDS_SELECTINFO, szTitle, MAX_DPATH ); + WIN32GUI_LoadUIString( IDS_SELECTINFO, szTitle, MAX_DPATH ); openFileName.lpstrTitle = szTitle; openFileName.lpstrFilter = NULL; @@ -1066,7 +1066,7 @@ int DiskSelection_2 (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs nextp += strlen (nextp) + 1; } switch (wParam) - { + { case IDC_PATH_NAME: case IDC_PATH_FILESYS: if (flag == 8) { @@ -1076,32 +1076,32 @@ int DiskSelection_2 (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs } } SetDlgItemText (hDlg, wParam, full_path); - break; + break; case IDC_DF0: case IDC_DF0QQ: SetDlgItemText (hDlg, IDC_DF0TEXT, full_path); strcpy(prefs->df[0], full_path); DISK_history_add (full_path, -1); next = IDC_DF1; - break; + break; case IDC_DF1: case IDC_DF1QQ: SetDlgItemText (hDlg, IDC_DF1TEXT, full_path); strcpy(prefs->df[1], full_path); DISK_history_add (full_path, -1); next = IDC_DF2; - break; + break; case IDC_DF2: SetDlgItemText (hDlg, IDC_DF2TEXT, full_path); strcpy(prefs->df[2], full_path); DISK_history_add (full_path, -1); next = IDC_DF3; - break; + break; case IDC_DF3: SetDlgItemText (hDlg, IDC_DF3TEXT, full_path); strcpy(prefs->df[3], full_path); DISK_history_add (full_path, -1); - break; + break; case IDC_DOSAVESTATE: case IDC_DOLOADSTATE: statefile_previousfilter = openFileName.nFilterIndex; @@ -1109,7 +1109,7 @@ int DiskSelection_2 (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs break; case IDC_CREATE: disk_creatediskfile(full_path, 0, SendDlgItemMessage(hDlg, IDC_FLOPPYTYPE, CB_GETCURSEL, 0, 0L)); - break; + break; case IDC_CREATE_RAW: disk_creatediskfile(full_path, 1, SendDlgItemMessage(hDlg, IDC_FLOPPYTYPE, CB_GETCURSEL, 0, 0L)); break; @@ -1121,13 +1121,13 @@ int DiskSelection_2 (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs } else { SetDlgItemText (hDlg, IDC_EDITDESCRIPTION, workprefs.description); SetDlgItemText (hDlg, IDC_EDITNAME, full_path); - SetDlgItemText (hDlg, IDC_CONFIGLINK, workprefs.config_host_path); + SetDlgItemText (hDlg, IDC_CONFIGLINK, workprefs.config_host_path); } - break; + break; case IDC_SAVE: SetDlgItemText (hDlg, IDC_EDITNAME, full_path); - cfgfile_save (&workprefs, full_path, 0); - break; + cfgfile_save (&workprefs, full_path, 0); + break; case IDC_ROMFILE: strcpy (workprefs.romfile, full_path); break; @@ -1140,25 +1140,25 @@ int DiskSelection_2 (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs case IDC_CARTFILE: strcpy (workprefs.cartfile, full_path); break; - } - if (flag == 0 || flag == 1) { - amiga_path = strstr (openFileName.lpstrFile, openFileName.lpstrFileTitle); - if (amiga_path && amiga_path != openFileName.lpstrFile) { - *amiga_path = 0; - if (hWinUAEKey) - RegSetValueEx (hWinUAEKey, "FloppyPath", 0, REG_SZ, (CONST BYTE *)openFileName.lpstrFile, strlen(openFileName.lpstrFile) + 1); - } - } else if (flag == 2 || flag == 3) { - amiga_path = strstr (openFileName.lpstrFile, openFileName.lpstrFileTitle); - if (amiga_path && amiga_path != openFileName.lpstrFile) { - *amiga_path = 0; - if(hWinUAEKey) - RegSetValueEx(hWinUAEKey, "hdfPath", 0, REG_SZ, (CONST BYTE *)openFileName.lpstrFile, strlen(openFileName.lpstrFile) + 1); - } - } - if (!multi) + } + if (flag == 0 || flag == 1) { + amiga_path = strstr (openFileName.lpstrFile, openFileName.lpstrFileTitle); + if (amiga_path && amiga_path != openFileName.lpstrFile) { + *amiga_path = 0; + if (hWinUAEKey) + RegSetValueEx (hWinUAEKey, "FloppyPath", 0, REG_SZ, (CONST BYTE *)openFileName.lpstrFile, strlen(openFileName.lpstrFile) + 1); + } + } else if (flag == 2 || flag == 3) { + amiga_path = strstr (openFileName.lpstrFile, openFileName.lpstrFileTitle); + if (amiga_path && amiga_path != openFileName.lpstrFile) { + *amiga_path = 0; + if(hWinUAEKey) + RegSetValueEx(hWinUAEKey, "hdfPath", 0, REG_SZ, (CONST BYTE *)openFileName.lpstrFile, strlen(openFileName.lpstrFile) + 1); + } + } + if (!multi) next = -1; - if (next >= 0) + if (next >= 0) wParam = next; } return result; @@ -1220,16 +1220,16 @@ static BOOL CreateHardFile (HWND hDlg, UINT hfsizem, char *dostype) ret = SetFilePointer (hf, (DWORD)hfsize, NULL, FILE_BEGIN); } if (ret == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) - write_log ("SetFilePointer() failure for %s to posn %ud\n", init_path, hfsize); + write_log ("SetFilePointer() failure for %s to posn %ud\n", init_path, hfsize); else - result = SetEndOfFile (hf); + result = SetEndOfFile (hf); SetFilePointer (hf, 0, NULL, FILE_BEGIN); b = 0; WriteFile (hf, &b, 1, &written, NULL); WriteFile (hf, &b, 1, &written, NULL); WriteFile (hf, &b, 1, &written, NULL); WriteFile (hf, &b, 1, &written, NULL); - if (sscanf (dostype, "%x", &dt) > 0) { + if (sscanf (dostype, "%x", &dt) > 0) { SetFilePointer (hf, 0, NULL, FILE_BEGIN); b = dt >> 24; WriteFile (hf, &b, 1, &written, NULL); @@ -1240,11 +1240,11 @@ static BOOL CreateHardFile (HWND hDlg, UINT hfsizem, char *dostype) b = dt >> 0; WriteFile (hf, &b, 1, &written, NULL); } - CloseHandle (hf); - } else { - write_log ("CreateFile() failed to create %s\n", init_path); - } - SetCursor (LoadCursor (NULL, IDC_ARROW)); + CloseHandle (hf); + } else { + write_log ("CreateFile() failed to create %s\n", init_path); + } + SetCursor (LoadCursor (NULL, IDC_ARROW)); } return result; } @@ -1271,12 +1271,12 @@ static const char *memsize_names[] = { static unsigned long memsizes[] = { /* 0 */ 0, -/* 1 */ 0x00040000, /* 256-K */ -/* 2 */ 0x00080000, /* 512-K */ -/* 3 */ 0x00100000, /* 1-meg */ -/* 4 */ 0x00200000, /* 2-meg */ -/* 5 */ 0x00400000, /* 4-meg */ -/* 6 */ 0x00800000, /* 8-meg */ +/* 1 */ 0x00040000, /* 256-K */ +/* 2 */ 0x00080000, /* 512-K */ +/* 3 */ 0x00100000, /* 1-meg */ +/* 4 */ 0x00200000, /* 2-meg */ +/* 5 */ 0x00400000, /* 4-meg */ +/* 6 */ 0x00800000, /* 8-meg */ /* 7 */ 0x01000000, /* 16-meg */ /* 8 */ 0x02000000, /* 32-meg */ /* 9 */ 0x04000000, /* 64-meg */ @@ -1304,7 +1304,7 @@ static int CalculateHardfileSize (HWND hDlg) if (mbytes <= 0) mbytes = 0; if( !Translated ) - mbytes = 0; + mbytes = 0; return mbytes; } @@ -1358,9 +1358,9 @@ static struct ConfigStruct *GetConfigs (struct ConfigStruct *configparent, int u handle = FindFirstFile(path2, &find_data ); if (handle == INVALID_HANDLE_VALUE) { #ifndef SINGLEFILE - // Either the directory has no .CFG files, or doesn't exist. - // Create the directory, even if it already exists. No harm, and don't check return codes, because - // we may be doing this on a read-only media like CD-ROM. + // Either the directory has no .CFG files, or doesn't exist. + // Create the directory, even if it already exists. No harm, and don't check return codes, because + // we may be doing this on a read-only media like CD-ROM. if (configparent == NULL) { GetConfigPath (path, NULL, FALSE); CreateDirectory (path, NULL); @@ -1393,7 +1393,7 @@ static struct ConfigStruct *GetConfigs (struct ConfigStruct *configparent, int u if (!stricmp (config->Name, CONFIG_HARDWARE)) config->hardware = 1; child = GetConfigs (config, usedirs, level); - (*level)--; + (*level)--; if (child) config->Child = child; ok = 1; @@ -1401,7 +1401,7 @@ static struct ConfigStruct *GetConfigs (struct ConfigStruct *configparent, int u } else if (!(find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { char path3[MAX_DPATH]; if (strlen (find_data.cFileName) > 4 && !strcasecmp (find_data.cFileName + strlen (find_data.cFileName) - 4, ".uae")) { - strcpy (path3, path); + strcpy (path3, path); strncat (path3, find_data.cFileName, MAX_DPATH); if (cfgfile_get_description (path3, config->Description, config->HostLink, config->HardwareLink, &config->Type)) { strcpy (config->Name, find_data.cFileName); @@ -1410,8 +1410,8 @@ static struct ConfigStruct *GetConfigs (struct ConfigStruct *configparent, int u } } if (!ok) { - FreeConfigStruct (config); - config = NULL; + FreeConfigStruct (config); + config = NULL; } } if (config) { @@ -1485,7 +1485,7 @@ static char *HandleConfiguration (HWND hDlg, int flag, struct ConfigStruct *conf } GetDlgItemText (hDlg, IDC_EDITDESCRIPTION, desc, MAX_DPATH); if (config) { - strcpy (path, config->Fullpath); + strcpy (path, config->Fullpath); } else { fetch_configurationpath (path, sizeof (path)); } @@ -1512,7 +1512,7 @@ static char *HandleConfiguration (HWND hDlg, int flag, struct ConfigStruct *conf cfgfile_save (&workprefs, path, configtypepanel); } break; - + case CONFIG_LOAD: if (strlen (name) == 0) { char szMessage[ MAX_DPATH ]; @@ -1525,28 +1525,28 @@ static char *HandleConfiguration (HWND hDlg, int flag, struct ConfigStruct *conf pre_gui_message (szMessage); } else { EnableWindow (GetDlgItem (hDlg, IDC_VIEWINFO), workprefs.info[0]); - } - break; + } + break; case CONFIG_DELETE: - if (strlen (name) == 0) { + if (strlen (name) == 0) { char szMessage[ MAX_DPATH ]; WIN32GUI_LoadUIString( IDS_MUSTSELECTCONFIGFORDELETE, szMessage, MAX_DPATH ); pre_gui_message (szMessage); - } else { + } else { char szMessage[ MAX_DPATH ]; char szTitle[ MAX_DPATH ]; WIN32GUI_LoadUIString( IDS_DELETECONFIGCONFIRMATION, szMessage, MAX_DPATH ); WIN32GUI_LoadUIString( IDS_DELETECONFIGTITLE, szTitle, MAX_DPATH ); - if( MessageBox( hDlg, szMessage, szTitle, + if( MessageBox( hDlg, szMessage, szTitle, MB_YESNO | MB_ICONWARNING | MB_APPLMODAL | MB_SETFOREGROUND ) == IDYES ) { cfgfile_backup (path); DeleteFile (path); write_log ("deleted config '%s'\n", path); - } - } - break; - } + } + } + break; + } } return full_path; } @@ -1614,9 +1614,9 @@ static void set_lventry_input (HWND list, int index) inputdevice_get_mapped_name (input_selected_device, index, &flags, name, custom, input_selected_sub_num); if (flags & IDEV_MAPPED_AUTOFIRE_SET) - WIN32GUI_LoadUIString (IDS_YES, af, sizeof (af)); + WIN32GUI_LoadUIString (IDS_YES, af, sizeof (af)); else if (flags & IDEV_MAPPED_AUTOFIRE_POSSIBLE) - WIN32GUI_LoadUIString (IDS_NO, af, sizeof (af)); + WIN32GUI_LoadUIString (IDS_NO, af, sizeof (af)); else strcpy (af,"-"); ListView_SetItemText(list, index, 1, custom[0] ? custom : name); @@ -1638,7 +1638,7 @@ static void update_listview_input (HWND hDlg) for (i = 0; i < inputdevice_get_widget_num (input_selected_device); i++) set_lventry_input (GetDlgItem (hDlg, IDC_INPUTLIST), i); } - + static int clicked_entry = -1; #define LOADSAVE_COLUMNS 2 @@ -1683,7 +1683,7 @@ void InitializeListView (HWND hDlg) WIN32GUI_LoadUIString( IDS_BLOCKSIZE, column_heading[4], MAX_COLUMN_HEADING_WIDTH ); WIN32GUI_LoadUIString( IDS_HFDSIZE, column_heading[5], MAX_COLUMN_HEADING_WIDTH ); WIN32GUI_LoadUIString( IDS_BOOTPRI, column_heading[6], MAX_COLUMN_HEADING_WIDTH ); - list = GetDlgItem( hDlg, IDC_VOLUMELIST ); + list = GetDlgItem( hDlg, IDC_VOLUMELIST ); } else if (hDlg == pages[INPUT_ID]) { listview_num_columns = INPUT_COLUMNS; lv_type = LV_INPUT; @@ -1691,7 +1691,7 @@ void InitializeListView (HWND hDlg) WIN32GUI_LoadUIString( IDS_INPUTAMIGAEVENT, column_heading[1], MAX_COLUMN_HEADING_WIDTH ); WIN32GUI_LoadUIString( IDS_INPUTAUTOFIRE, column_heading[2], MAX_COLUMN_HEADING_WIDTH ); strcpy (column_heading[3], "#"); - list = GetDlgItem( hDlg, IDC_INPUTLIST ); + list = GetDlgItem( hDlg, IDC_INPUTLIST ); } else { listview_num_columns = DISK_COLUMNS; lv_type = LV_DISK; @@ -1705,21 +1705,21 @@ void InitializeListView (HWND hDlg) ListView_DeleteAllItems( list ); for( i = 0; i < listview_num_columns; i++ ) - listview_column_width[i] = ListView_GetStringWidth( list, column_heading[i] ) + 15; + listview_column_width[i] = ListView_GetStringWidth( list, column_heading[i] ) + 15; // If there are no columns, then insert some lvcolumn.mask = LVCF_WIDTH; if( ListView_GetColumn( list, 1, &lvcolumn ) == FALSE ) { - for( i = 0; i < listview_num_columns; i++ ) - { - lvcolumn.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM; - lvcolumn.iSubItem = i; - lvcolumn.fmt = LVCFMT_LEFT; - lvcolumn.pszText = column_heading[i]; - lvcolumn.cx = listview_column_width[i]; - ListView_InsertColumn( list, i, &lvcolumn ); - } + for( i = 0; i < listview_num_columns; i++ ) + { + lvcolumn.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM; + lvcolumn.iSubItem = i; + lvcolumn.fmt = LVCFMT_LEFT; + lvcolumn.pszText = column_heading[i]; + lvcolumn.cx = listview_column_width[i]; + ListView_InsertColumn( list, i, &lvcolumn ); + } } if (lv_type == LV_INPUT) { @@ -1760,7 +1760,7 @@ void InitializeListView (HWND hDlg) while (j > 0) { if ((tmp2[j - 1] == '\\' || tmp2[j - 1] == '/')) { if (!(j >= 5 && (tmp2[j - 5] == '.' || tmp2[j - 4] == '.'))) - break; + break; } j--; } @@ -1783,117 +1783,117 @@ void InitializeListView (HWND hDlg) else if (lv_type == LV_HARDDISK) { #ifdef FILESYS - for( i = 0; i < nr_units( currprefs.mountinfo ); i++ ) - { + for( i = 0; i < nr_units( currprefs.mountinfo ); i++ ) + { int secspertrack, surfaces, reserved, blocksize, bootpri; uae_u64 size; int cylinders, readonly, type; char *volname, *devname, *rootdir; - char *failure; + char *failure; failure = get_filesys_unit (currprefs.mountinfo, i, - &devname, &volname, &rootdir, &readonly, + &devname, &volname, &rootdir, &readonly, &secspertrack, &surfaces, &reserved, &cylinders, &size, &blocksize, &bootpri, 0, 0); type = is_hardfile (currprefs.mountinfo, i); if (size >= 1024 * 1024 * 1024) - sprintf (size_str, "%.1fG", ((double)(uae_u32)(size / (1024 * 1024))) / 1024.0); + sprintf (size_str, "%.1fG", ((double)(uae_u32)(size / (1024 * 1024))) / 1024.0); else - sprintf (size_str, "%.1fM", ((double)(uae_u32)(size / (1024))) / 1024.0); - if (type == FILESYS_HARDFILE) { - sprintf (blocksize_str, "%d", blocksize); - strcpy (devname_str, devname); - strcpy (volname_str, "n/a"); + sprintf (size_str, "%.1fM", ((double)(uae_u32)(size / (1024))) / 1024.0); + if (type == FILESYS_HARDFILE) { + sprintf (blocksize_str, "%d", blocksize); + strcpy (devname_str, devname); + strcpy (volname_str, "n/a"); sprintf (bootpri_str, "%d", bootpri); - } else if (type == FILESYS_HARDFILE_RDB || type == FILESYS_HARDDRIVE) { - sprintf (blocksize_str, "%d", blocksize); - strcpy (devname_str, "n/a"); + } else if (type == FILESYS_HARDFILE_RDB || type == FILESYS_HARDDRIVE) { + sprintf (blocksize_str, "%d", blocksize); + strcpy (devname_str, "n/a"); strcpy (volname_str, "n/a"); strcpy (bootpri_str, "n/a"); } else { - strcpy (blocksize_str, "n/a"); - strcpy (devname_str, devname); - strcpy (volname_str, volname); + strcpy (blocksize_str, "n/a"); + strcpy (devname_str, devname); + strcpy (volname_str, volname); strcpy (size_str, "n/a"); sprintf (bootpri_str, "%d", bootpri); - } + } if (readonly) - WIN32GUI_LoadUIString (IDS_NO, readwrite_str, sizeof (readwrite_str)); + WIN32GUI_LoadUIString (IDS_NO, readwrite_str, sizeof (readwrite_str)); else - WIN32GUI_LoadUIString (IDS_YES, readwrite_str, sizeof (readwrite_str)); + WIN32GUI_LoadUIString (IDS_YES, readwrite_str, sizeof (readwrite_str)); lvstruct.mask = LVIF_TEXT | LVIF_PARAM; - lvstruct.pszText = devname_str; - lvstruct.lParam = 0; - lvstruct.iItem = i; - lvstruct.iSubItem = 0; - result = ListView_InsertItem (list, &lvstruct); - if (result != -1) { - width = ListView_GetStringWidth( list, devname_str) + 15; - if( width > listview_column_width[0] ) - listview_column_width[0] = width; + lvstruct.pszText = devname_str; + lvstruct.lParam = 0; + lvstruct.iItem = i; + lvstruct.iSubItem = 0; + result = ListView_InsertItem (list, &lvstruct); + if (result != -1) { + width = ListView_GetStringWidth( list, devname_str) + 15; + if( width > listview_column_width[0] ) + listview_column_width[0] = width; ListView_SetItemText( list, result, 1, volname_str ); - width = ListView_GetStringWidth( list, volname_str ) + 15; - if( width > listview_column_width[ 1 ] ) - listview_column_width[ 1 ] = width; + width = ListView_GetStringWidth( list, volname_str ) + 15; + if( width > listview_column_width[ 1 ] ) + listview_column_width[ 1 ] = width; listview_column_width [ 2 ] = 150; - ListView_SetItemText( list, result, 2, rootdir ); - width = ListView_GetStringWidth( list, rootdir ) + 15; - if( width > listview_column_width[ 2 ] ) - listview_column_width[ 2 ] = width; + ListView_SetItemText( list, result, 2, rootdir ); + width = ListView_GetStringWidth( list, rootdir ) + 15; + if( width > listview_column_width[ 2 ] ) + listview_column_width[ 2 ] = width; ListView_SetItemText( list, result, 3, readwrite_str ); - width = ListView_GetStringWidth( list, readwrite_str ) + 15; - if( width > listview_column_width[ 3 ] ) - listview_column_width[ 3 ] = width; + width = ListView_GetStringWidth( list, readwrite_str ) + 15; + if( width > listview_column_width[ 3 ] ) + listview_column_width[ 3 ] = width; ListView_SetItemText( list, result, 4, blocksize_str ); - width = ListView_GetStringWidth( list, blocksize_str ) + 15; - if( width > listview_column_width[ 4 ] ) - listview_column_width[ 4 ] = width; + width = ListView_GetStringWidth( list, blocksize_str ) + 15; + if( width > listview_column_width[ 4 ] ) + listview_column_width[ 4 ] = width; ListView_SetItemText( list, result, 5, size_str ); - width = ListView_GetStringWidth( list, size_str ) + 15; - if( width > listview_column_width[ 5 ] ) - listview_column_width[ 5 ] = width; + width = ListView_GetStringWidth( list, size_str ) + 15; + if( width > listview_column_width[ 5 ] ) + listview_column_width[ 5 ] = width; ListView_SetItemText( list, result, 6, bootpri_str ); - width = ListView_GetStringWidth( list, bootpri_str ) + 15; - if( width > listview_column_width[ 6 ] ) - listview_column_width[ 6 ] = width; + width = ListView_GetStringWidth( list, bootpri_str ) + 15; + if( width > listview_column_width[ 6 ] ) + listview_column_width[ 6 ] = width; } - } + } #endif } if( result != -1 ) { - if( GetWindowRect( list, &rect ) ) - { - ScreenToClient( hDlg, (LPPOINT)&rect ); - ScreenToClient( hDlg, (LPPOINT)&rect.right ); - if( listview_num_columns == 2 ) - { - if( ( temp = rect.right - rect.left - listview_column_width[ 0 ] - 4 ) > listview_column_width[1] ) - listview_column_width[1] = temp; - } - } + if( GetWindowRect( list, &rect ) ) + { + ScreenToClient( hDlg, (LPPOINT)&rect ); + ScreenToClient( hDlg, (LPPOINT)&rect.right ); + if( listview_num_columns == 2 ) + { + if( ( temp = rect.right - rect.left - listview_column_width[ 0 ] - 4 ) > listview_column_width[1] ) + listview_column_width[1] = temp; + } + } - // Adjust our column widths so that we can see the contents... - for( i = 0; i < listview_num_columns; i++ ) - { - ListView_SetColumnWidth( list, i, listview_column_width[i] ); - } + // Adjust our column widths so that we can see the contents... + for( i = 0; i < listview_num_columns; i++ ) + { + ListView_SetColumnWidth( list, i, listview_column_width[i] ); + } - // Turn on full-row-select option - ListView_SetExtendedListViewStyle( list, LVS_EX_FULLROWSELECT ); + // Turn on full-row-select option + ListView_SetExtendedListViewStyle( list, LVS_EX_FULLROWSELECT ); - // Redraw the items in the list... - items = ListView_GetItemCount( list ); - ListView_RedrawItems( list, 0, items ); + // Redraw the items in the list... + items = ListView_GetItemCount( list ); + ListView_RedrawItems( list, 0, items ); } } @@ -2045,8 +2045,8 @@ static int LoadConfigTreeView (HWND hDlg, int idx, HTREEITEM parent) cparent = configstore[idx]->Parent; idx = 0; while (idx < configstoresize) { - config = configstore[idx]; - if ((configtypepanel == 1 && !config->hardware) || (configtypepanel == 2 && !config->host) || (configtypepanel == 0 && (config->host || config->hardware))) { + config = configstore[idx]; + if ((configtypepanel == 1 && !config->hardware) || (configtypepanel == 2 && !config->host) || (configtypepanel == 0 && (config->host || config->hardware))) { idx++; continue; } @@ -2087,8 +2087,8 @@ static void InitializeConfig (HWND hDlg, struct ConfigStruct *config) SetDlgItemText (hDlg, IDC_EDITNAME, ""); SetDlgItemText (hDlg, IDC_EDITDESCRIPTION, ""); } else { - SetDlgItemText (hDlg, IDC_EDITNAME, config->Name); - SetDlgItemText (hDlg, IDC_EDITDESCRIPTION, config->Description); + SetDlgItemText (hDlg, IDC_EDITNAME, config->Name); + SetDlgItemText (hDlg, IDC_EDITDESCRIPTION, config->Description); } SendDlgItemMessage (hDlg, IDC_CONFIGLINK, CB_RESETCONTENT, 0, 0L); SendDlgItemMessage (hDlg, IDC_CONFIGLINK, CB_ADDSTRING, 0, (LPARAM)""); @@ -2099,7 +2099,7 @@ static void InitializeConfig (HWND hDlg, struct ConfigStruct *config) struct ConfigStruct *cs = configstore[i]; if ((j == 0 && cs->Type == CONFIG_TYPE_HOST) || (j == 1 && cs->Type == CONFIG_TYPE_HARDWARE)) { char tmp2[MAX_DPATH]; - strcpy (tmp2, configstore[i]->Path); + strcpy (tmp2, configstore[i]->Path); strncat (tmp2, configstore[i]->Name, MAX_DPATH); SendDlgItemMessage (hDlg, IDC_CONFIGLINK, CB_ADDSTRING, 0, (LPARAM)tmp2); if (config && (!strcmpi (tmp2, config->HardwareLink) || !strcmpi (tmp2, config->HostLink))) @@ -2157,7 +2157,7 @@ static void ConfigToRegistry2 (DWORD ct, int type, DWORD noauto) RegSetValueEx (hWinUAEKey, "ConfigFile_NoAuto", 0, REG_DWORD, (CONST BYTE *)&noauto, sizeof (noauto)); } -static void checkautoload (HWND hDlg, struct ConfigStruct *config) +static void checkautoload (HWND hDlg, struct ConfigStruct *config) { int ct = 0; DWORD dwType = REG_DWORD; @@ -2182,11 +2182,11 @@ static struct ConfigStruct *fixloadconfig (HWND hDlg, struct ConfigStruct *confi if (config && configtypepanel == 0 && (config->host || config->hardware)) return NULL; if ((!config && configtypepanel) || (config && (configtypepanel == 2 && !config->host) || (configtypepanel == 1 && !config->hardware))) { - for (i = 0; i < configstoresize; i++) { + for (i = 0; i < configstoresize; i++) { struct ConfigStruct *cs = configstore[i]; if (cs->Directory && ((configtypepanel == 1 && cs->hardware) || (configtypepanel == 2 && cs->host))) { - config = cs; - SetDlgItemText (hDlg, IDC_EDITPATH, config->Path); + config = cs; + SetDlgItemText (hDlg, IDC_EDITPATH, config->Path); break; } } @@ -2205,21 +2205,21 @@ static struct ConfigStruct *initloadsave (HWND hDlg, struct ConfigStruct *config SetDlgItemText (hDlg, IDC_EDITDESCRIPTION, workprefs.description); root = InitializeConfigTreeView (hDlg); if (hWinUAEKey) { - DWORD dwType = REG_SZ; - DWORD dwRFPsize = sizeof (name_buf); - char path[MAX_DPATH]; - if (RegQueryValueEx (hWinUAEKey, configreg[configtypepanel], 0, &dwType, (LPBYTE)name_buf, &dwRFPsize) == ERROR_SUCCESS) { + DWORD dwType = REG_SZ; + DWORD dwRFPsize = sizeof (name_buf); + char path[MAX_DPATH]; + if (RegQueryValueEx (hWinUAEKey, configreg[configtypepanel], 0, &dwType, (LPBYTE)name_buf, &dwRFPsize) == ERROR_SUCCESS) { struct ConfigStruct *config2 = getconfigstorefrompath (name_buf, path, configtypepanel); if (config2) - config = config2; + config = config2; } checkautoload (hDlg, config); } config = fixloadconfig (hDlg, config); if (config && config->item) - TreeView_SelectItem (GetDlgItem(hDlg, IDC_CONFIGTREE), config->item); + TreeView_SelectItem (GetDlgItem(hDlg, IDC_CONFIGTREE), config->item); else - TreeView_SelectItem (GetDlgItem(hDlg, IDC_CONFIGTREE), root); + TreeView_SelectItem (GetDlgItem(hDlg, IDC_CONFIGTREE), root); EnableWindow (GetDlgItem(hDlg, IDC_CONFIGAUTO), configtypepanel > 0); EnableWindow (GetDlgItem(hDlg, IDC_CONFIGLINK), configtypepanel == 0); EnableWindow (GetDlgItem(hDlg, IDC_CONFIGNOLINK), configtypepanel == 0); @@ -2252,13 +2252,13 @@ static INT_PTR CALLBACK LoadSaveDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPA case WM_COMMAND: { recursive++; - switch (LOWORD (wParam)) - { + switch (LOWORD (wParam)) + { case IDC_SAVE: HandleConfiguration (hDlg, CONFIG_SAVE_FULL, config); config = CreateConfigStore (config); config = fixloadconfig (hDlg, config); - ConfigToRegistry (config, configtypepanel); + ConfigToRegistry (config, configtypepanel); InitializeConfigTreeView (hDlg); InitializeConfig (hDlg, config); break; @@ -2266,12 +2266,12 @@ static INT_PTR CALLBACK LoadSaveDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPA HandleConfiguration (hDlg, CONFIG_SAVE, config); config = CreateConfigStore (config); config = fixloadconfig (hDlg, config); - ConfigToRegistry (config, configtypepanel); + ConfigToRegistry (config, configtypepanel); InitializeConfigTreeView (hDlg); InitializeConfig (hDlg, config); break; case IDC_QUICKLOAD: - cfgfile = HandleConfiguration (hDlg, CONFIG_LOAD, config); + cfgfile = HandleConfiguration (hDlg, CONFIG_LOAD, config); ConfigToRegistry (config, configtypepanel); InitializeConfig (hDlg, config); if (full_property_sheet) { @@ -2327,14 +2327,14 @@ static INT_PTR CALLBACK LoadSaveDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPA case IDC_CONFIGLINK: if (HIWORD (wParam) == CBN_SELCHANGE || HIWORD (wParam) == CBN_KILLFOCUS) { LRESULT val; - char tmp[MAX_DPATH]; + char tmp[MAX_DPATH]; tmp[0] = 0; val = SendDlgItemMessage (hDlg, IDC_CONFIGLINK, CB_GETCURSEL, 0, 0L); if (val == CB_ERR) SendDlgItemMessage (hDlg, IDC_CONFIGLINK, WM_GETTEXT, (WPARAM)sizeof(tmp), (LPARAM)tmp); else SendDlgItemMessage (hDlg, IDC_CONFIGLINK, CB_GETLBTEXT, (WPARAM)val, (LPARAM)tmp); - strcpy (workprefs.config_host_path, tmp); + strcpy (workprefs.config_host_path, tmp); } break; } @@ -2344,24 +2344,24 @@ static INT_PTR CALLBACK LoadSaveDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPA case WM_NOTIFY: { - LPNMHDR nm = (LPNMHDR)lParam; - if (nm->hwndFrom == GetDlgItem (hDlg, IDC_CONFIGTREE)) { + LPNMHDR nm = (LPNMHDR)lParam; + if (nm->hwndFrom == GetDlgItem (hDlg, IDC_CONFIGTREE)) { switch (nm->code) { - case NM_DBLCLK: - { + case NM_DBLCLK: + { HTREEITEM ht = TreeView_GetSelection (GetDlgItem(hDlg, IDC_CONFIGTREE)); if (ht != NULL) { - TVITEMEX pitem; - memset (&pitem, 0, sizeof (pitem)); - pitem.mask = TVIF_HANDLE | TVIF_PARAM; - pitem.hItem = ht; - if (TreeView_GetItem (GetDlgItem(hDlg, IDC_CONFIGTREE), &pitem)) { + TVITEMEX pitem; + memset (&pitem, 0, sizeof (pitem)); + pitem.mask = TVIF_HANDLE | TVIF_PARAM; + pitem.hItem = ht; + if (TreeView_GetItem (GetDlgItem(hDlg, IDC_CONFIGTREE), &pitem)) { struct ConfigStruct *config = (struct ConfigStruct*)pitem.lParam; if (config && !config->Directory) { - cfgfile = HandleConfiguration (hDlg, CONFIG_LOAD, config); - ConfigToRegistry (config, configtypepanel); - if (!full_property_sheet) + cfgfile = HandleConfiguration (hDlg, CONFIG_LOAD, config); + ConfigToRegistry (config, configtypepanel); + if (!full_property_sheet) uae_restart (0, cfgfile); exit_gui (1); } @@ -2377,8 +2377,8 @@ static INT_PTR CALLBACK LoadSaveDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPA LPNMTREEVIEW tv = (LPNMTREEVIEW)lParam; struct ConfigStruct *c = (struct ConfigStruct*)tv->itemNew.lParam; if (c) { - config = c; - if (!config->Directory) { + config = c; + if (!config->Directory) { InitializeConfig (hDlg, config); } else { InitializeConfig (hDlg, NULL); @@ -2386,11 +2386,11 @@ static INT_PTR CALLBACK LoadSaveDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPA SetDlgItemText (hDlg, IDC_EDITPATH, config->Path); } if (configtypepanel > 0) { - if (c && !c->Directory) { + if (c && !c->Directory) { ConfigToRegistry (config, configtypepanel); InitializeConfig (hDlg, config); } - checkautoload (hDlg, c); + checkautoload (hDlg, c); } return TRUE; } @@ -2477,7 +2477,7 @@ static void SetupRichText( HWND hDlg, urlinfo *url ) SendDlgItemMessage( hDlg, url->id, EM_GETCHARFORMAT, 0, (LPARAM)&CharFormat ); CharFormat.dwMask |= CFM_UNDERLINE | CFM_SIZE | CFM_FACE | CFM_COLOR; CharFormat.dwEffects = url->state ? CFE_UNDERLINE : 0; - CharFormat.yHeight = 10 * 20; /* height in twips, where a twip is 1/20th of a point - for a pt.size of 18 */ + CharFormat.yHeight = 10 * 20; /* height in twips, where a twip is 1/20th of a point - for a pt.size of 18 */ CharFormat.crTextColor = GetSysColor( COLOR_ACTIVECAPTION ); strcpy( CharFormat.szFaceName, "Tahoma" ); @@ -2502,16 +2502,16 @@ static void url_handler(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam ) ScreenToClient( hDlg, (POINT *) &rect ); ScreenToClient( hDlg, (POINT *) &(rect.right) ); if( PtInRect( &rect, point ) ) - { - if( msg == WM_LBUTTONDOWN ) - { + { + if( msg == WM_LBUTTONDOWN ) + { ShellExecute (NULL, NULL, urls[i].url , NULL, NULL, SW_SHOWNORMAL); - SetCursor( LoadCursor( NULL, MAKEINTRESOURCE(IDC_ARROW) ) ); - } - else - { - if( ( i != last_rectangle ) ) - { + SetCursor( LoadCursor( NULL, MAKEINTRESOURCE(IDC_ARROW) ) ); + } + else + { + if( ( i != last_rectangle ) ) + { // try and load the system hand (Win2000+) m_hCursor = LoadCursor(NULL, MAKEINTRESOURCE(IDC_HAND) ); if (!m_hCursor) @@ -2519,28 +2519,28 @@ static void url_handler(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam ) // retry with our fallback hand m_hCursor = LoadCursor(hInst, MAKEINTRESOURCE(IDC_MYHAND) ); } - SetCursor( m_hCursor ); - urls[i].state = TRUE; - SetupRichText( hDlg, &urls[i] ); + SetCursor( m_hCursor ); + urls[i].state = TRUE; + SetupRichText( hDlg, &urls[i] ); if( last_rectangle != -1 ) { urls[last_rectangle].state = FALSE; SetupRichText( hDlg, &urls[last_rectangle] ); } - } - } + } + } last_rectangle = i; - found = TRUE; + found = TRUE; break; } } if( !found && last_rectangle >= 0 ) { - SetCursor( LoadCursor( NULL, MAKEINTRESOURCE(IDC_ARROW) ) ); - urls[last_rectangle].state = FALSE; - SetupRichText( hDlg, &urls[last_rectangle] ); + SetCursor( LoadCursor( NULL, MAKEINTRESOURCE(IDC_ARROW) ) ); + urls[last_rectangle].state = FALSE; + SetupRichText( hDlg, &urls[last_rectangle] ); last_rectangle = -1; } } @@ -2617,7 +2617,7 @@ static INT_PTR CALLBACK PathsDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM strcat (tmp, "\\"); if (!scan_roms (tmp)) gui_message_id (IDS_ROMSCANNOROMS); - set_path ("KickstartPath", tmp); + set_path ("KickstartPath", tmp); values_to_pathsdialog (hDlg); } break; @@ -2763,10 +2763,10 @@ static void init_quickstartdlg_tooltip (HWND hDlg, char *tt) ti.hinst = hInst; ti.uId = (UINT)GetDlgItem (hDlg, IDC_QUICKSTART_CONFIGURATION); ti.lpszText = tt; - SendMessage (ToolTipHWND, TTM_DELTOOL, 0, (LPARAM) (LPTOOLINFO) &ti); + SendMessage (ToolTipHWND, TTM_DELTOOL, 0, (LPARAM) (LPTOOLINFO) &ti); if (!tt) return; - SendMessage (ToolTipHWND, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti); + SendMessage (ToolTipHWND, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti); } static void init_quickstartdlg (HWND hDlg) @@ -2780,15 +2780,15 @@ static void init_quickstartdlg (HWND hDlg) qssize = sizeof (tmp1); RegQueryValueEx (hWinUAEKey, "QuickStartHostConfig", 0, &dwType, (LPBYTE)hostconf, &qssize); if (firsttime == 0) { - if (hWinUAEKey) { + if (hWinUAEKey) { qssize = sizeof (quickstart_model); - RegQueryValueEx (hWinUAEKey, "QuickStartModel", 0, &dwType, (LPBYTE)&quickstart_model, &qssize); + RegQueryValueEx (hWinUAEKey, "QuickStartModel", 0, &dwType, (LPBYTE)&quickstart_model, &qssize); qssize = sizeof (quickstart_conf); - RegQueryValueEx (hWinUAEKey, "QuickStartConfiguration", 0, &dwType, (LPBYTE)&quickstart_conf, &qssize); + RegQueryValueEx (hWinUAEKey, "QuickStartConfiguration", 0, &dwType, (LPBYTE)&quickstart_conf, &qssize); qssize = sizeof (quickstart_compa); - RegQueryValueEx (hWinUAEKey, "QuickStartCompatibility", 0, &dwType, (LPBYTE)&quickstart_compa, &qssize); + RegQueryValueEx (hWinUAEKey, "QuickStartCompatibility", 0, &dwType, (LPBYTE)&quickstart_compa, &qssize); } - if (quickstart) { + if (quickstart) { workprefs.df[0][0] = 0; workprefs.df[1][0] = 0; workprefs.df[2][0] = 0; @@ -2830,13 +2830,13 @@ static void init_quickstartdlg (HWND hDlg) SendDlgItemMessage (hDlg, IDC_QUICKSTART_CONFIGURATION, CB_RESETCONTENT, 0, 0L); i = 0; for (;;) { - p2 = strchr (p1, '\n'); - if (!p2) + p2 = strchr (p1, '\n'); + if (!p2) break; *p2++= 0; SendDlgItemMessage (hDlg, IDC_QUICKSTART_CONFIGURATION, CB_ADDSTRING, 0, (LPARAM)p1); p1 = p2; - p2 = strchr (p1, '\n'); + p2 = strchr (p1, '\n'); if (!p2) break; *p2++= 0; @@ -3044,10 +3044,10 @@ static INT_PTR CALLBACK QuickstartDlgProc (HWND hDlg, UINT msg, WPARAM wParam, L if (hWinUAEKey) RegSetValueEx( hWinUAEKey, "QuickStartMode", 0, REG_DWORD, (CONST BYTE *)&quickstart, sizeof(quickstart)); if (quickstart) { - init_quickstartdlg (hDlg); + init_quickstartdlg (hDlg); load_quickstart (hDlg, 0); } - enable_for_quickstart (hDlg); + enable_for_quickstart (hDlg); break; } } @@ -3087,13 +3087,13 @@ static INT_PTR CALLBACK QuickstartDlgProc (HWND hDlg, UINT msg, WPARAM wParam, L if (recursive == 0 && quickstart) { recursive++; if (strcmp (workprefs.df[0], df0) || workprefs.dfxtype[0] != dfxtype[0]) { - strcpy (df0, workprefs.df[0]); + strcpy (df0, workprefs.df[0]); dfxtype[0] = workprefs.dfxtype[0]; testimage (hDlg, 0); enable_for_quickstart (hDlg); } if (strcmp (workprefs.df[1], df1) || workprefs.dfxtype[1] != dfxtype[1]) { - strcpy (df1, workprefs.df[1]); + strcpy (df1, workprefs.df[1]); dfxtype[1] = workprefs.dfxtype[1]; testimage (hDlg, 1); } @@ -3129,7 +3129,7 @@ static void init_aboutdlg (HWND hDlg) for( i = 0; urls[i].id >= 0; i++ ) { - SetupRichText( hDlg, &urls[i] ); + SetupRichText( hDlg, &urls[i] ); } } @@ -3168,12 +3168,12 @@ static void enable_for_displaydlg (HWND hDlg) EnableWindow (GetDlgItem (hDlg, IDC_PFULLSCREEN), rtg); if (! full_property_sheet) { /* Disable certain controls which are only to be set once at start-up... */ - EnableWindow (GetDlgItem (hDlg, IDC_TEST16BIT), FALSE); + EnableWindow (GetDlgItem (hDlg, IDC_TEST16BIT), FALSE); } else { - CheckDlgButton( hDlg, IDC_VSYNC, workprefs.gfx_vsync); - EnableWindow (GetDlgItem (hDlg, IDC_XCENTER), TRUE); - EnableWindow (GetDlgItem (hDlg, IDC_YCENTER), TRUE); - EnableWindow (GetDlgItem (hDlg, IDC_LM_SCANLINES), TRUE); + CheckDlgButton( hDlg, IDC_VSYNC, workprefs.gfx_vsync); + EnableWindow (GetDlgItem (hDlg, IDC_XCENTER), TRUE); + EnableWindow (GetDlgItem (hDlg, IDC_YCENTER), TRUE); + EnableWindow (GetDlgItem (hDlg, IDC_LM_SCANLINES), TRUE); } EnableWindow (GetDlgItem (hDlg, IDC_FRAMERATE2), !workprefs.gfx_vsync); EnableWindow (GetDlgItem (hDlg, IDC_FRAMERATE), !workprefs.cpu_cycle_exact); @@ -3187,6 +3187,7 @@ static void enable_for_chipsetdlg (HWND hDlg) EnableWindow (GetDlgItem (hDlg, IDC_CYCLEEXACT), FALSE); #endif EnableWindow (GetDlgItem (hDlg, IDC_FASTCOPPER), enable); + EnableWindow (GetDlgItem (hDlg, IDC_GENLOCK), full_property_sheet); EnableWindow (GetDlgItem (hDlg, IDC_BLITIMM), enable); if (enable == FALSE) { workprefs.fast_copper = 0; @@ -3297,9 +3298,9 @@ static void init_frequency_combo (HWND hDlg, int dmode) } index = CB_ERR; if (hz2[0] >= 0) - index = SendDlgItemMessage (hDlg, IDC_REFRESHRATE, CB_SELECTSTRING, 0, (LPARAM)hz2); + index = SendDlgItemMessage (hDlg, IDC_REFRESHRATE, CB_SELECTSTRING, 0, (LPARAM)hz2); if (index == CB_ERR) { - WIN32GUI_LoadUIString (IDS_VSYNC_DEFAULT, txt, sizeof (txt)); + WIN32GUI_LoadUIString (IDS_VSYNC_DEFAULT, txt, sizeof (txt)); SendDlgItemMessage(hDlg, IDC_REFRESHRATE, CB_SELECTSTRING, i, (LPARAM)txt); workprefs.gfx_refreshrate = 0; } @@ -3314,14 +3315,14 @@ static int display_mode_index(uae_u32 x, uae_u32 y, uae_u32 d) i = 0; while (DisplayModes[i].depth >= 0) { - if( DisplayModes[i].res.width == x && - DisplayModes[i].res.height == y && - DisplayModes[i].depth == d ) - break; + if( DisplayModes[i].res.width == x && + DisplayModes[i].res.height == y && + DisplayModes[i].depth == d ) + break; i++; } if(DisplayModes[i].depth < 0) - i = -1; + i = -1; return i; } @@ -3391,7 +3392,7 @@ void init_da (HWND hDlg) SendDlgItemMessage (hDlg, IDC_DA_SLIDER, TBM_SETRANGE, TRUE, MAKELONG (-99, 99)); p = getp_da (); if (p) - SendDlgItemMessage (hDlg, IDC_DA_SLIDER, TBM_SETPOS, TRUE, (*p) / 10); + SendDlgItemMessage (hDlg, IDC_DA_SLIDER, TBM_SETPOS, TRUE, (*p) / 10); } #endif @@ -3402,50 +3403,50 @@ static void init_display_mode (HWND hDlg) switch (workprefs.color_mode) { case 2: - d = 16; - break; + d = 16; + break; case 5: - d = 32; - break; + d = 32; + break; default: - d = 8; - break; + d = 8; + break; } if (workprefs.gfx_afullscreen) { - d2 = d; - if ((index = WIN32GFX_AdjustScreenmode(&workprefs.gfx_width_fs, &workprefs.gfx_height_fs, &d2)) >= 0) - { - switch (d2) - { - case 15: - workprefs.color_mode = 1; - d = 2; - break; - case 16: - workprefs.color_mode = 2; - d = 2; - break; - case 32: - workprefs.color_mode = 5; - d = 4; - break; - default: - workprefs.color_mode = 0; - d = 1; - break; - } - } + d2 = d; + if ((index = WIN32GFX_AdjustScreenmode(&workprefs.gfx_width_fs, &workprefs.gfx_height_fs, &d2)) >= 0) + { + switch (d2) + { + case 15: + workprefs.color_mode = 1; + d = 2; + break; + case 16: + workprefs.color_mode = 2; + d = 2; + break; + case 32: + workprefs.color_mode = 5; + d = 4; + break; + default: + workprefs.color_mode = 0; + d = 1; + break; + } + } } else { - d = d / 8; + d = d / 8; } if ((index = display_mode_index (workprefs.gfx_width_fs, workprefs.gfx_height_fs, d)) >= 0) { - SendDlgItemMessage( hDlg, IDC_RESOLUTION, CB_SETCURSEL, index, 0 ); - init_frequency_combo (hDlg, index); + SendDlgItemMessage( hDlg, IDC_RESOLUTION, CB_SETCURSEL, index, 0 ); + init_frequency_combo (hDlg, index); } } @@ -3474,10 +3475,10 @@ static void values_to_displaydlg (HWND hDlg) WIN32GUI_LoadUIString( IDS_FRAMERATE, buffer, MAX_FRAMERATE_LENGTH ); LoadNthString (v - 1, Nth, MAX_NTH_LENGTH); if( FormatMessage( FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY | FORMAT_MESSAGE_ALLOCATE_BUFFER, - buffer, 0, 0, (LPTSTR)&string, MAX_FRAMERATE_LENGTH + MAX_NTH_LENGTH, (va_list *)blah ) == 0 ) + buffer, 0, 0, (LPTSTR)&string, MAX_FRAMERATE_LENGTH + MAX_NTH_LENGTH, (va_list *)blah ) == 0 ) { DWORD dwLastError = GetLastError(); - sprintf (buffer, "Every %s Frame", nth[v - 1]); + sprintf (buffer, "Every %s Frame", nth[v - 1]); SetDlgItemText( hDlg, IDC_RATETEXT, buffer ); } else @@ -3507,7 +3508,7 @@ static void init_resolution_combo (HWND hDlg) int i = 0; SendDlgItemMessage(hDlg, IDC_RESOLUTION, CB_RESETCONTENT, 0, 0); while (DisplayModes[i].depth >= 0) { - SendDlgItemMessage( hDlg, IDC_RESOLUTION, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)DisplayModes[i].name); + SendDlgItemMessage( hDlg, IDC_RESOLUTION, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)DisplayModes[i].name); i++; } } @@ -3536,7 +3537,7 @@ static void values_from_displaydlg (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l workprefs.gfx_lores = IsDlgButtonChecked (hDlg, IDC_LORES); workprefs.gfx_correct_aspect = IsDlgButtonChecked (hDlg, IDC_ASPECT); workprefs.gfx_linedbl = ( IsDlgButtonChecked( hDlg, IDC_LM_SCANLINES ) ? 2 : - IsDlgButtonChecked( hDlg, IDC_LM_DOUBLED ) ? 1 : 0 ); + IsDlgButtonChecked( hDlg, IDC_LM_DOUBLED ) ? 1 : 0 ); workprefs.gfx_framerate = SendDlgItemMessage (hDlg, IDC_FRAMERATE, TBM_GETPOS, 0, 0); workprefs.chipset_refreshrate = SendDlgItemMessage (hDlg, IDC_FRAMERATE2, TBM_GETPOS, 0, 0); @@ -3562,14 +3563,14 @@ static void values_from_displaydlg (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l SetDlgItemText( hDlg, IDC_RATETEXT, string ); LocalFree( string ); } - sprintf (buffer, "%d", workprefs.chipset_refreshrate); + sprintf (buffer, "%d", workprefs.chipset_refreshrate); SetDlgItemText (hDlg, IDC_RATE2TEXT, buffer); workprefs.gfx_width_win = GetDlgItemInt( hDlg, IDC_XSIZE, &success, FALSE ); - if( !success ) - workprefs.gfx_width_win = 800; + if( !success ) + workprefs.gfx_width_win = 800; workprefs.gfx_height_win = GetDlgItemInt( hDlg, IDC_YSIZE, &success, FALSE ); - if( !success ) - workprefs.gfx_height_win = 600; + if( !success ) + workprefs.gfx_height_win = 600; } if (workprefs.chipset_refreshrate == (currprefs.ntscmode ? 60 : 50)) workprefs.chipset_refreshrate = 0; @@ -3584,7 +3585,7 @@ static void values_from_displaydlg (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l if (Displays[posn].disabled) posn = 0; workprefs.gfx_display = posn; - DisplayModes = Displays[workprefs.gfx_display].DisplayModes; + DisplayModes = Displays[workprefs.gfx_display].DisplayModes; init_resolution_combo (hDlg); init_display_mode (hDlg); } @@ -3624,7 +3625,7 @@ static void values_from_displaydlg (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l workprefs.gfx_refreshrate = 0; } else { posn1--; - workprefs.gfx_refreshrate = storedrefreshrates[posn1]; + workprefs.gfx_refreshrate = storedrefreshrates[posn1]; } values_to_displaydlg (hDlg); #if 0 @@ -3669,7 +3670,7 @@ static INT_PTR CALLBACK DisplayDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPAR values_to_displaydlg (hDlg); enable_for_displaydlg (hDlg); recursive--; - break; + break; case WM_HSCROLL: case WM_COMMAND: @@ -3709,8 +3710,8 @@ static INT_PTR CALLBACK DisplayDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPAR } if (hw3d_changed && recursive == 0) { recursive++; - enable_for_displaydlg (hDlg); - values_to_displaydlg (hDlg); + enable_for_displaydlg (hDlg); + values_to_displaydlg (hDlg); hw3d_changed = 0; recursive--; } @@ -3746,6 +3747,7 @@ static void values_to_chipsetdlg (HWND hDlg) break; } CheckDlgButton (hDlg, IDC_NTSC, workprefs.ntscmode); + CheckDlgButton (hDlg, IDC_GENLOCK, workprefs.genlock); CheckDlgButton (hDlg, IDC_FASTCOPPER, workprefs.fast_copper); CheckDlgButton (hDlg, IDC_BLITIMM, workprefs.immediate_blits); CheckRadioButton (hDlg, IDC_COLLISION0, IDC_COLLISION3, IDC_COLLISION0 + workprefs.collision_level); @@ -3764,6 +3766,7 @@ static void values_from_chipsetdlg (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l int n, snd; workprefs.fast_copper = IsDlgButtonChecked (hDlg, IDC_FASTCOPPER); + workprefs.genlock = IsDlgButtonChecked (hDlg, IDC_FASTCOPPER); workprefs.immediate_blits = IsDlgButtonChecked (hDlg, IDC_BLITIMM); n = IsDlgButtonChecked (hDlg, IDC_CYCLEEXACT) ? 1 : 0; if (workprefs.cpu_cycle_exact != n) { @@ -3815,8 +3818,8 @@ static INT_PTR CALLBACK ChipsetDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPAR case WM_INITDIALOG: pages[CHIPSET_ID] = hDlg; currentpage = CHIPSET_ID; -#ifndef AGA - EnableWindow (GetDlgItem (hDlg, IDC_AGA), FALSE); +#ifndef AGA + EnableWindow (GetDlgItem (hDlg, IDC_AGA), FALSE); #endif case WM_USER: @@ -3824,7 +3827,7 @@ static INT_PTR CALLBACK ChipsetDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPAR values_to_chipsetdlg (hDlg); enable_for_chipsetdlg (hDlg); recursive--; - break; + break; case WM_HSCROLL: case WM_COMMAND: @@ -3961,7 +3964,7 @@ static INT_PTR CALLBACK MemoryDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARA values_to_memorydlg (hDlg); enable_for_memorydlg (hDlg); recursive--; - break; + break; case WM_HSCROLL: workprefs.chipmem_size = memsizes[msi_chip[SendMessage (GetDlgItem (hDlg, IDC_CHIPMEM), TBM_GETPOS, 0, 0)]]; @@ -3972,7 +3975,7 @@ static INT_PTR CALLBACK MemoryDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARA fix_values_memorydlg (); values_to_memorydlg (hDlg); enable_for_memorydlg (hDlg); - break; + break; case WM_COMMAND: if (recursive > 0) @@ -4000,12 +4003,12 @@ static void addromfiles (HKEY fkey, HWND hDlg, DWORD d, char *path, uae_u8 *keyb idx = 0; seltmp[0] = 0; for (;fkey;) { - DWORD size = sizeof (tmp); - DWORD size2 = sizeof (tmp2); - int err = RegEnumValue(fkey, idx, tmp, &size, NULL, NULL, tmp2, &size2); - if (err != ERROR_SUCCESS) + DWORD size = sizeof (tmp); + DWORD size2 = sizeof (tmp2); + int err = RegEnumValue(fkey, idx, tmp, &size, NULL, NULL, tmp2, &size2); + if (err != ERROR_SUCCESS) break; - if (strlen (tmp) == 5) { + if (strlen (tmp) == 5) { idx2 = atol (tmp + 3); if (idx2 >= 0) { struct romdata *rd = getromdatabyid (idx2); @@ -4045,8 +4048,8 @@ static void getromfile (HWND hDlg, DWORD d, char *path, int size) sprintf (tmp1, "ROM%02d", rd->id); tmp2[0] = 0; RegQueryValueEx (fkey, tmp1, NULL, NULL, tmp2, &outsize); - RegCloseKey (fkey); - if (tmp2[0]) + RegCloseKey (fkey); + if (tmp2[0]) strncpy (path, tmp2, size); } } @@ -4069,12 +4072,12 @@ static void values_to_kickstartdlg (HWND hDlg) if (hWinUAEKey) { RegCreateKeyEx(hWinUAEKey , "DetectedROMs", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WRITE, NULL, &fkey, NULL); - keybuf = load_keyfile (&workprefs, NULL, &keysize); + keybuf = load_keyfile (&workprefs, NULL, &keysize); addromfiles (fkey, hDlg, IDC_ROMFILE, workprefs.romfile, keybuf, keysize, ROMTYPE_KICK | ROMTYPE_KICKCD32); addromfiles (fkey, hDlg, IDC_ROMFILE2, workprefs.romextfile, keybuf, keysize, ROMTYPE_EXTCD32 | ROMTYPE_EXTCDTV); addromfiles (fkey, hDlg, IDC_CARTFILE, workprefs.cartfile, keybuf, keysize, ROMTYPE_AR | ROMTYPE_ARCADIA); free_keyfile (keybuf); - if (fkey) + if (fkey) RegCloseKey (fkey); } @@ -4105,7 +4108,7 @@ static void init_kickstart (HWND hDlg) EnableWindow( GetDlgItem( hDlg, IDC_FLASHCHOOSER), FALSE ); #endif if (RegOpenKeyEx (hWinUAEKey , "DetectedROMs", 0, KEY_READ, &fkey) != ERROR_SUCCESS) - scan_roms (workprefs.path_rom); + scan_roms (workprefs.path_rom); if (fkey) RegCloseKey (fkey); } @@ -4149,7 +4152,7 @@ static INT_PTR CALLBACK KickstartDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LP DiskSelection(hDlg, IDC_ROMFILE2, 6, &workprefs, 0); values_to_kickstartdlg (hDlg); break; - + case IDC_FLASHCHOOSER: DiskSelection(hDlg, IDC_FLASHFILE, 11, &workprefs, 0); values_to_kickstartdlg (hDlg); @@ -4174,7 +4177,7 @@ static INT_PTR CALLBACK KickstartDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LP } recursive--; - break; + break; } return FALSE; } @@ -4183,37 +4186,37 @@ static void enable_for_miscdlg (HWND hDlg) { if( !full_property_sheet ) { - EnableWindow (GetDlgItem (hDlg, IDC_JULIAN), TRUE); - EnableWindow (GetDlgItem (hDlg, IDC_CTRLF11), TRUE); - EnableWindow (GetDlgItem (hDlg, IDC_SOCKETS), FALSE); - EnableWindow (GetDlgItem (hDlg, IDC_SHOWGUI), FALSE); - EnableWindow (GetDlgItem (hDlg, IDC_CREATELOGFILE), FALSE); - EnableWindow (GetDlgItem (hDlg, IDC_ILLEGAL), FALSE); - EnableWindow (GetDlgItem (hDlg, IDC_NOSPEED), TRUE); - EnableWindow (GetDlgItem (hDlg, IDC_NOSPEEDPAUSE), TRUE); - EnableWindow (GetDlgItem (hDlg, IDC_NOSOUND), TRUE); + EnableWindow (GetDlgItem (hDlg, IDC_JULIAN), TRUE); + EnableWindow (GetDlgItem (hDlg, IDC_CTRLF11), TRUE); + EnableWindow (GetDlgItem (hDlg, IDC_SOCKETS), FALSE); + EnableWindow (GetDlgItem (hDlg, IDC_SHOWGUI), FALSE); + EnableWindow (GetDlgItem (hDlg, IDC_CREATELOGFILE), FALSE); + EnableWindow (GetDlgItem (hDlg, IDC_ILLEGAL), FALSE); + EnableWindow (GetDlgItem (hDlg, IDC_NOSPEED), TRUE); + EnableWindow (GetDlgItem (hDlg, IDC_NOSPEEDPAUSE), TRUE); + EnableWindow (GetDlgItem (hDlg, IDC_NOSOUND), TRUE); EnableWindow (GetDlgItem (hDlg, IDC_NOOVERLAY), FALSE); - EnableWindow (GetDlgItem (hDlg, IDC_DOSAVESTATE), TRUE); - EnableWindow (GetDlgItem (hDlg, IDC_ASPI), FALSE); - EnableWindow (GetDlgItem (hDlg, IDC_SCSIDEVICE), FALSE); - EnableWindow (GetDlgItem (hDlg, IDC_CLOCKSYNC), FALSE); - EnableWindow (GetDlgItem (hDlg, IDC_CATWEASEL), FALSE); - EnableWindow (GetDlgItem (hDlg, IDC_STATE_CAPTURE), FALSE); - EnableWindow (GetDlgItem (hDlg, IDC_STATE_RATE), FALSE); - EnableWindow (GetDlgItem (hDlg, IDC_STATE_BUFFERSIZE), FALSE); + EnableWindow (GetDlgItem (hDlg, IDC_DOSAVESTATE), TRUE); + EnableWindow (GetDlgItem (hDlg, IDC_ASPI), FALSE); + EnableWindow (GetDlgItem (hDlg, IDC_SCSIDEVICE), FALSE); + EnableWindow (GetDlgItem (hDlg, IDC_CLOCKSYNC), FALSE); + EnableWindow (GetDlgItem (hDlg, IDC_CATWEASEL), FALSE); + EnableWindow (GetDlgItem (hDlg, IDC_STATE_CAPTURE), FALSE); + EnableWindow (GetDlgItem (hDlg, IDC_STATE_RATE), FALSE); + EnableWindow (GetDlgItem (hDlg, IDC_STATE_BUFFERSIZE), FALSE); } else { #if !defined (BSDSOCKET) - EnableWindow (GetDlgItem(hDlg, IDC_SOCKETS), FALSE); + EnableWindow (GetDlgItem(hDlg, IDC_SOCKETS), FALSE); #endif #if !defined (SCSIEMU) - EnableWindow (GetDlgItem(hDlg, IDC_SCSIDEVICE), FALSE); - EnableWindow (GetDlgItem(hDlg, IDC_ASPI), FALSE); + EnableWindow (GetDlgItem(hDlg, IDC_SCSIDEVICE), FALSE); + EnableWindow (GetDlgItem(hDlg, IDC_ASPI), FALSE); #endif - if (workprefs.win32_logfile) + if (workprefs.win32_logfile) EnableWindow (GetDlgItem (hDlg, IDC_ILLEGAL), TRUE); - else + else EnableWindow (GetDlgItem (hDlg, IDC_ILLEGAL), FALSE); - EnableWindow (GetDlgItem (hDlg, IDC_DOSAVESTATE), FALSE); + EnableWindow (GetDlgItem (hDlg, IDC_DOSAVESTATE), FALSE); EnableWindow (GetDlgItem (hDlg, IDC_STATE_RATE), workprefs.statecapture ? TRUE : FALSE); EnableWindow (GetDlgItem (hDlg, IDC_STATE_BUFFERSIZE), workprefs.statecapture ? TRUE : FALSE); } @@ -4371,7 +4374,7 @@ static INT_PTR MiscDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { case IDC_DOSAVESTATE: if (DiskSelection(hDlg, wParam, 9, &workprefs, 0)) - save_state (savestate_fname, "Description!"); + save_state (savestate_fname, "Description!"); break; case IDC_DOLOADSTATE: if (DiskSelection(hDlg, wParam, 10, &workprefs, 0)) @@ -4672,7 +4675,7 @@ static void values_from_cpudlg (HWND hDlg) if (pages[DISPLAY_ID]) SendMessage(pages[DISPLAY_ID], WM_USER, 0, 0 ); if (pages[MEMORY_ID]) - SendMessage(pages[MEMORY_ID], WM_USER, 0, 0 ); + SendMessage(pages[MEMORY_ID], WM_USER, 0, 0 ); } static INT_PTR CALLBACK CPUDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) @@ -4881,7 +4884,7 @@ static void values_to_sounddlg (HWND hDlg) SendDlgItemMessage(hDlg, IDC_SOUNDSTEREOSEP, CB_RESETCONTENT, 0, 0); for (i = 10; i >= 0; i--) { sprintf (txt, "%d%%", i * 10); - SendDlgItemMessage(hDlg, IDC_SOUNDSTEREOSEP, CB_ADDSTRING, 0, (LPARAM)txt); + SendDlgItemMessage(hDlg, IDC_SOUNDSTEREOSEP, CB_ADDSTRING, 0, (LPARAM)txt); } SendDlgItemMessage (hDlg, IDC_SOUNDSTEREOSEP, CB_SETCURSEL, 10 - workprefs.sound_stereo_separation, 0); @@ -4889,7 +4892,7 @@ static void values_to_sounddlg (HWND hDlg) SendDlgItemMessage(hDlg, IDC_SOUNDSTEREOMIX, CB_ADDSTRING, 0, (LPARAM)"-"); for (i = 0; i < 10; i++) { sprintf (txt, "%d", i + 1); - SendDlgItemMessage(hDlg, IDC_SOUNDSTEREOMIX, CB_ADDSTRING, 0, (LPARAM)txt); + SendDlgItemMessage(hDlg, IDC_SOUNDSTEREOMIX, CB_ADDSTRING, 0, (LPARAM)txt); } SendDlgItemMessage (hDlg, IDC_SOUNDSTEREOMIX, CB_SETCURSEL, workprefs.sound_mixed_stereo > 0 ? workprefs.sound_mixed_stereo : 0, 0); @@ -4998,7 +5001,7 @@ static void values_from_sounddlg (HWND hDlg) workprefs.sound_stereo_separation = 0; workprefs.sound_mixed_stereo = 0; if (workprefs.sound_stereo > 0) { - idx = SendDlgItemMessage (hDlg, IDC_SOUNDSTEREOSEP, CB_GETCURSEL, 0, 0); + idx = SendDlgItemMessage (hDlg, IDC_SOUNDSTEREOSEP, CB_GETCURSEL, 0, 0); if (idx >= 0) { if (idx > 0) workprefs.sound_mixed_stereo = -1; @@ -5161,7 +5164,7 @@ static INT_PTR CALLBACK VolumeSettingsProc (HWND hDlg, UINT msg, WPARAM wParam, SetDlgItemText (hDlg, IDC_VOLUME_NAME, current_fsvdlg.volume); SetDlgItemText (hDlg, IDC_VOLUME_DEVICE, current_fsvdlg.device); SetDlgItemText (hDlg, IDC_PATH_NAME, current_fsvdlg.rootdir); - SetDlgItemInt (hDlg, IDC_VOLUME_BOOTPRI, current_fsvdlg.bootpri, TRUE); + SetDlgItemInt (hDlg, IDC_VOLUME_BOOTPRI, current_fsvdlg.bootpri, TRUE); CheckDlgButton (hDlg, IDC_RW, current_fsvdlg.rw); recursive--; return TRUE; @@ -5252,9 +5255,9 @@ static void inithardfile (HWND hDlg) static void sethfdostype (HWND hDlg, int idx) { if (idx == 1) - SetDlgItemText (hDlg, IDC_HF_DOSTYPE, "0x53465300"); + SetDlgItemText (hDlg, IDC_HF_DOSTYPE, "0x53465300"); else - SetDlgItemText (hDlg, IDC_HF_DOSTYPE, ""); + SetDlgItemText (hDlg, IDC_HF_DOSTYPE, ""); } static void hardfile_testrdb (HWND hDlg) @@ -5295,14 +5298,14 @@ static INT_PTR CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam break; recursive++; - switch (LOWORD (wParam)) { + switch (LOWORD (wParam)) { case IDC_HF_SIZE: - EnableWindow (GetDlgItem (hDlg, IDC_HF_CREATE), CalculateHardfileSize (hDlg) > 0); + EnableWindow (GetDlgItem (hDlg, IDC_HF_CREATE), CalculateHardfileSize (hDlg) > 0); break; case IDC_HF_TYPE: res = SendDlgItemMessage (hDlg, IDC_HF_TYPE, CB_GETCURSEL, 0, 0); - sethfdostype (hDlg, (int)res); - EnableWindow (GetDlgItem (hDlg, IDC_HF_DOSTYPE), res >= 2); + sethfdostype (hDlg, (int)res); + EnableWindow (GetDlgItem (hDlg, IDC_HF_DOSTYPE), res >= 2); break; case IDC_HF_CREATE: { @@ -5348,7 +5351,7 @@ static INT_PTR CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam EndDialog (hDlg, 0); break; case IDC_RW: - current_hfdlg.rw = IsDlgButtonChecked (hDlg, IDC_RW); + current_hfdlg.rw = IsDlgButtonChecked (hDlg, IDC_RW); break; case IDC_HDF_RDB: SetDlgItemInt (hDlg, IDC_SECTORS, 0, FALSE); @@ -5390,7 +5393,7 @@ static INT_PTR CALLBACK HarddriveSettingsProc (HWND hDlg, UINT msg, WPARAM wPara SendDlgItemMessage(hDlg, IDC_HARDDRIVE, CB_RESETCONTENT, 0, 0); index = -1; for (i = 0; i < hdf_getnumharddrives(); i++) { - SendDlgItemMessage( hDlg, IDC_HARDDRIVE, CB_ADDSTRING, 0, (LPARAM)hdf_getnameharddrive(i, 1)); + SendDlgItemMessage( hDlg, IDC_HARDDRIVE, CB_ADDSTRING, 0, (LPARAM)hdf_getnameharddrive(i, 1)); if (!strcmp (current_hfdlg.filename, hdf_getnameharddrive (i, 0))) index = i; } if (index >= 0) @@ -5414,7 +5417,7 @@ static INT_PTR CALLBACK HarddriveSettingsProc (HWND hDlg, UINT msg, WPARAM wPara } } - posn = SendDlgItemMessage (hDlg, IDC_HARDDRIVE, CB_GETCURSEL, 0, 0); + posn = SendDlgItemMessage (hDlg, IDC_HARDDRIVE, CB_GETCURSEL, 0, 0); if (posn != CB_ERR) strcpy (current_hfdlg.filename, hdf_getnameharddrive ((int)posn, 0)); current_hfdlg.rw = IsDlgButtonChecked (hDlg, IDC_RW); @@ -5516,7 +5519,7 @@ static void harddisk_edit (HWND hDlg) current_hfdlg.rw = !readonly; current_hfdlg.bootpri = bootpri; if (DialogBox( hUIDLL ? hUIDLL : hInst, MAKEINTRESOURCE (IDD_HARDFILE), hDlg, HardfileSettingsProc)) - { + { const char *result; result = set_filesys_unit (currprefs.mountinfo, entry, current_hfdlg.devicename, 0, current_hfdlg.filename, ! current_hfdlg.rw, current_hfdlg.sectors, current_hfdlg.surfaces, @@ -5532,7 +5535,7 @@ static void harddisk_edit (HWND hDlg) strncpy (current_hfdlg.filename, rootdir, (sizeof current_hfdlg.filename) - 1); current_hfdlg.filename[(sizeof current_hfdlg.filename) - 1] = '\0'; if (DialogBox( hUIDLL ? hUIDLL : hInst, MAKEINTRESOURCE (IDD_HARDDRIVE), hDlg, HarddriveSettingsProc)) - { + { const char *result; result = set_filesys_unit (currprefs.mountinfo, entry, 0, 0, current_hfdlg.filename, ! current_hfdlg.rw, 0, 0, @@ -5619,16 +5622,16 @@ static void harddiskdlg_button (HWND hDlg, int button) break; case IDC_MAPDRIVES: - workprefs.win32_automount_drives = IsDlgButtonChecked(hDlg, button); - break; + workprefs.win32_automount_drives = IsDlgButtonChecked(hDlg, button); + break; case IDC_NOUAEFSDB: - workprefs.filesys_no_uaefsdb = IsDlgButtonChecked(hDlg, IDC_NOUAEFSDB); - break; + workprefs.filesys_no_uaefsdb = IsDlgButtonChecked(hDlg, IDC_NOUAEFSDB); + break; case IDC_NORECYCLEBIN: - workprefs.win32_norecyclebin = IsDlgButtonChecked(hDlg, IDC_NORECYCLEBIN); - break; + workprefs.win32_norecyclebin = IsDlgButtonChecked(hDlg, IDC_NORECYCLEBIN); + break; } } @@ -5684,11 +5687,11 @@ static INT_PTR CALLBACK HarddiskDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPA EnableWindow (GetDlgItem(hDlg, IDC_NEW_HD), os_winnt && os_winnt_admin ? TRUE : FALSE); case WM_USER: - CheckDlgButton (hDlg, IDC_MAPDRIVES, workprefs.win32_automount_drives); - CheckDlgButton (hDlg, IDC_NOUAEFSDB, workprefs.filesys_no_uaefsdb); - CheckDlgButton (hDlg, IDC_NORECYCLEBIN, workprefs.win32_norecyclebin); - InitializeListView (hDlg); - hilitehd (); + CheckDlgButton (hDlg, IDC_MAPDRIVES, workprefs.win32_automount_drives); + CheckDlgButton (hDlg, IDC_NOUAEFSDB, workprefs.filesys_no_uaefsdb); + CheckDlgButton (hDlg, IDC_NORECYCLEBIN, workprefs.win32_norecyclebin); + InitializeListView (hDlg); + hilitehd (); break; case WM_MOUSEMOVE: @@ -5700,9 +5703,9 @@ static INT_PTR CALLBACK HarddiskDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPA int *draggeditems, item; if ((item = drag_end (hDlg, cachedlist, lParam, &draggeditems)) >= 0) { move_filesys_unit (currprefs.mountinfo, draggeditems[0], item); - InitializeListView (hDlg); - clicked_entry = item; - hilitehd (); + InitializeListView (hDlg); + clicked_entry = item; + hilitehd (); } xfree (draggeditems); break; @@ -5759,16 +5762,16 @@ HKEY read_disk_history (void) idx = 0; for (;;) { - int err; - size = sizeof (tmp); - size2 = sizeof (tmp2); - err = RegEnumValue (fkey, idx, tmp, &size, NULL, NULL, tmp2, &size2); - if (err != ERROR_SUCCESS) + int err; + size = sizeof (tmp); + size2 = sizeof (tmp2); + err = RegEnumValue (fkey, idx, tmp, &size, NULL, NULL, tmp2, &size2); + if (err != ERROR_SUCCESS) break; - if (strlen (tmp) == 7) { + if (strlen (tmp) == 7) { idx2 = atol (tmp + 5) - 1; if (idx2 >= 0) - DISK_history_add (tmp2, idx2); + DISK_history_add (tmp2, idx2); } idx++; } @@ -5787,7 +5790,7 @@ static void out_floppyspeed (HWND hDlg) if (workprefs.floppy_speed) sprintf (txt, "%d%%%s", workprefs.floppy_speed, workprefs.floppy_speed == 100 ? tmp1 : ""); else - strcpy (txt, tmp2); + strcpy (txt, tmp2); SetDlgItemText (hDlg, IDC_FLOPPYSPDTEXT, txt); } @@ -5814,7 +5817,7 @@ static void floppytooltip (HWND hDlg, int num, uae_u32 crc32) if (currentpage == QUICKSTART_ID) id = floppybuttonsq[num][0]; else - id = floppybuttons[num][0]; + id = floppybuttons[num][0]; ti.cbSize = sizeof(TOOLINFO); ti.uFlags = TTF_SUBCLASS | TTF_IDISHWND; ti.hwnd = hDlg; @@ -6011,11 +6014,11 @@ static INT_PTR CALLBACK FloppyDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARA currentpage = FLOPPY_ID; SendDlgItemMessage (hDlg, IDC_FLOPPYSPD, TBM_SETRANGE, TRUE, MAKELONG (0, 4)); SendDlgItemMessage (hDlg, IDC_FLOPPYSPD, TBM_SETPAGESIZE, 0, 1); - SendDlgItemMessage (hDlg, IDC_FLOPPYTYPE, CB_RESETCONTENT, 0, 0L); + SendDlgItemMessage (hDlg, IDC_FLOPPYTYPE, CB_RESETCONTENT, 0, 0L); SendDlgItemMessage (hDlg, IDC_FLOPPYTYPE, CB_ADDSTRING, 0, (LPARAM)ft35dd); SendDlgItemMessage (hDlg, IDC_FLOPPYTYPE, CB_ADDSTRING, 0, (LPARAM)ft35hd); SendDlgItemMessage (hDlg, IDC_FLOPPYTYPE, CB_ADDSTRING, 0, (LPARAM)ft525sd); - SendDlgItemMessage (hDlg, IDC_FLOPPYTYPE, CB_SETCURSEL, 0, 0); + SendDlgItemMessage (hDlg, IDC_FLOPPYTYPE, CB_SETCURSEL, 0, 0); for (i = 0; i < 4; i++) { int f_type = floppybuttons[i][3]; SendDlgItemMessage (hDlg, f_type, CB_RESETCONTENT, 0, 0L); @@ -6036,8 +6039,8 @@ static INT_PTR CALLBACK FloppyDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARA SendDlgItemMessage (hDlg, IDC_FLOPPYSPD, TBM_SETPOS, TRUE, workprefs.floppy_speed ? exact_log2 ((workprefs.floppy_speed) / 100) + 1 : 0); out_floppyspeed (hDlg); - addallfloppies (hDlg); - recursive--; + addallfloppies (hDlg); + recursive--; break; case WM_COMMAND: @@ -6193,7 +6196,7 @@ static ACCEL SwapperAccel[] = { static void swapperhili (HWND hDlg, int entry) { ListView_SetItemState (cachedlist, entry, - LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED); + LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED); SetDlgItemText (hDlg, IDC_DISKTEXT, workprefs.dfxlist[entry]); } @@ -6203,15 +6206,15 @@ static void addswapperfile (HWND hDlg, int entry) int lastentry = entry; if (MultiDiskSelection (hDlg, -1, 0, &changed_prefs, path)) { - char dpath[MAX_DPATH]; - loopmulti (path, NULL); - while (loopmulti(path, dpath) && entry < MAX_SPARE_DRIVES) { - strcpy (workprefs.dfxlist[entry], dpath); + char dpath[MAX_DPATH]; + loopmulti (path, NULL); + while (loopmulti(path, dpath) && entry < MAX_SPARE_DRIVES) { + strcpy (workprefs.dfxlist[entry], dpath); lastentry = entry; - entry++; - } - InitializeListView (hDlg); - swapperhili (hDlg, lastentry); + entry++; + } + InitializeListView (hDlg); + swapperhili (hDlg, lastentry); } } @@ -6229,8 +6232,8 @@ static INT_PTR CALLBACK SwapperDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPAR currentpage = DISK_ID; InitializeListView(hDlg); fkey = read_disk_history (); - addfloppyhistory (hDlg, fkey, 0, IDC_DISKTEXT); - if (fkey) + addfloppyhistory (hDlg, fkey, 0, IDC_DISKTEXT); + if (fkey) RegCloseKey (fkey); entry = 0; swapperhili (hDlg, entry); @@ -6291,13 +6294,13 @@ static INT_PTR CALLBACK SwapperDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPAR case 10101: if (entry > 0) { entry--; - swapperhili (hDlg, entry); + swapperhili (hDlg, entry); } break; case 10102: if (entry >= 0 && entry < MAX_SPARE_DRIVES - 1) { entry++; - swapperhili (hDlg, entry); + swapperhili (hDlg, entry); } break; case 10103: @@ -6380,15 +6383,15 @@ static INT_PTR CALLBACK SwapperDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPAR strcpy (workprefs.dfxlist[entry], tmp); InitializeListView (hDlg); entry++; - swapperhili (hDlg, entry); + swapperhili (hDlg, entry); } - break; + break; } break; } case WM_NOTIFY: - if (((LPNMHDR) lParam)->idFrom == IDC_DISKLIST) - { + if (((LPNMHDR) lParam)->idFrom == IDC_DISKLIST) + { int dblclick = 0, col; HWND list; NM_LISTVIEW *nmlistview; @@ -6408,12 +6411,12 @@ static INT_PTR CALLBACK SwapperDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPAR if (col == 2) { if (disk_swap (entry, 0)) InitializeListView (hDlg); - swapperhili (hDlg, entry); + swapperhili (hDlg, entry); } else if (col == 1) { if (dblclick) addswapperfile (hDlg, entry); } - SetDlgItemText (hDlg, IDC_DISKTEXT, workprefs.dfxlist[entry]); + SetDlgItemText (hDlg, IDC_DISKTEXT, workprefs.dfxlist[entry]); } break; } @@ -6496,9 +6499,9 @@ static void updatejoyport (HWND hDlg) p1 = p2; } else break; } - for (j = 0; j < inputdevice_get_device_total (IDTYPE_JOYSTICK); j++, total++) + for (j = 0; j < inputdevice_get_device_total (IDTYPE_JOYSTICK); j++, total++) SendDlgItemMessage (hDlg, id, CB_ADDSTRING, 0, (LPARAM)inputdevice_get_device_name(IDTYPE_JOYSTICK, j)); - for (j = 0; j < inputdevice_get_device_total (IDTYPE_MOUSE); j++, total++) + for (j = 0; j < inputdevice_get_device_total (IDTYPE_MOUSE); j++, total++) SendDlgItemMessage (hDlg, id, CB_ADDSTRING, 0, (LPARAM)inputdevice_get_device_name(IDTYPE_MOUSE, j)); if (v >= JSEM_MICE) { idx = v - JSEM_MICE; @@ -6563,13 +6566,13 @@ static void values_from_portsdlg (HWND hDlg) int *port = i == 0 ? &workprefs.jport0 : &workprefs.jport1; int prevport = *port; int id = i == 0 ? IDC_PORT0_JOYS : IDC_PORT1_JOYS; - LRESULT v = SendDlgItemMessage (hDlg, id, CB_GETCURSEL, 0, 0L); + LRESULT v = SendDlgItemMessage (hDlg, id, CB_GETCURSEL, 0, 0L); if (v != CB_ERR && v > 0) { v--; if (v < JSEM_LASTKBD) *port = JSEM_KBDLAYOUT + (int)v; else if (v >= JSEM_LASTKBD + inputdevice_get_device_total (IDTYPE_JOYSTICK)) - *port = JSEM_MICE + (int)v - inputdevice_get_device_total (IDTYPE_JOYSTICK) - JSEM_LASTKBD; + *port = JSEM_MICE + (int)v - inputdevice_get_device_total (IDTYPE_JOYSTICK) - JSEM_LASTKBD; else *port = JSEM_JOYS + (int)v - JSEM_LASTKBD; } @@ -6651,13 +6654,13 @@ static void values_from_portsdlg (HWND hDlg) } workprefs.serial_demand = 0; if (IsDlgButtonChecked (hDlg, IDC_SHARED)) - workprefs.serial_demand = 1; + workprefs.serial_demand = 1; workprefs.serial_hwctsrts = 0; if (IsDlgButtonChecked (hDlg, IDC_SER_CTSRTS)) - workprefs.serial_hwctsrts = 1; + workprefs.serial_hwctsrts = 1; workprefs.serial_direct = 0; if (IsDlgButtonChecked (hDlg, IDC_SERIAL_DIRECT)) - workprefs.serial_direct = 1; + workprefs.serial_direct = 1; GetDlgItemText (hDlg, IDC_PS_PARAMS, workprefs.ghostscript_parameters, sizeof workprefs.ghostscript_parameters); v = GetDlgItemInt (hDlg, IDC_PRINTERAUTOFLUSH, &success, FALSE); if (success) @@ -6678,7 +6681,7 @@ static void values_to_portsdlg (HWND hDlg) sprintf (tmp, "LPT%d", i + 1); if (!strcmp (tmp, workprefs.prtname)) { got = 0; - if (paraport_mask & (1 << i)) + if (paraport_mask & (1 << i)) got = 1; break; } @@ -6716,7 +6719,7 @@ static void values_to_portsdlg (HWND hDlg) if( strcasecmp( workprefs.sername, "none") == 0 ) { SendDlgItemMessage (hDlg, IDC_SERIAL, CB_SETCURSEL, 0, 0L); - workprefs.use_serial = 0; + workprefs.use_serial = 0; } else { @@ -6725,7 +6728,7 @@ static void values_to_portsdlg (HWND hDlg) LRESULT result = -1; for (i = 0; i < MAX_SERIALS; i++) { if (!strcmp (comports[i], workprefs.sername)) { - result = SendDlgItemMessage(hDlg, IDC_SERIAL, CB_SETCURSEL, i + 1, 0L); + result = SendDlgItemMessage(hDlg, IDC_SERIAL, CB_SETCURSEL, i + 1, 0L); break; } } @@ -6777,10 +6780,10 @@ static void init_portsdlg( HWND hDlg ) portcnt = 0; for( port = 0; port < MAX_SERIALS; port++ ) { - sprintf( comports[portcnt], "COM%d", port ); - if( GetDefaultCommConfig( comports[portcnt], &cc, &size ) ) - { - SendDlgItemMessage( hDlg, IDC_SERIAL, CB_ADDSTRING, 0, (LPARAM)comports[portcnt++] ); + sprintf( comports[portcnt], "COM%d", port ); + if( GetDefaultCommConfig( comports[portcnt], &cc, &size ) ) + { + SendDlgItemMessage( hDlg, IDC_SERIAL, CB_ADDSTRING, 0, (LPARAM)comports[portcnt++] ); } } @@ -6802,7 +6805,7 @@ static void init_portsdlg( HWND hDlg ) } } if (pInfo) { - for( port = 0; port < (int)dwEnumeratedPrinters; port++ ) + for( port = 0; port < (int)dwEnumeratedPrinters; port++ ) SendDlgItemMessage( hDlg, IDC_PRINTERLIST, CB_ADDSTRING, 0, (LPARAM)pInfo[port].pName ); } else { EnableWindow( GetDlgItem( hDlg, IDC_PRINTERLIST ), FALSE ); @@ -6831,15 +6834,15 @@ static void init_portsdlg( HWND hDlg ) { char szMidiOut[ MAX_DPATH ]; WIN32GUI_LoadUIString( IDS_DEFAULTMIDIOUT, szMidiOut, MAX_DPATH ); - SendDlgItemMessage( hDlg, IDC_MIDIOUTLIST, CB_ADDSTRING, 0, (LPARAM)szMidiOut ); - - for( port = 0; port < numdevs; port++ ) - { - if( midiOutGetDevCaps( port, &midiOutCaps, sizeof( midiOutCaps ) ) == MMSYSERR_NOERROR ) - { - SendDlgItemMessage( hDlg, IDC_MIDIOUTLIST, CB_ADDSTRING, 0, (LPARAM)midiOutCaps.szPname ); - } - } + SendDlgItemMessage( hDlg, IDC_MIDIOUTLIST, CB_ADDSTRING, 0, (LPARAM)szMidiOut ); + + for( port = 0; port < numdevs; port++ ) + { + if( midiOutGetDevCaps( port, &midiOutCaps, sizeof( midiOutCaps ) ) == MMSYSERR_NOERROR ) + { + SendDlgItemMessage( hDlg, IDC_MIDIOUTLIST, CB_ADDSTRING, 0, (LPARAM)midiOutCaps.szPname ); + } + } EnableWindow( GetDlgItem( hDlg, IDC_MIDIOUTLIST ), TRUE ); } @@ -6851,13 +6854,13 @@ static void init_portsdlg( HWND hDlg ) } else { - for( port = 0; port < numdevs; port++ ) - { - if( midiInGetDevCaps( port, &midiInCaps, sizeof( midiInCaps ) ) == MMSYSERR_NOERROR ) - { - SendDlgItemMessage( hDlg, IDC_MIDIINLIST, CB_ADDSTRING, 0, (LPARAM)midiInCaps.szPname ); - } - } + for( port = 0; port < numdevs; port++ ) + { + if( midiInGetDevCaps( port, &midiInCaps, sizeof( midiInCaps ) ) == MMSYSERR_NOERROR ) + { + SendDlgItemMessage( hDlg, IDC_MIDIINLIST, CB_ADDSTRING, 0, (LPARAM)midiInCaps.szPname ); + } + } } } @@ -6887,7 +6890,7 @@ static INT_PTR CALLBACK PortsDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM return TRUE; case WM_COMMAND: - if (recursive > 0) + if (recursive > 0) break; recursive++; if (wParam == IDC_SWAP) { @@ -6914,9 +6917,9 @@ static INT_PTR CALLBACK PortsDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM values_from_portsdlg (hDlg); updatejoyport (hDlg); } - inputdevice_updateconfig (&workprefs); + inputdevice_updateconfig (&workprefs); inputdevice_config_change (); - recursive--; + recursive--; break; } return FALSE; @@ -7069,7 +7072,7 @@ static void values_from_inputdlg (HWND hDlg) if (item != CB_ERR && input_selected_sub_num != item) { input_selected_sub_num = (int)item; doselect = 0; - init_inputdlg_2 (hDlg); + init_inputdlg_2 (hDlg); update_listview_input (hDlg); return; } @@ -7111,7 +7114,7 @@ static void values_from_inputdlg (HWND hDlg) eventnames[input_selected_event], NULL, (flags & IDEV_MAPPED_AUTOFIRE_SET) ? 1 : 0, input_selected_sub_num); update_listview_input (hDlg); - inputdevice_updateconfig (&workprefs); + inputdevice_updateconfig (&workprefs); } } @@ -7174,7 +7177,7 @@ static INT_PTR CALLBACK InputDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM recursive--; return TRUE; case WM_COMMAND: - if (recursive) + if (recursive) break; recursive++; switch (wParam) @@ -7197,8 +7200,8 @@ static INT_PTR CALLBACK InputDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM recursive--; break; case WM_NOTIFY: - if (((LPNMHDR) lParam)->idFrom == IDC_INPUTLIST) - { + if (((LPNMHDR) lParam)->idFrom == IDC_INPUTLIST) + { int row; nmlistview = (NM_LISTVIEW *) lParam; list = nmlistview->hdr.hwndFrom; @@ -7224,7 +7227,7 @@ static INT_PTR CALLBACK InputDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM input_selected_widget = -1; } update_listview_input (hDlg); - init_inputdlg_2 (hDlg); + init_inputdlg_2 (hDlg); } } } @@ -7329,7 +7332,7 @@ static void values_to_hw3ddlg (HWND hDlg) break; } if (nofilter == 0) { - SendDlgItemMessage (hDlg, IDC_FILTERMODE, CB_ADDSTRING, 0, (LPARAM)uaefilters[i].name); + SendDlgItemMessage (hDlg, IDC_FILTERMODE, CB_ADDSTRING, 0, (LPARAM)uaefilters[i].name); if (uaefilters[i].type == workprefs.gfx_filter) { uf = &uaefilters[i]; fltnum = j; @@ -7344,13 +7347,13 @@ static void values_to_hw3ddlg (HWND hDlg) if (uf->x[0]) { WIN32GUI_LoadUIString (IDS_3D_NO_FILTER, txt, sizeof (txt)); sprintf (tmp, txt, 16); - SendDlgItemMessage (hDlg, IDC_FILTERFILTER, CB_ADDSTRING, 0, (LPARAM)tmp); + SendDlgItemMessage (hDlg, IDC_FILTERFILTER, CB_ADDSTRING, 0, (LPARAM)tmp); WIN32GUI_LoadUIString (IDS_3D_BILINEAR, txt, sizeof (txt)); sprintf (tmp, txt, 16); SendDlgItemMessage (hDlg, IDC_FILTERFILTER, CB_ADDSTRING, 0, (LPARAM)tmp); WIN32GUI_LoadUIString (IDS_3D_NO_FILTER, txt, sizeof (txt)); sprintf (tmp, txt, 32); - SendDlgItemMessage (hDlg, IDC_FILTERFILTER, CB_ADDSTRING, 0, (LPARAM)tmp); + SendDlgItemMessage (hDlg, IDC_FILTERFILTER, CB_ADDSTRING, 0, (LPARAM)tmp); WIN32GUI_LoadUIString (IDS_3D_BILINEAR, txt, sizeof (txt)); sprintf (tmp, txt, 32); SendDlgItemMessage (hDlg, IDC_FILTERFILTER, CB_ADDSTRING, 0, (LPARAM)tmp); @@ -7376,7 +7379,7 @@ static void values_to_hw3ddlg (HWND hDlg) sprintf (txt, "%d:%d", scanlineratios[i * 2], scanlineratios[i * 2 + 1]); if (workprefs.gfx_filter_scanlineratio == sl) j = i; - SendDlgItemMessage (hDlg, IDC_FILTERSLR, CB_ADDSTRING, 0, (LPARAM)txt); + SendDlgItemMessage (hDlg, IDC_FILTERSLR, CB_ADDSTRING, 0, (LPARAM)txt); scanlineindexes[i] = sl; i++; } @@ -7440,23 +7443,23 @@ static void filter_preset (HWND hDlg, WPARAM wParam) if (!hWinUAEKey) return; RegCreateKeyEx(hWinUAEKey , "FilterPresets", 0, NULL, REG_OPTION_NON_VOLATILE, - KEY_READ | KEY_WRITE, NULL, &fkey, NULL); + KEY_READ | KEY_WRITE, NULL, &fkey, NULL); if (!fkey) return; item = SendDlgItemMessage (hDlg, IDC_FILTERPRESETS, CB_GETCURSEL, 0, 0); tmp1[0] = 0; if (item != CB_ERR) { filterpreset = (int)item; - SendDlgItemMessage (hDlg, IDC_FILTERPRESETS, CB_GETLBTEXT, (WPARAM)item, (LPARAM)tmp1); + SendDlgItemMessage (hDlg, IDC_FILTERPRESETS, CB_GETLBTEXT, (WPARAM)item, (LPARAM)tmp1); } else { - SendDlgItemMessage (hDlg, IDC_FILTERPRESETS, WM_GETTEXT, (WPARAM)item, (LPARAM)tmp1); + SendDlgItemMessage (hDlg, IDC_FILTERPRESETS, WM_GETTEXT, (WPARAM)item, (LPARAM)tmp1); } outsize = sizeof (tmp2); if (tmp1[0] && RegQueryValueEx (fkey, tmp1, NULL, NULL, tmp2, &outsize) == ERROR_SUCCESS) ok = 1; if (wParam == IDC_FILTERPRESETSAVE) { - sprintf (tmp2, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", + sprintf (tmp2, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", p->gfx_filter, p->gfx_filter_filtermode, p->gfx_filter_vert_zoom, p->gfx_filter_horiz_zoom, p->gfx_filter_vert_offset, p->gfx_filter_horiz_offset, @@ -7467,10 +7470,10 @@ static void filter_preset (HWND hDlg, WPARAM wParam) tmp1[0] = 0; SendDlgItemMessage (hDlg, IDC_FILTERPRESETS, WM_GETTEXT, (WPARAM)sizeof (tmp1), (LPARAM)tmp1); if (tmp1[0] == 0) - goto end; + goto end; } RegSetValueEx (fkey, tmp1, 0, REG_SZ, (CONST BYTE *)&tmp2, strlen (tmp2) + 1); - values_to_hw3ddlg (hDlg); + values_to_hw3ddlg (hDlg); } if (ok) { if (wParam == IDC_FILTERPRESETDELETE) { @@ -7516,8 +7519,8 @@ static void filter_preset (HWND hDlg, WPARAM wParam) end: RegCloseKey (fkey); if (load) { - values_to_hw3ddlg (hDlg); - SendMessage (hDlg, WM_HSCROLL, 0, 0); + values_to_hw3ddlg (hDlg); + SendMessage (hDlg, WM_HSCROLL, 0, 0); } enable_for_hw3ddlg (hDlg); } @@ -7596,7 +7599,7 @@ static INT_PTR CALLBACK hw3dDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM l item = SendDlgItemMessage (hDlg, IDC_FILTERSLR, CB_GETCURSEL, 0, 0L); if (item != CB_ERR) { currprefs.gfx_filter_scanlineratio = workprefs.gfx_filter_scanlineratio = scanlineindexes[item]; - updatedisplayarea (); + updatedisplayarea (); } break; case IDC_FILTERMODE: @@ -7619,8 +7622,8 @@ static INT_PTR CALLBACK hw3dDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM l SetDlgItemInt (hDlg, IDC_FILTERHZV, workprefs.gfx_filter_horiz_zoom, TRUE); SetDlgItemInt (hDlg, IDC_FILTERVZV, workprefs.gfx_filter_vert_zoom, TRUE); SetDlgItemInt (hDlg, IDC_FILTERHOV, workprefs.gfx_filter_horiz_offset, TRUE); - SetDlgItemInt (hDlg, IDC_FILTERVOV, workprefs.gfx_filter_vert_offset, TRUE); - SetDlgItemInt (hDlg, IDC_FILTERSLV, workprefs.gfx_filter_scanlines, TRUE); + SetDlgItemInt (hDlg, IDC_FILTERVOV, workprefs.gfx_filter_vert_offset, TRUE); + SetDlgItemInt (hDlg, IDC_FILTERSLV, workprefs.gfx_filter_scanlines, TRUE); SetDlgItemInt (hDlg, IDC_FILTERSL2V, workprefs.gfx_filter_scanlinelevel, TRUE); updatedisplayarea (); WIN32GFX_WindowMove (); @@ -7635,7 +7638,7 @@ static void values_to_avioutputdlg(HWND hDlg) { char tmpstr[256]; - updatewinfsmode (&workprefs); + updatewinfsmode (&workprefs); SetDlgItemText(hDlg, IDC_AVIOUTPUT_FILETEXT, avioutput_filename); sprintf(tmpstr, "%d fps", avioutput_fps); @@ -7660,16 +7663,16 @@ static void values_to_avioutputdlg(HWND hDlg) break; } - CheckDlgButton (hDlg, IDC_AVIOUTPUT_FRAMELIMITER, avioutput_framelimiter ? FALSE : TRUE); - CheckDlgButton (hDlg, IDC_AVIOUTPUT_ACTIVATED, avioutput_requested ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton (hDlg, IDC_SAMPLERIPPER_ACTIVATED, sampleripper_enabled ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton (hDlg, IDC_AVIOUTPUT_FRAMELIMITER, avioutput_framelimiter ? FALSE : TRUE); + CheckDlgButton (hDlg, IDC_AVIOUTPUT_ACTIVATED, avioutput_requested ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton (hDlg, IDC_SAMPLERIPPER_ACTIVATED, sampleripper_enabled ? BST_CHECKED : BST_UNCHECKED); } static void values_from_avioutputdlg(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { LRESULT tmp; - updatewinfsmode (&workprefs); + updatewinfsmode (&workprefs); tmp = SendMessage(GetDlgItem(hDlg, IDC_AVIOUTPUT_FPS), TBM_GETPOS, 0, 0); if (tmp < 1) tmp = 1; @@ -7696,7 +7699,7 @@ static void enable_for_avioutputdlg(HWND hDlg) EnableWindow(GetDlgItem(hDlg, IDC_AVIOUTPUT_NTSC), TRUE); EnableWindow(GetDlgItem(hDlg, IDC_AVIOUTPUT_FPS), TRUE); EnableWindow(GetDlgItem(hDlg, IDC_AVIOUTPUT_FILE), TRUE); - CheckDlgButton (hDlg, IDC_AVIOUTPUT_FRAMELIMITER, avioutput_framelimiter ? FALSE : TRUE); + CheckDlgButton (hDlg, IDC_AVIOUTPUT_FRAMELIMITER, avioutput_framelimiter ? FALSE : TRUE); if(workprefs.produce_sound < 2) { @@ -7948,7 +7951,7 @@ static LRESULT FAR PASCAL ToolTipWndProc (HWND hwnd, UINT message, WPARAM wParam break; } if (!ToolTipHWNDS2[i].hwnd) - return CallWindowProc (ToolTipHWNDS2[i].proc, hwnd, message, wParam, lParam); + return CallWindowProc (ToolTipHWNDS2[i].proc, hwnd, message, wParam, lParam); switch (message) { @@ -7993,25 +7996,25 @@ static BOOL CALLBACK childenumproc (HWND hwnd, LPARAM lParam) p = strchr (tmp, '['); if (strlen (tmp) > 0 && p && strlen(p) > 2 && p[1] == ']') { int imageid = 0; - *p++ = 0; - *p++ = 0; - if (p[0] == ' ') + *p++ = 0; + *p++ = 0; + if (p[0] == ' ') *p++; if (p[0] == '#') imageid = atol (p + 1); - tmp[strlen(tmp) - 1] = 0; - ti.cbSize = sizeof (TOOLINFO); - ti.uFlags = TTF_SUBCLASS | TTF_IDISHWND; - ti.hwnd = GetParent (hwnd); - ti.hinst = hInst; - ti.uId = (UINT)hwnd; - ti.lpszText = p; + tmp[strlen(tmp) - 1] = 0; + ti.cbSize = sizeof (TOOLINFO); + ti.uFlags = TTF_SUBCLASS | TTF_IDISHWND; + ti.hwnd = GetParent (hwnd); + ti.hinst = hInst; + ti.uId = (UINT)hwnd; + ti.lpszText = p; if (imageid > 0) { int idx, i; idx = 0; while (ToolTipHWNDS2[idx].hwnd) - idx++; + idx++; for (i = 0; ToolTipImageIDs[i] >= 0; i += 2) { if (ToolTipImageIDs[i] == imageid) break; @@ -8031,37 +8034,37 @@ static BOOL CALLBACK childenumproc (HWND hwnd, LPARAM lParam) SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); SendMessage(ToolTipHWND2, TTM_SETDELAYTIME, (WPARAM)TTDT_AUTOPOP, (LPARAM)MAKELONG(20000, 0)); SendMessage(ToolTipHWND2, TTM_SETMAXTIPWIDTH, 0, 400); - SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM)tmp); + SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM)tmp); v = SendMessage(ToolTipHWND2, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti); } } else { v = SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM)tmp); v = SendMessage(ToolTipHWND, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti); } - return 1; + return 1; } p = strchr (tmp, ']'); if (strlen (tmp) > 0 && p && strlen(p) > 2 && p[1] == '[') { RECT r; - *p++ = 0; - *p++ = 0; - if (p[0] == ' ') + *p++ = 0; + *p++ = 0; + if (p[0] == ' ') *p++; - tmp[strlen(tmp) - 1] = 0; - SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM)tmp); - ti.cbSize = sizeof (TOOLINFO); - ti.uFlags = TTF_SUBCLASS; - ti.hwnd = GetParent (hwnd); - ti.hinst = hInst; - ti.uId = (UINT_PTR)hwnd; - ti.lpszText = p; + tmp[strlen(tmp) - 1] = 0; + SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM)tmp); + ti.cbSize = sizeof (TOOLINFO); + ti.uFlags = TTF_SUBCLASS; + ti.hwnd = GetParent (hwnd); + ti.hinst = hInst; + ti.uId = (UINT_PTR)hwnd; + ti.lpszText = p; GetWindowRect (GetParent (hwnd), &r); GetWindowRect (hwnd, &ti.rect); ti.rect.top -= r.top; ti.rect.left -= r.left; ti.rect.right -= r.left; ti.rect.bottom -= r.top; - SendMessage(ToolTipHWND, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti); + SendMessage(ToolTipHWND, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti); } return 1; } @@ -8145,9 +8148,9 @@ static HWND updatePanel (HWND hDlg, int id) ToolTipHWND = CreateWindowEx (WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL, - WS_POPUP | TTS_NOPREFIX | TTS_BALLOON, - CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - panelDlg, NULL, hInst, NULL); + WS_POPUP | TTS_NOPREFIX | TTS_BALLOON, + CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, + panelDlg, NULL, hInst, NULL); SetWindowPos (ToolTipHWND, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); @@ -8219,8 +8222,8 @@ static void createTreeView (HWND hDlg, int currentpage) icon = LoadIcon (hInst, (LPCSTR)ppage[i].pp.pszIcon); ppage[i].himg = ImageList_AddIcon (himl, icon); } - icon = LoadIcon (hInst, MAKEINTRESOURCE (IDI_ROOT)); - ImageList_AddIcon (himl, icon); + icon = LoadIcon (hInst, MAKEINTRESOURCE (IDI_ROOT)); + ImageList_AddIcon (himl, icon); } TVhDlg = GetDlgItem(hDlg, IDC_PANELTREE); TreeView_SetImageList (TVhDlg, himl, TVSIL_NORMAL); @@ -8266,7 +8269,7 @@ static void centerWindow (HWND hDlg) if (owner == NULL) owner = GetDesktopWindow(); if (!isfullscreen ()) { - DWORD regkeytype; + DWORD regkeytype; DWORD regkeysize = sizeof(LONG); if (hWinUAEKey) { if (RegQueryValueEx (hWinUAEKey, "xPosGUI", 0, ®keytype, (LPBYTE)&x, ®keysize) != ERROR_SUCCESS) @@ -8298,7 +8301,7 @@ static void centerWindow (HWND hDlg) SetWindowPos (hDlg, HWND_TOP, x, y, 0, 0, SWP_NOSIZE); } -int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage) +int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage) { int cnt, i, drv, firstdrv, list; char file[MAX_DPATH]; @@ -8415,17 +8418,17 @@ static INT_PTR CALLBACK DialogProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP { case WM_DESTROY: PostQuitMessage (0); - return TRUE; + return TRUE; case WM_CLOSE: - DestroyWindow(hDlg); - if (dialogreturn < 0) { + DestroyWindow(hDlg); + if (dialogreturn < 0) { dialogreturn = 0; if (allow_quit) { quit_program = 1; regs.spcflags |= SPCFLAG_BRK; } } - return TRUE; + return TRUE; case WM_INITDIALOG: guiDlg = hDlg; SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon (GetModuleHandle (NULL), MAKEINTRESOURCE(IDI_APPICON))); @@ -8440,7 +8443,7 @@ static INT_PTR CALLBACK DialogProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP return TRUE; case WM_DROPFILES: if (dragdrop (hDlg, (HDROP)wParam, (gui_active || full_property_sheet) ? &workprefs : &changed_prefs, currentpage)) - SendMessage (hDlg, WM_COMMAND, IDOK, 0); + SendMessage (hDlg, WM_COMMAND, IDOK, 0); updatePanel (hDlg, currentpage); return FALSE; case WM_NOTIFY: @@ -8503,7 +8506,7 @@ static ACCEL EmptyAccel[] = { }; static int init_page (int tmpl, int icon, int title, - INT_PTR (CALLBACK FAR *func) (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam), ACCEL *accels, char *help) + INT_PTR (CALLBACK FAR *func) (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam), ACCEL *accels, char *help) { static id = 0; int i = -1; @@ -8611,7 +8614,7 @@ static int GetSettings (int all_options, HWND hwnd) } if (quit_program) - psresult = -2; + psresult = -2; else if (qs_request_reset && quickstart) uae_reset (qs_request_reset == 2 ? 1 : 0); @@ -8713,51 +8716,51 @@ void gui_led (int led, int on) if (!hStatusWnd) return; if (on) - type = SBT_POPOUT; + type = SBT_POPOUT; else - type = 0; + type = 0; tt = NULL; if (led >= 1 && led <= 4) { - pos = 5 + (led - 1); - ptr = drive_text + pos * 16; - if (gui_data.drive_disabled[led - 1]) + pos = 5 + (led - 1); + ptr = drive_text + pos * 16; + if (gui_data.drive_disabled[led - 1]) strcpy (ptr, ""); else sprintf (ptr , "%02d .", gui_data.drive_track[led - 1]); - p = gui_data.df[led - 1]; - j = strlen (p) - 1; + p = gui_data.df[led - 1]; + j = strlen (p) - 1; if (j < 0) j = 0; while (j > 0) { if (p[j - 1] == '\\' || p[j - 1] == '/') - break; + break; j--; } - tt = dfx[led - 1]; - tt[0] = 0; + tt = dfx[led - 1]; + tt[0] = 0; if (strlen (p + j) > 0) sprintf (tt, "%s (CRC=%08.8X)", p + j, gui_data.crc32[led - 1]); } else if (led == 0) { - pos = 2; - ptr = strcpy (drive_text + pos * 16, "Power"); + pos = 2; + ptr = strcpy (drive_text + pos * 16, "Power"); } else if (led == 5) { - pos = 3; - ptr = strcpy (drive_text + pos * 16, "HD"); + pos = 3; + ptr = strcpy (drive_text + pos * 16, "HD"); } else if (led == 6) { - pos = 4; - ptr = strcpy (drive_text + pos * 16, "CD"); + pos = 4; + ptr = strcpy (drive_text + pos * 16, "CD"); } else if (led == 7) { pos = 1; ptr = drive_text + pos * 16; sprintf(ptr, "FPS: %.1f", (double)(gui_data.fps / 10.0)); } else if (led == 8) { - pos = 0; - ptr = drive_text + pos * 16; - sprintf(ptr, "CPU: %.0f%%", (double)((gui_data.idle) / 10.0)); + pos = 0; + ptr = drive_text + pos * 16; + sprintf(ptr, "CPU: %.0f%%", (double)((gui_data.idle) / 10.0)); } if (pos >= 0) { - PostMessage (hStatusWnd, SB_SETTEXT, (WPARAM) ((pos + 1) | type), (LPARAM) ptr); - if (tt != NULL) + PostMessage (hStatusWnd, SB_SETTEXT, (WPARAM) ((pos + 1) | type), (LPARAM) ptr); + if (tt != NULL) PostMessage (hStatusWnd, SB_SETTIPTEXT, (WPARAM) (pos + 1), (LPARAM) tt); } } @@ -8788,7 +8791,7 @@ static int fsdialog (HWND *hwnd, DWORD *flags) HRESULT hr; hr = DirectDraw_FlipToGDISurface(); if (FAILED(hr)) { - write_log ("FlipToGDISurface failed, %s\n", DXError (hr)); + write_log ("FlipToGDISurface failed, %s\n", DXError (hr)); return 0; } *hwnd = NULL; @@ -8818,7 +8821,7 @@ int gui_message_multibutton (int flags, const char *format,...) pause_sound (); flipflop = fsdialog (&hwnd, &mbflags); if (flipflop) - ShowWindow (hAmigaWnd, SW_MINIMIZE); + ShowWindow (hAmigaWnd, SW_MINIMIZE); va_start (parms, format); vsprintf( msg, format, parms ); @@ -8832,7 +8835,7 @@ int gui_message_multibutton (int flags, const char *format,...) ret = MessageBox (hwnd, msg, szTitle, mbflags); if (flipflop) - ShowWindow (hAmigaWnd, SW_RESTORE); + ShowWindow (hAmigaWnd, SW_RESTORE); resume_sound (); setmouseactive (focuso); @@ -8868,7 +8871,7 @@ void gui_message (const char *format,...) pause_sound (); flipflop = fsdialog (&hwnd, &flags); if (flipflop) - ShowWindow (hAmigaWnd, SW_MINIMIZE); + ShowWindow (hAmigaWnd, SW_MINIMIZE); write_log( msg ); if (msg[strlen(msg)-1]!='\n') @@ -8879,7 +8882,7 @@ void gui_message (const char *format,...) MessageBox (hwnd, msg, szTitle, flags); if (flipflop) - ShowWindow (hAmigaWnd, SW_RESTORE); + ShowWindow (hAmigaWnd, SW_RESTORE); resume_sound(); setmouseactive (focuso); } @@ -8956,7 +8959,7 @@ void notify_user (int msg) gui_message (tmp); } -int translate_message (int msg, char *out) +int translate_message (int msg, char *out) { msg = gettranslation (msg); out[0] = 0; diff --git a/od-win32/winuae_msvc/winuae_msvc.vcproj b/od-win32/winuae_msvc/winuae_msvc.vcproj index e320ee0c..3bbfe682 100755 --- a/od-win32/winuae_msvc/winuae_msvc.vcproj +++ b/od-win32/winuae_msvc/winuae_msvc.vcproj @@ -5,6 +5,7 @@ Name="winuae" ProjectGUID="{4ADAA943-1AC8-4FB5-82E5-4FB753B6C2DA}" RootNamespace="winuae" + SignManifests="true" > 0) { - ReadConsole(stdinput,out,1,&len,0); - if(*out == 13) break; - out++; - maxlen--; - totallen++; + ReadConsole(stdinput,out,1,&len,0); + if(*out == 13) + break; + out++; + maxlen--; + totallen++; } *out=0; return totallen; diff --git a/readcpu.c b/readcpu.c index c61115d3..854c38bd 100755 --- a/readcpu.c +++ b/readcpu.c @@ -165,7 +165,7 @@ static int specialcase (uae_u16 opcode, int cpu_lev) return cpu_lev; } -static amodes mode_from_str (const char *str) +static amodes mode_from_str (const char *str) { if (strncmp (str, "Dreg", 4) == 0) return Dreg; if (strncmp (str, "Areg", 4) == 0) return Areg; @@ -554,7 +554,7 @@ static void build_insn (int insn) case 'R': destreg = bitval[bitR]; dstgather = 1; dstpos = bitpos[bitR]; break; default: abort(); } - if (dstpos < 0 || dstpos >= 32) + if (dstpos < 0 || dstpos >= 32) abort (); break; case 'A': @@ -565,7 +565,7 @@ static void build_insn (int insn) case 'x': destreg = 0; dstgather = 0; dstpos = 0; break; default: abort(); } - if (dstpos < 0 || dstpos >= 32) + if (dstpos < 0 || dstpos >= 32) abort (); switch (opcstr[pos]) { case 'p': destmode = Apdi; pos++; break; diff --git a/savestate.c b/savestate.c index 963efdab..bbac98b6 100755 --- a/savestate.c +++ b/savestate.c @@ -264,7 +264,7 @@ static uae_u8 *restore_chunk (struct zfile *f, char *name, long *len, long *tota *filepos = zfile_ftell (f) - 4 - 4 - 4; len2 -= 4; } else { - *filepos = zfile_ftell (f) - 4 - 4; + *filepos = zfile_ftell (f) - 4 - 4; } /* chunk data. RAM contents will be loaded during the reset phase, no need to malloc multiple megabytes here. */ @@ -302,8 +302,8 @@ void restore_ram (long filepos, uae_u8 *memory) flags = restore_u32(); size -= 4 + 4 + 4; if (flags & 1) { - zfile_fread (tmp, 1, 4, savestate_file); - src = tmp; + zfile_fread (tmp, 1, 4, savestate_file); + src = tmp; fullsize = restore_u32(); size -= 4; zfile_zuncompress (memory, fullsize, savestate_file, size); @@ -511,7 +511,7 @@ static void save_rams (struct zfile *f, int comp) #endif } -/* Save all subsystems */ +/* Save all subsystems */ void save_state (char *filename, char *description) { @@ -555,7 +555,7 @@ void save_state (char *filename, char *description) zfile_fwrite(tmp, len2, 1, f); xfree(tmp); } - zfile_fclose (f); + zfile_fclose (f); return; } @@ -795,7 +795,7 @@ void savestate_rewind (void) #endif #ifdef ACTION_REPLAY if (restore_u32_func (&p)) - p = restore_action_replay (p); + p = restore_action_replay (p); #endif p += 4; if (p != p2) { @@ -869,8 +869,8 @@ retry2: if (bufcheck (&p, 0)) goto retry; save_disk (i, &len, p); - tlen += len; - p += len; + tlen += len; + p += len; } if (bufcheck (&p, 0)) goto retry; @@ -893,18 +893,18 @@ retry2: tlen += len; p += len; for (i = 0; i < 8; i++) { - if (bufcheck (&p, 0)) + if (bufcheck (&p, 0)) goto retry; save_custom_sprite (i, &len, p); - tlen += len; - p += len; + tlen += len; + p += len; } for (i = 0; i < 4; i++) { if (bufcheck (&p, 0)) goto retry; save_audio (i, &len, p); - tlen += len; - p += len; + tlen += len; + p += len; } if (bufcheck (&p, 0)) goto retry; @@ -1031,237 +1031,237 @@ version 0.8 HUNK HEADER (beginning of every hunk) - hunk name (4 ascii-characters) - hunk size (including header) - hunk flags + hunk name (4 ascii-characters) + hunk size (including header) + hunk flags - bit 0 = chunk contents are compressed with zlib (maybe RAM chunks only?) + bit 0 = chunk contents are compressed with zlib (maybe RAM chunks only?) HEADER - "ASF " (AmigaStateFile) - + "ASF " (AmigaStateFile) + statefile version - emulator name ("uae", "fellow" etc..) - emulator version string (example: "0.8.15") - free user writable comment string + emulator name ("uae", "fellow" etc..) + emulator version string (example: "0.8.15") + free user writable comment string CPU - "CPU " + "CPU " - CPU model 4 (68000,68010 etc..) - CPU typeflags bit 0=EC-model or not - D0-D7 8*4=32 - A0-A6 7*4=32 - PC 4 + CPU model 4 (68000,68010 etc..) + CPU typeflags bit 0=EC-model or not + D0-D7 8*4=32 + A0-A6 7*4=32 + PC 4 unused 4 68000 prefetch (IRC) 2 68000 prefetch (IR) 2 - USP 4 - ISP 4 - SR/CCR 2 - flags 4 (bit 0=CPU was HALTed) + USP 4 + ISP 4 + SR/CCR 2 + flags 4 (bit 0=CPU was HALTed) - CPU specific registers + CPU specific registers - 68000: SR/CCR is last saved register - 68010: save also DFC,SFC and VBR - 68020: all 68010 registers and CAAR,CACR and MSP - etc.. + 68000: SR/CCR is last saved register + 68010: save also DFC,SFC and VBR + 68020: all 68010 registers and CAAR,CACR and MSP + etc.. - DFC 4 (010+) - SFC 4 (010+) - VBR 4 (010+) + DFC 4 (010+) + SFC 4 (010+) + VBR 4 (010+) - CAAR 4 (020-030) - CACR 4 (020+) - MSP 4 (020+) + CAAR 4 (020-030) + CACR 4 (020+) + MSP 4 (020+) FPU (only if used) "FPU " - FPU model 4 (68881/68882/68040) - FPU typeflags 4 (keep zero) + FPU model 4 (68881/68882/68040) + FPU typeflags 4 (keep zero) - FP0-FP7 4+4+2 (80 bits) - FPCR 4 - FPSR 4 - FPIAR 4 + FP0-FP7 4+4+2 (80 bits) + FPCR 4 + FPSR 4 + FPIAR 4 MMU (when and if MMU is supported in future..) - MMU model 4 (68851,68030,68040) + MMU model 4 (68851,68030,68040) - // 68040 fields + // 68040 fields - ITT0 4 - ITT1 4 - DTT0 4 - DTT1 4 - URP 4 - SRP 4 - MMUSR 4 - TC 2 + ITT0 4 + ITT1 4 + DTT0 4 + DTT1 4 + URP 4 + SRP 4 + MMUSR 4 + TC 2 CUSTOM CHIPS - "CHIP" + "CHIP" - chipset flags 4 OCS=0,ECSAGNUS=1,ECSDENISE=2,AGA=4 - ECSAGNUS and ECSDENISE can be combined + chipset flags 4 OCS=0,ECSAGNUS=1,ECSDENISE=2,AGA=4 + ECSAGNUS and ECSDENISE can be combined - DFF000-DFF1FF 352 (0x120 - 0x17f and 0x0a0 - 0xdf excluded) + DFF000-DFF1FF 352 (0x120 - 0x17f and 0x0a0 - 0xdf excluded) - sprite registers (0x120 - 0x17f) saved with SPRx chunks - audio registers (0x0a0 - 0xdf) saved with AUDx chunks + sprite registers (0x120 - 0x17f) saved with SPRx chunks + audio registers (0x0a0 - 0xdf) saved with AUDx chunks AGA COLORS - "AGAC" + "AGAC" - AGA color 8 banks * 32 registers * - registers LONG (XRGB) = 1024 + AGA color 8 banks * 32 registers * + registers LONG (XRGB) = 1024 SPRITE - "SPR0" - "SPR7" + "SPR0" - "SPR7" - SPRxPT 4 - SPRxPOS 2 - SPRxCTL 2 - SPRxDATA 2 - SPRxDATB 2 - AGA sprite DATA/DATB 3 * 2 * 2 - sprite "armed" status 1 + SPRxPT 4 + SPRxPOS 2 + SPRxCTL 2 + SPRxDATA 2 + SPRxDATB 2 + AGA sprite DATA/DATB 3 * 2 * 2 + sprite "armed" status 1 - sprites maybe armed in non-DMA mode - use bit 0 only, other bits are reserved + sprites maybe armed in non-DMA mode + use bit 0 only, other bits are reserved AUDIO - "AUD0" "AUD1" "AUD2" "AUD3" + "AUD0" "AUD1" "AUD2" "AUD3" - audio state 1 - machine mode - AUDxVOL 1 + audio state 1 + machine mode + AUDxVOL 1 irq? 1 data_written? 1 - internal AUDxLEN 2 - AUDxLEN 2 + internal AUDxLEN 2 + AUDxLEN 2 internal AUDxPER 2 AUDxPER 2 - internal AUDxLC 4 + internal AUDxLC 4 AUDxLC 4 evtime? 4 BLITTER - "BLIT" + "BLIT" - internal blitter state + internal blitter state - flags 4 - bit 0=blitter active - bit 1=fill carry bit - internal ahold 4 + flags 4 + bit 0=blitter active + bit 1=fill carry bit + internal ahold 4 internal bhold 4 internal hsize 2 internal vsize 2 CIA - "CIAA" and "CIAB" + "CIAA" and "CIAB" - BFE001-BFEF01 16*1 (CIAA) - BFD000-BFDF00 16*1 (CIAB) + BFE001-BFEF01 16*1 (CIAA) + BFD000-BFDF00 16*1 (CIAB) - internal registers + internal registers - IRQ mask (ICR) 1 BYTE - timer latches 2 timers * 2 BYTES (LO/HI) - latched tod 3 BYTES (LO/MED/HI) - alarm 3 BYTES (LO/MED/HI) - flags 1 BYTE - bit 0=tod latched (read) - bit 1=tod stopped (write) + IRQ mask (ICR) 1 BYTE + timer latches 2 timers * 2 BYTES (LO/HI) + latched tod 3 BYTES (LO/MED/HI) + alarm 3 BYTES (LO/MED/HI) + flags 1 BYTE + bit 0=tod latched (read) + bit 1=tod stopped (write) div10 counter 1 BYTE FLOPPY DRIVES - "DSK0" "DSK1" "DSK2" "DSK3" + "DSK0" "DSK1" "DSK2" "DSK3" - drive state + drive state - drive ID-word 4 - state 1 (bit 0: motor on, bit 1: drive disabled, bit 2: current id bit) - rw-head track 1 - dskready 1 - id-mode 1 (ID mode bit number 0-31) - floppy information + drive ID-word 4 + state 1 (bit 0: motor on, bit 1: drive disabled, bit 2: current id bit) + rw-head track 1 + dskready 1 + id-mode 1 (ID mode bit number 0-31) + floppy information - bits from 4 - beginning of track - CRC of disk-image 4 (used during restore to check if image - is correct) - disk-image null-terminated - file name + bits from 4 + beginning of track + CRC of disk-image 4 (used during restore to check if image + is correct) + disk-image null-terminated + file name -INTERNAL FLOPPY CONTROLLER STATUS +INTERNAL FLOPPY CONTROLLER STATUS - "DISK" + "DISK" - current DMA word 2 - DMA word bit offset 1 - WORDSYNC found 1 (no=0,yes=1) - hpos of next bit 1 - DSKLENGTH status 0=off,1=written once,2=written twice + current DMA word 2 + DMA word bit offset 1 + WORDSYNC found 1 (no=0,yes=1) + hpos of next bit 1 + DSKLENGTH status 0=off,1=written once,2=written twice unused 2 RAM SPACE - "xRAM" (CRAM = chip, BRAM = bogo, FRAM = fast, ZFRAM = Z3) + "xRAM" (CRAM = chip, BRAM = bogo, FRAM = fast, ZFRAM = Z3) - start address 4 ("bank"=chip/slow/fast etc..) - of RAM "bank" - RAM "bank" size 4 - RAM flags 4 (bit 0 = zlib compressed) - RAM "bank" contents + start address 4 ("bank"=chip/slow/fast etc..) + of RAM "bank" + RAM "bank" size 4 + RAM flags 4 (bit 0 = zlib compressed) + RAM "bank" contents ROM SPACE - "ROM " + "ROM " - ROM start 4 - address - size of ROM 4 - ROM type 4 KICK=0 - ROM flags 4 - ROM version 2 - ROM revision 2 - ROM CRC 4 see below - ROM-image ID-string null terminated, see below - path to rom image - ROM contents (Not mandatory, use hunk size to check if - this hunk contains ROM data or not) + ROM start 4 + address + size of ROM 4 + ROM type 4 KICK=0 + ROM flags 4 + ROM version 2 + ROM revision 2 + ROM CRC 4 see below + ROM-image ID-string null terminated, see below + path to rom image + ROM contents (Not mandatory, use hunk size to check if + this hunk contains ROM data or not) - Kickstart ROM: - ID-string is "Kickstart x.x" - ROM version: version in high word and revision in low word - Kickstart ROM version and revision can be found from ROM start - + 12 (version) and +14 (revision) + Kickstart ROM: + ID-string is "Kickstart x.x" + ROM version: version in high word and revision in low word + Kickstart ROM version and revision can be found from ROM start + + 12 (version) and +14 (revision) - ROM version and CRC is only meant for emulator to automatically - find correct image from its ROM-directory during state restore. + ROM version and CRC is only meant for emulator to automatically + find correct image from its ROM-directory during state restore. - Usually saving ROM contents is not good idea. + Usually saving ROM contents is not good idea. END - hunk "END " ends, remember hunk size 8! + hunk "END " ends, remember hunk size 8! EMULATOR SPECIFIC HUNKS diff --git a/scsiemul.c b/scsiemul.c index 59ed73fe..e245b5d6 100755 --- a/scsiemul.c +++ b/scsiemul.c @@ -77,11 +77,11 @@ #define ASYNC_REQUEST_NONE 0 #define ASYNC_REQUEST_TEMP 1 -#define ASYNC_REQUEST_CHANGEINT 10 +#define ASYNC_REQUEST_CHANGEINT 10 #define ASYNC_REQUEST_FRAMEINT 11 #define ASYNC_REQUEST_PLAY 12 #define ASYNC_REQUEST_READXL 13 -#define ASYNC_REQUEST_FRAMECALL 14 +#define ASYNC_REQUEST_FRAMECALL 14 struct devstruct { int unitnum, aunit; @@ -126,7 +126,7 @@ static struct device_info *devinfo (int mode, int unitnum, struct device_info *d static void io_log (char *msg, uaecptr request) { if (log_scsi) - write_log ("%s: %08X %d %08.8X %d %d io_actual=%d io_error=%d\n", + write_log ("%s: %08X %d %08.8X %d %d io_actual=%d io_error=%d\n", msg, request,get_word(request + 28),get_long(request + 40),get_long(request + 36),get_long(request + 44), get_long (request + 32), get_byte (request + 31)); } @@ -173,7 +173,7 @@ static void *dev_thread (void *devs); static int start_thread (struct devstruct *dev) { if (dev->thread_running) - return 1; + return 1; init_comm_pipe (&dev->requests, 100, 1); uae_sem_init (&dev->sync_sem, 0, 0); uae_start_thread (dev_thread, dev, &dev->tid); @@ -191,7 +191,7 @@ static void dev_close_3 (struct devstruct *dev, struct priv_devstruct *pdev) if (pdev->ioctl) sys_command_close (DF_IOCTL, dev->unitnum); pdev->inuse = 0; - write_comm_pipe_u32 (&dev->requests, 0, 1); + write_comm_pipe_u32 (&dev->requests, 0, 1); } } @@ -244,7 +244,7 @@ static uae_u32 dev_open_2 (int type) if (!dev) return openfail (ioreq, 32); /* badunitnum */ if (!dev->opencnt) { - for (i = 0; i < MAX_OPEN_DEVICES; i++) { + for (i = 0; i < MAX_OPEN_DEVICES; i++) { pdev = &pdevst[i]; if (pdev->inuse == 0) break; } @@ -258,20 +258,20 @@ static uae_u32 dev_open_2 (int type) } if (!pdev->scsi && !pdev->ioctl) return openfail (ioreq, -1); - pdev->type = type; - pdev->unit = unit; + pdev->type = type; + pdev->unit = unit; pdev->flags = flags; pdev->inuse = 1; - put_long (ioreq + 24, pdev - pdevst); + put_long (ioreq + 24, pdev - pdevst); start_thread (dev); } else { - for (i = 0; i < MAX_OPEN_DEVICES; i++) { + for (i = 0; i < MAX_OPEN_DEVICES; i++) { pdev = &pdevst[i]; if (pdev->inuse && pdev->unit == unit) break; } if (i == MAX_OPEN_DEVICES) return openfail (ioreq, -1); - put_long (ioreq + 24, pdev - pdevst); + put_long (ioreq + 24, pdev - pdevst); } dev->opencnt++; @@ -488,8 +488,8 @@ static int dev_do_io (struct devstruct *dev, uaecptr request) case CMD_REMCHANGEINT: release_async_request (dev, request); break; - case 28: /* HD_SCSICMD */ - if (dev->allow_scsi && pdev->scsi) { + case 28: /* HD_SCSICMD */ + if (dev->allow_scsi && pdev->scsi) { uae_u32 sdd = get_long (request + 40); io_error = sys_command_scsi_direct (dev->unitnum, sdd); if (log_scsi) @@ -547,8 +547,8 @@ static uae_u32 dev_beginio (void) write_log ("device %s command %d bug with IO_QUICK\n", getdevname (pdev->type), command); return get_byte (request + 31); } else { - add_async_request (dev, request, ASYNC_REQUEST_TEMP, 0); - put_byte (request+30, get_byte (request + 30) & ~1); + add_async_request (dev, request, ASYNC_REQUEST_TEMP, 0); + put_byte (request+30, get_byte (request + 30) & ~1); write_comm_pipe_u32 (&dev->requests, request, 1); return 0; } @@ -564,15 +564,15 @@ static void *dev_thread (void *devs) for (;;) { uaecptr request = (uaecptr)read_comm_pipe_u32_blocking (&dev->requests); uae_sem_wait (&change_sem); - if (!request) { + if (!request) { dev->thread_running = 0; uae_sem_post (&dev->sync_sem); uae_sem_post (&change_sem); return 0; } else if (dev_do_io (dev, request) == 0) { - put_byte (request + 30, get_byte (request + 30) & ~1); + put_byte (request + 30, get_byte (request + 30) & ~1); release_async_request (dev, request); - uae_ReplyMsg (request); + uae_ReplyMsg (request); } else { if (log_scsi) write_log ("async request %08.8X\n", request); @@ -635,7 +635,7 @@ static void dev_reset (void) dev = &devst[i]; if (dev->opencnt > 0) { for (j = 0; j < MAX_ASYNC_REQUESTS; j++) { - uaecptr request; + uaecptr request; if (request = dev->d_request[i]) abort_async (dev, request, 0, 0); } @@ -657,8 +657,8 @@ static void dev_reset (void) discsi = sys_command_info (DF_SCSI, j, &discsi2); sys_command_close (DF_SCSI, j); } - if (discsi) { - dev->unitnum = j; + if (discsi) { + dev->unitnum = j; dev->allow_scsi = 1; dev->drivetype = discsi->type; memcpy (&dev->di, discsi, sizeof (struct device_info)); @@ -670,7 +670,7 @@ static void dev_reset (void) } unitnum = 0; for (i = 0; i < MAX_TOTAL_DEVICES; i++) { - dev = &devst[i]; + dev = &devst[i]; if (dev->unitnum >= 0 && dev->iscd) { dev->aunit = unitnum; unitnum++; @@ -679,7 +679,7 @@ static void dev_reset (void) if (unitnum == 0) unitnum = 1; for (i = 0; i < MAX_TOTAL_DEVICES; i++) { - dev = &devst[i]; + dev = &devst[i]; if (dev->unitnum >= 0) { if (!dev->iscd) { dev->aunit = unitnum; @@ -911,4 +911,4 @@ void scsidev_reset (void) if (!currprefs.scsi) return; dev_reset (); -} \ No newline at end of file +} diff --git a/uaeexe.c b/uaeexe.c index 82af30aa..a71911b4 100755 --- a/uaeexe.c +++ b/uaeexe.c @@ -66,8 +66,8 @@ int uaeexe(char *cmd) if(!first) first = nw; if(last) { - last->next = nw; - last = nw; + last->next = nw; + last = nw; } else last = nw; return UAEEXE_OK; @@ -105,8 +105,8 @@ static uae_u32 uaeexe_server(void) char *dst; if(ARG(0) && !running) { - running = 1; - write_log("Remote CLI started.\n"); + running = 1; + write_log("Remote CLI started.\n"); } cmd = get_cmd(); if(!cmd) return 0; diff --git a/uaelib.c b/uaelib.c index 09c0dc1e..e865581f 100755 --- a/uaelib.c +++ b/uaelib.c @@ -309,12 +309,12 @@ static uae_u32 FindFunctionInObject (uae_u8 *objectptr) return 0; } -#define CREATE_NATIVE_FUNC_PTR uae_u32 (* native_func)( uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, \ +#define CREATE_NATIVE_FUNC_PTR uae_u32 (* native_func)( uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, \ uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32) -#define SET_NATIVE_FUNC(x) native_func = (uae_u32 (*)(uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32))(x) -#define CALL_NATIVE_FUNC( d1,d2,d3,d4,d5,d6,d7,a1,a2,a3,a4,a5,a6 ) if(native_func) native_func( d1,d2,d3,d4,d5,d6,d7,a1,a2,a3,a4,a5,a6 ) +#define SET_NATIVE_FUNC(x) native_func = (uae_u32 (*)(uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32))(x) +#define CALL_NATIVE_FUNC( d1,d2,d3,d4,d5,d6,d7,a1,a2,a3,a4,a5,a6 ) if(native_func) native_func( d1,d2,d3,d4,d5,d6,d7,a1,a2,a3,a4,a5,a6 ) /* A0 - Contains a ptr to the native .obj data. This ptr is Amiga-based. */ -/* We simply find the first function in this .obj data, and execute it. */ +/* We simply find the first function in this .obj data, and execute it. */ static uae_u32 emulib_ExecuteNativeCode (void) { #if 0 diff --git a/unzip.c b/unzip.c index 123b4fb4..4324f5e5 100755 --- a/unzip.c +++ b/unzip.c @@ -34,7 +34,7 @@ #if !defined(unix) && !defined(CASESENSITIVITYDEFAULT_YES) && \ - !defined(CASESENSITIVITYDEFAULT_NO) + !defined(CASESENSITIVITYDEFAULT_NO) #define CASESENSITIVITYDEFAULT_NO #endif @@ -106,9 +106,9 @@ typedef struct } file_in_zip_read_info_s; -/* unz_s contain internal information about the zipfile +/* unz_s contain internal information about the zipfile */ -typedef struct +typedef struct { struct zfile* file; /* io structore of the zipfile */ unz_global_info gi; /* public global information */ @@ -125,7 +125,7 @@ typedef struct unz_file_info cur_file_info; /* public info about the current file in zip*/ unz_file_info_internal cur_file_info_internal; /* private info about it*/ file_in_zip_read_info_s* pfile_in_zip_read; /* structure about the current - file if we are decompressing it */ + file if we are decompressing it */ } unz_s; @@ -144,8 +144,8 @@ local int unzlocal_getByte(fin,pi) int err = zfile_fread(&c, 1, 1, fin); if (err==1) { - *pi = (int)c; - return UNZ_OK; + *pi = (int)c; + return UNZ_OK; } else { @@ -169,13 +169,13 @@ local int unzlocal_getShort (fin,pX) x = (uLong)i; if (err==UNZ_OK) - err = unzlocal_getByte(fin,&i); + err = unzlocal_getByte(fin,&i); x += ((uLong)i)<<8; if (err==UNZ_OK) - *pX = x; + *pX = x; else - *pX = 0; + *pX = 0; return err; } @@ -191,21 +191,21 @@ local int unzlocal_getLong (fin,pX) x = (uLong)i; if (err==UNZ_OK) - err = unzlocal_getByte(fin,&i); + err = unzlocal_getByte(fin,&i); x += ((uLong)i)<<8; if (err==UNZ_OK) - err = unzlocal_getByte(fin,&i); + err = unzlocal_getByte(fin,&i); x += ((uLong)i)<<16; if (err==UNZ_OK) - err = unzlocal_getByte(fin,&i); + err = unzlocal_getByte(fin,&i); x += ((uLong)i)<<24; if (err==UNZ_OK) - *pX = x; + *pX = x; else - *pX = 0; + *pX = 0; return err; } @@ -235,7 +235,7 @@ local int strcmpcasenosensitive_internal (fileName1,fileName2) } -#ifdef CASESENSITIVITYDEFAULT_NO +#ifdef CASESENSITIVITYDEFAULT_NO #define CASESENSITIVITYDEFAULTVALUE 2 #else #define CASESENSITIVITYDEFAULTVALUE 1 @@ -249,9 +249,9 @@ local int strcmpcasenosensitive_internal (fileName1,fileName2) Compare two filename (fileName1,fileName2). If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi - or strcasecmp) + or strcasecmp) If iCaseSenisivity = 0, case sensitivity is defaut of your operating system - (like 1 on Unix, 2 on Windows) + (like 1 on Unix, 2 on Windows) */ extern int ZEXPORT unzStringFileNameCompare (fileName1,fileName2,iCaseSensitivity) @@ -268,7 +268,7 @@ extern int ZEXPORT unzStringFileNameCompare (fileName1,fileName2,iCaseSensitivit return STRCMPCASENOSENTIVEFUNCTION(fileName1,fileName2); } -#define BUFREADCOMMENT (0x400) +#define BUFREADCOMMENT (0x400) /* Locate the Central directory of a zipfile (at the end, just before @@ -308,14 +308,14 @@ local uLong unzlocal_SearchCentralDir(fin) uReadPos = uSizeFile-uBackRead ; uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ? - (BUFREADCOMMENT+4) : (uSizeFile-uReadPos); + (BUFREADCOMMENT+4) : (uSizeFile-uReadPos); if (zfile_fseek(fin,uReadPos,SEEK_SET)!=0) break; if (zfile_fread(buf,(uInt)uReadSize,1,fin)!=1) break; - for (i=(int)uReadSize-3; (i--)>0;) + for (i=(int)uReadSize-3; (i--)>0;) if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06)) { @@ -351,13 +351,13 @@ extern unzFile ZEXPORT unzOpen (fin) uLong number_disk_with_CD; /* number the the disk with central dir, used for spaning ZIP, unsupported, always 0*/ uLong number_entry_CD; /* total number of entries in - the central dir - (same than number_entry on nospan) */ + the central dir + (same than number_entry on nospan) */ int err=UNZ_OK; if (unz_copyright[0]!=' ') - return NULL; + return NULL; central_pos = unzlocal_SearchCentralDir(fin); if (central_pos==0) @@ -413,7 +413,7 @@ extern unzFile ZEXPORT unzOpen (fin) us.file=fin; us.byte_before_the_zipfile = central_pos - - (us.offset_central_dir+us.size_central_dir); + (us.offset_central_dir+us.size_central_dir); us.central_pos = central_pos; us.pfile_in_zip_read = NULL; @@ -439,7 +439,7 @@ extern int ZEXPORT unzClose (file) s=(unz_s*)file; if (s->pfile_in_zip_read!=NULL) - unzCloseCurrentFile(file); + unzCloseCurrentFile(file); zfile_fclose(s->file); TRYFREE(s); @@ -486,22 +486,22 @@ local void unzlocal_DosDateToTmuDate (ulDosDate, ptm) Get Info about the current file in the zipfile, with internal only info */ local int unzlocal_GetCurrentFileInfoInternal OF((unzFile file, - unz_file_info *pfile_info, - unz_file_info_internal - *pfile_info_internal, - char *szFileName, + unz_file_info *pfile_info, + unz_file_info_internal + *pfile_info_internal, + char *szFileName, uLong fileNameBufferSize, - void *extraField, + void *extraField, uLong extraFieldBufferSize, - char *szComment, + char *szComment, uLong commentBufferSize)); local int unzlocal_GetCurrentFileInfoInternal (file, - pfile_info, - pfile_info_internal, - szFileName, fileNameBufferSize, - extraField, extraFieldBufferSize, - szComment, commentBufferSize) + pfile_info, + pfile_info_internal, + szFileName, fileNameBufferSize, + extraField, extraFieldBufferSize, + szComment, commentBufferSize) unzFile file; unz_file_info *pfile_info; unz_file_info_internal *pfile_info_internal; @@ -662,10 +662,10 @@ local int unzlocal_GetCurrentFileInfoInternal (file, return UNZ_OK if there is no problem. */ extern int ZEXPORT unzGetCurrentFileInfo (file, - pfile_info, - szFileName, fileNameBufferSize, - extraField, extraFieldBufferSize, - szComment, commentBufferSize) + pfile_info, + szFileName, fileNameBufferSize, + extraField, extraFieldBufferSize, + szComment, commentBufferSize) unzFile file; unz_file_info *pfile_info; char *szFileName; @@ -741,7 +741,7 @@ extern int ZEXPORT unzGoToNextFile (file) UNZ_OK if the file is found. It becomes the current file. UNZ_END_OF_LIST_OF_FILE if the file is not found */ -extern int ZEXPORT unzLocateFile (file, szFileName, iCaseSensitivity) +extern int ZEXPORT unzLocateFile (file, szFileName, iCaseSensitivity) unzFile file; const char *szFileName; int iCaseSensitivity; @@ -758,7 +758,7 @@ extern int ZEXPORT unzLocateFile (file, szFileName, iCaseSensitivity) return UNZ_PARAMERROR; if (strlen(szFileName)>=UNZ_MAXFILENAMEINZIP) - return UNZ_PARAMERROR; + return UNZ_PARAMERROR; s=(unz_s*)file; if (!s->current_file_ok) @@ -790,9 +790,9 @@ extern int ZEXPORT unzLocateFile (file, szFileName, iCaseSensitivity) /* Read the local header of the current zipfile Check the coherency of the local header and info in the end of central - directory about this file + directory about this file store in *piSizeVar the size of extra info in local header - (filename and size of extra field data) + (filename and size of extra field data) */ local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar, poffset_local_extrafield, @@ -837,8 +837,8 @@ local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar, err=UNZ_BADZIPFILE; if ((err==UNZ_OK) && (s->cur_file_info.compression_method!=0) && - (s->cur_file_info.compression_method!=Z_DEFLATED)) - err=UNZ_BADZIPFILE; + (s->cur_file_info.compression_method!=Z_DEFLATED)) + err=UNZ_BADZIPFILE; if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* date/time */ err=UNZ_ERRNO; @@ -846,18 +846,18 @@ local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar, if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* crc */ err=UNZ_ERRNO; else if ((err==UNZ_OK) && (uData!=s->cur_file_info.crc) && - ((uFlags & 8)==0)) + ((uFlags & 8)==0)) err=UNZ_BADZIPFILE; if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* size compr */ err=UNZ_ERRNO; -/* else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compressed_size) && +/* else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compressed_size) && ((uFlags & 8)==0)) err=UNZ_BADZIPFILE; */ if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* size uncompr */ err=UNZ_ERRNO; -/* else if ((err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) && +/* else if ((err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) && ((uFlags & 8)==0)) err=UNZ_BADZIPFILE; */ @@ -902,7 +902,7 @@ extern int ZEXPORT unzOpenCurrentFile (file) return UNZ_PARAMERROR; if (s->pfile_in_zip_read != NULL) - unzCloseCurrentFile(file); + unzCloseCurrentFile(file); if (unzlocal_CheckCurrentFileCoherencyHeader(s,&iSizeVar, &offset_local_extrafield,&size_local_extrafield)!=UNZ_OK) @@ -927,14 +927,14 @@ extern int ZEXPORT unzOpenCurrentFile (file) pfile_in_zip_read_info->stream_initialised=0; if ((s->cur_file_info.compression_method!=0) && - (s->cur_file_info.compression_method!=Z_DEFLATED)) + (s->cur_file_info.compression_method!=Z_DEFLATED)) err=UNZ_BADZIPFILE; Store = s->cur_file_info.compression_method==0; pfile_in_zip_read_info->crc32_wait=s->cur_file_info.crc; pfile_in_zip_read_info->crc32=0; pfile_in_zip_read_info->compression_method = - s->cur_file_info.compression_method; + s->cur_file_info.compression_method; pfile_in_zip_read_info->file=s->file; pfile_in_zip_read_info->byte_before_the_zipfile=s->byte_before_the_zipfile; @@ -949,22 +949,22 @@ extern int ZEXPORT unzOpenCurrentFile (file) err=pinflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS, ZLIB_VERSION, sizeof(z_stream)); if (err == Z_OK) pfile_in_zip_read_info->stream_initialised=1; - /* windowBits is passed < 0 to tell that there is no zlib header. - * Note that in this case inflate *requires* an extra "dummy" byte - * after the compressed stream in order to complete decompression and - * return Z_STREAM_END. - * In unzip, i don't wait absolutely Z_STREAM_END because I known the - * size of both compressed and uncompressed data - */ + /* windowBits is passed < 0 to tell that there is no zlib header. + * Note that in this case inflate *requires* an extra "dummy" byte + * after the compressed stream in order to complete decompression and + * return Z_STREAM_END. + * In unzip, i don't wait absolutely Z_STREAM_END because I known the + * size of both compressed and uncompressed data + */ } pfile_in_zip_read_info->rest_read_compressed = - s->cur_file_info.compressed_size ; + s->cur_file_info.compressed_size ; pfile_in_zip_read_info->rest_read_uncompressed = - s->cur_file_info.uncompressed_size ; + s->cur_file_info.uncompressed_size ; pfile_in_zip_read_info->pos_in_zipfile = - s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER + + s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER + iSizeVar; pfile_in_zip_read_info->stream.avail_in = (uInt)0; @@ -1019,7 +1019,7 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len) while (pfile_in_zip_read_info->stream.avail_out>0) { if ((pfile_in_zip_read_info->stream.avail_in==0) && - (pfile_in_zip_read_info->rest_read_compressed>0)) + (pfile_in_zip_read_info->rest_read_compressed>0)) { uInt uReadThis = UNZ_BUFSIZE; if (pfile_in_zip_read_info->rest_read_compressedfile, - pfile_in_zip_read_info->pos_in_zipfile + - pfile_in_zip_read_info->byte_before_the_zipfile,SEEK_SET)!=0) + pfile_in_zip_read_info->pos_in_zipfile + + pfile_in_zip_read_info->byte_before_the_zipfile,SEEK_SET)!=0) return UNZ_ERRNO; if (zfile_fread(pfile_in_zip_read_info->read_buffer,uReadThis,1, - pfile_in_zip_read_info->file)!=1) + pfile_in_zip_read_info->file)!=1) return UNZ_ERRNO; pfile_in_zip_read_info->pos_in_zipfile += uReadThis; pfile_in_zip_read_info->rest_read_compressed-=uReadThis; pfile_in_zip_read_info->stream.next_in = - (Bytef*)pfile_in_zip_read_info->read_buffer; + (Bytef*)pfile_in_zip_read_info->read_buffer; pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis; } @@ -1046,14 +1046,14 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len) { uInt uDoCopy,i ; if (pfile_in_zip_read_info->stream.avail_out < - pfile_in_zip_read_info->stream.avail_in) + pfile_in_zip_read_info->stream.avail_in) uDoCopy = pfile_in_zip_read_info->stream.avail_out ; else uDoCopy = pfile_in_zip_read_info->stream.avail_in ; for (i=0;istream.next_out+i) = - *(pfile_in_zip_read_info->stream.next_in+i); + *(pfile_in_zip_read_info->stream.next_in+i); pfile_in_zip_read_info->crc32 = pcrc32(pfile_in_zip_read_info->crc32, pfile_in_zip_read_info->stream.next_out, @@ -1063,7 +1063,7 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len) pfile_in_zip_read_info->stream.avail_out -= uDoCopy; pfile_in_zip_read_info->stream.next_out += uDoCopy; pfile_in_zip_read_info->stream.next_in += uDoCopy; - pfile_in_zip_read_info->stream.total_out += uDoCopy; + pfile_in_zip_read_info->stream.total_out += uDoCopy; iRead += uDoCopy; } else @@ -1078,7 +1078,7 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len) /* if ((pfile_in_zip_read_info->rest_read_uncompressed == - pfile_in_zip_read_info->stream.avail_out) && + pfile_in_zip_read_info->stream.avail_out) && (pfile_in_zip_read_info->rest_read_compressed == 0)) flush = Z_FINISH; */ @@ -1088,14 +1088,14 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len) uOutThis = uTotalOutAfter-uTotalOutBefore; pfile_in_zip_read_info->crc32 = - pcrc32(pfile_in_zip_read_info->crc32,bufBefore, - (uInt)(uOutThis)); + pcrc32(pfile_in_zip_read_info->crc32,bufBefore, + (uInt)(uOutThis)); pfile_in_zip_read_info->rest_read_uncompressed -= - uOutThis; + uOutThis; iRead += (uInt)(uTotalOutAfter - uTotalOutBefore); - + if (err==Z_STREAM_END) return (iRead==0) ? UNZ_EOF : iRead; if (err!=Z_OK) @@ -1198,7 +1198,7 @@ extern int ZEXPORT unzGetLocalExtrafield (file,buf,len) return 0; if (zfile_fseek(pfile_in_zip_read_info->file, - pfile_in_zip_read_info->offset_local_extrafield + + pfile_in_zip_read_info->offset_local_extrafield + pfile_in_zip_read_info->pos_local_extrafield,SEEK_SET)!=0) return UNZ_ERRNO; diff --git a/zfile.c b/zfile.c index 837374dd..6a26e7f2 100755 --- a/zfile.c +++ b/zfile.c @@ -201,15 +201,15 @@ static struct zfile *updateoutputfile (struct zfile *z) for (;;) { if (!f) break; - fseek (f, 0, SEEK_END); + fseek (f, 0, SEEK_END); size = ftell (f); fseek (f, 0, SEEK_SET); if (!size) break; - z2 = zfile_fopen_empty (z->name, size); + z2 = zfile_fopen_empty (z->name, size); if (!z2) break; - fread (z2->data, size, 1, f); + fread (z2->data, size, 1, f); fclose (f); zfile_fclose (z); return z2; @@ -250,7 +250,7 @@ static struct zfile *gunzip (struct zfile *z) if (flags & 32) /* encryption not supported */ return z; if (flags & 4) { /* skip extra field */ - zfile_fread (&b, 1, 1, z); + zfile_fread (&b, 1, 1, z); size = b; zfile_fread (&b, 1, 1, z); size |= b << 8; @@ -542,7 +542,7 @@ static struct zfile *arcacc_unpack (struct zfile *z, int type) if (zf->seek != fi.UncompressedFileSize) write_log ("%s unpack failed, got only %d bytes\n", name, zf->seek); if (zf->seek == fi.UncompressedFileSize && (select < 0 || zfile_gettype (zf))) - we_have_file = 1; + we_have_file = 1; if (!we_have_file) { zfile_fclose (zf); zf = 0; @@ -662,7 +662,7 @@ static struct zfile *unzip (struct zfile *z) if (err == 0 || err == file_info.uncompressed_size) { zf = zuncompress (zf); if (select < 0 || zfile_gettype (zf)) { - we_have_file = 1; + we_have_file = 1; } } } @@ -733,7 +733,7 @@ static struct zfile *zuncompress (struct zfile *z) if (strcasecmp (ext, "dms") == 0) return dms (z); for (i = 0; plugins_7z[i]; i++) { - if (strcasecmp (ext, plugins_7z[i]) == 0) + if (strcasecmp (ext, plugins_7z[i]) == 0) return arcacc_unpack (z, plugins_7z_t[i]); } if (strcasecmp (ext, "lha") == 0 @@ -781,7 +781,7 @@ static FILE *openzip (char *name, char *zippath) } i--; } - return 0; + return 0; } #ifdef SINGLEFILE @@ -828,7 +828,7 @@ static struct zfile *zfile_fopen_2 (const char *name, const char *mode) char zipname[1000]; if( *name == '\0' ) - return NULL; + return NULL; l = zfile_create (); l->name = strdup (name); #ifdef SINGLEFILE @@ -910,9 +910,9 @@ static int arcacc_zunzip (struct zfile *z, zfile_callback zc, void *user, int ty } zfile_fclose (zf); } - if (fi.CompressedFileSize) + if (fi.CompressedFileSize) skipsize = 0; - skipsize += (int)fi.UncompressedFileSize; + skipsize += (int)fi.UncompressedFileSize; } closeArchive (ah); arcacc_pop (); @@ -930,20 +930,20 @@ static int zunzip (struct zfile *z, zfile_callback zc, void *user) int err; if (!zlib_test (1, 0)) - return 0; + return 0; zf = 0; uz = unzOpen (z); if (!uz) - return 0; + return 0; if (unzGoToFirstFile (uz) != UNZ_OK) - return 0; + return 0; for (;;) { - err = unzGetCurrentFileInfo(uz, &file_info, filename_inzip, sizeof(filename_inzip), NULL, 0, NULL, 0); - if (err != UNZ_OK) + err = unzGetCurrentFileInfo(uz, &file_info, filename_inzip, sizeof(filename_inzip), NULL, 0, NULL, 0); + if (err != UNZ_OK) return 0; if (file_info.uncompressed_size > 0) { int err = unzOpenCurrentFile (uz); - if (err == UNZ_OK) { + if (err == UNZ_OK) { tmp2[0] = FSDB_DIR_SEPARATOR; tmp2[1] = 0; strcpy (tmp, z->name); @@ -1178,7 +1178,7 @@ int zfile_zcompress (struct zfile *f, void *src, int size) v = Z_OK; while (v == Z_OK) { zs.next_out = outbuf; - zs.avail_out = sizeof (outbuf); + zs.avail_out = sizeof (outbuf); v = pdeflate(&zs, Z_NO_FLUSH | Z_FINISH); if (sizeof(outbuf) - zs.avail_out > 0) zfile_fwrite (outbuf, 1, sizeof (outbuf) - zs.avail_out, f); -- 2.47.3