int cd32_enabled;
-static int m68k_getpc(void) { return 0; }
+static int m68k_getpc(void) { return 0; }
/*
* CD32 1Kb NVRAM (EEPROM) emulation
* 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);
if (direction > 0) {
nvram_writetmp[nvram_writeaddr++] = nvram_byte;
nvram_writeaddr &= 15;
- bitcounter = 0;
+ bitcounter = 0;
} else {
bitcounter = -1;
}
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);
}
}
* 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];
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;
}
/* 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)
}
/* convert logical sector number -> minutes, seconds and frames */
-static int lsn2msf (int sectors)
+static int lsn2msf (int sectors)
{
int msf;
sectors += 150;
return msf;
}
-static void cdaudiostop (void)
+static void cdaudiostop (void)
{
cdrom_playing = 0;
cdrom_paused = 0;
}
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;
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)
/* 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));
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);
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");
}
unitnum = audiounit;
if (cd32unit >= 0)
- unitnum = cd32unit;
+ unitnum = cd32unit;
if (unitnum < 0)
unitnum = first;
if (unitnum < 0)
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);
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);
}
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);
}
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)
{
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 ();
}
}
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 ();
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;
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;
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;
{
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);
/* C2P */
case 0x38:
case 0x39:
- case 0x3a:
+ case 0x3a:
case 0x3b:
v = akiko_c2p_read (addr - 0x38);
break;
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;
}
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)
{
{
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);
}
}
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;
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)
{
#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;
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);
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;
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++);
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;
}
-/* 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;
}
}
}
/* 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 )
{
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;
}
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)
{
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);
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)
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;
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;
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;
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;
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
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);
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);
{
#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
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)
{
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
}
}
}
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;
}
{
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;
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;
{
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;
}
-/* 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.
*/
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;
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 ;)
*/
return checksum == stored_checksum ? 0 : checksum;
}
-/* Returns 0 on error. */
+/* Returns 0 on error. */
static uae_u8* get_checksum_location()
{
uae_u32* checksum_end;
}
-/* 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();
* 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;
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;
{
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;
}
/* 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.
*/
{
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 */
}
}
}
{
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.
return;
if ( action_replay_calculate_checksum() == 0 )
{
- write_log("Action Replay Checksum is OK.\n");
+ write_log("Action Replay Checksum is OK.\n");
}
else
{
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;
+ }
}
}
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[] =
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;
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)
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)
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)
p=mem+len+3;
len=do_get_mem_long(p-2);
for(i=0;i<len;i++) {
- base=(uae_u8*)do_get_mem_long(p)+(uae_u32)mem;
- do_put_mem_long((uae_u32*)base, do_get_mem_long((uae_u32*)base)+hrtmem_start);
- p++;
+ base=(uae_u8*)do_get_mem_long(p)+(uae_u32)mem;
+ do_put_mem_long((uae_u32*)base, do_get_mem_long((uae_u32*)base)+hrtmem_start);
+ p++;
}
}
/* Don't load a rom if one is already loaded. Use action_replay_unload() first. */
if (armemory_rom)
- return 0;
+ return 0;
if (hrtmemory)
return 0;
armodel = 0;
if (strlen(currprefs.cartfile) == 0)
- return 0;
+ return 0;
f=zfile_fopen(currprefs.cartfile,"rb");
if(!f) {
- write_log("failed to load '%s' HRTMon ROM\n", currprefs.cartfile);
- return 0;
+ write_log("failed to load '%s' HRTMon ROM\n", currprefs.cartfile);
+ return 0;
}
zfile_fseek(f,0,SEEK_END);
size = zfile_ftell(f) - 8*4;
if ( size < sizeof(header)+sizeof(id_string) )
{
write_log("Not a Hrtmon Rom.\n");
- zfile_fclose (f);
+ zfile_fclose (f);
return 0;
}
zfile_fread(header,sizeof(header),1,f);
/* Check the header */
-/* uae_u8* ptr = (uae_u8*)&header; */
-/* for ( ; ptr < sizeof(header); ptr++) */
+/* uae_u8* ptr = (uae_u8*)&header; */
+/* for ( ; ptr < sizeof(header); ptr++) */
/* { */
/* if ( *ptr != *header */
if (strncmp((char*)&id_string[1], "HRT!",4) != 0 )
{
write_log("Not a Hrtmon Rom\n");
- zfile_fclose (f);
+ zfile_fclose (f);
return 0;
}
zfile_fseek(f,sizeof(header),SEEK_SET);
void hrtmon_map_banks()
{
if(!hrtmemory)
- return;
+ return;
map_banks (&hrtmem_bank, hrtmem_start >> 16, hrtmem_size >> 16, hrtmem_size);
}
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()
{
*sArDate = '\0';
if (!armemory_rom)
- return;
+ return;
if ( armodel == 1 )
return; /* no support yet. */
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
#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
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;
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;
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;
#include "arcadia.h"
#include "zfile.h"
-/* supported roms (mame 0.90)
+/* supported roms (mame 0.90)
*
* - ar_airh
* - ar_bowl
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 },
};
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];
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;
arbmemory[1] = 0xfc;
}
-uae_u32 REGPARAM2 aab_bget (uaecptr addr)
+uae_u32 REGPARAM2 aab_bget (uaecptr addr)
{
return 0;
}
struct zfile *wavfile;
if (mode < 0) {
- while (rs) {
+ while (rs) {
struct ripped_sample *next = rs->next;
xfree(rs);
rs = next;
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;
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)
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;
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;
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)
{
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 ();
}
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 ();
}
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 ();
}
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 ();
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 ();
}
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 ();
}
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
}
}
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:
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;
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);
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;
(cdp+1)->per = cdp->dat * CYCLE_UNIT;
}
}
- return;
+ return;
case 3:
if (currprefs.produce_sound == 0)
if (cdp->dmaen) {
if (napnav)
cdp->request_word = 1;
- if (cdp->intreq2 && napnav)
+ if (cdp->intreq2 && napnav)
setirq (nr);
} else {
if (napnav)
#endif
}
}
- return;
+ return;
}
}
}
}
-#ifndef MULTIPLICATION_PROFITABLE
+#ifndef MULTIPLICATION_PROFITABLE
for (i = 0; i < 4; i++)
audio_channel[i].voltbl = sound_table[audio_channel[i].vol];
#endif
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)
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;
(*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;
#ifdef CPUEMU_6
extern uae_u8 cycle_line[];
#endif
-uae_u16 dmacon;
+uae_u16 dmacon;
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;
}
if (cdp->state == 5) {
- cdp->pt = cdp->lc;
+ cdp->pt = cdp->lc;
if (sampleripper_enabled)
do_samplerip(cdp);
#ifdef DEBUG_AUDIO
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;
if (cdp->state == 0) {
cdp->state = 2;
audio_handler (nr, 0);
- schedule_audio ();
+ schedule_audio ();
events_schedule ();
}
}
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
}
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
}
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
}
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
}
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
}
#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];
/* 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
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)
{
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;
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];
}
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)
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)
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;
}
while (blit_last_hpos < hpos) {
int c = blit_cyclecounter % 2;
for (;;) {
- if (blit_cyclecounter < 0) {
+ if (blit_cyclecounter < 0) {
blit_cyclecounter++;
break;
}
return;
}
}
- break;
+ break;
}
blit_last_hpos++;
}
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)
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;
}
switch (ch)
{
case 1:
- blt_info.bltadat = chipmem_agnus_wget (bltapt);
+ blt_info.bltadat = chipmem_agnus_wget (bltapt);
bltapt += blit_add;
break;
case 2:
}
#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 {
blit_diag = blit_cycle_diagram_finald;
}
}
- break;
+ break;
}
blit_last_hpos++;
}
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--;
}
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) {
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];
blit_modaddd = mult * blt_info.bltdmod;
}
-void reset_blit (int bltcon)
+void reset_blit (int bltcon)
{
if (bltstate == BLT_done)
return;
blit_modset ();
}
-void do_blitter (int hpos)
+void do_blitter (int hpos)
{
int cycles;
#ifdef BLITTER_DEBUG
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
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))
}
if (currprefs.immediate_blits)
- cycles = 1;
+ cycles = 1;
eventtab[ev_blitter].active = 1;
eventtab[ev_blitter].oldcycles = get_cycles ();
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) {
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;
#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
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;
#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);
}
{
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);
}
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);
}
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;
{
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;
}
{
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");
}
}
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");
static uae_u32 SockLibBase;
#define SOCKPOOLSIZE 128
-#define UNIQUE_ID (-1)
+#define UNIQUE_ID (-1)
/* ObtainSocket()/ReleaseSocket() public socket pool */
long sockpoolids[SOCKPOOLSIZE];
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;
/* 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:
return i + 1;
}
/* descriptor table full. */
- seterrno (sb, 24); /* EMFILE */
+ seterrno (sb, 24); /* EMFILE */
return -1;
}
{
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;
}
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;
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
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() */
}
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 */
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);
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));
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)
{
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;
}
{
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;
}
{
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;
}
{
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;
}
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) */
{
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;
}
sd = m68k_dreg (regs, 0);
id = m68k_dreg (regs, 1);
-
- sd++;
+
+ sd++;
TRACE (("ReleaseSocket(%d,%d) -> ", sd, id));
s = getsock (sb, sd);
TRACE (("OK\n"));
return 0;
}
- seterrno (sb, 22); /* EINVAL */
+ seterrno (sb, 22); /* EINVAL */
return -1;
}
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");
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
(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 /* <sys/errno.h> */
-#define SBTC_HERRNOSTRPTR 15 /* <netdb.h> */
-#define SBTC_IOERRNOSTRPTR 16 /* <exec/errors.h> */
-#define SBTC_S2ERRNOSTRPTR 17 /* <devices/sana2.h> */
-#define SBTC_S2WERRNOSTRPTR 18 /* <devices/sana2.h> */
+#define SBTC_LOGMASK 13
+#define SBTC_ERRNOSTRPTR 14 /* <sys/errno.h> */
+#define SBTC_HERRNOSTRPTR 15 /* <netdb.h> */
+#define SBTC_IOERRNOSTRPTR 16 /* <exec/errors.h> */
+#define SBTC_S2ERRNOSTRPTR 17 /* <devices/sana2.h> */
+#define SBTC_S2WERRNOSTRPTR 18 /* <devices/sana2.h> */
#define SBTC_ERRNOBYTEPTR 21
#define SBTC_ERRNOWORDPTR 22
#define SBTC_ERRNOLONGPTR 24
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);
}
{
uae_u32 tmp1;
int i;
+
write_log ("Creating UAE bsdsocket.library 4.1\n");
if (SockLibBase)
bsdlib_reset ();
{
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;
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;
int i;
for (i = 0; i < 0x19; i++) {
sid_write(i, 0, 0);
- sid_write(i, 0, 1);
+ sid_write(i, 0, 1);
}
}
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
}
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++) {
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;
cwmk3port = 1;
} else {
cwmk3port2 = b;
- catweasel_do_bget(0xd4); // select port1
+ catweasel_do_bget(0xd4); // select port1
cwmk3port = 0;
}
}
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];
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;
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);
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 ();
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)
}
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 */
c->io_mem = c->iobase + 0xe0;
break;
default:
- return;
+ return;
}
c->control_register = 255;
return ret;
}
-int catweasel_diskready(catweasel_drive *d)
+int catweasel_diskready(catweasel_drive *d)
{
int ret;
CWSetCReg(d->contr, d->sel, 0);
}
}
-#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)
{
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 {
{
if (dmacmemory[0x41] & 0x10) {
write_log ("cdtv doint\n");
- INTREQ (0x8008);
+ INTREQ (0x8008);
}
}
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
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);
#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) {
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);
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]]);
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);
#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);
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)
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;
}
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;
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;
}
|| 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)
}
if (cfgfile_intval (option, value, "cpu_speed", &p->m68k_speed, 1)) {
- p->m68k_speed *= CYCLE_UNIT;
+ p->m68k_speed *= CYCLE_UNIT;
return 1;
}
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;
}
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)
goto invalid_fs;
if (getintval2 (&tmpp, &bp, ',')) {
fs = tmpp;
- tmpp = strchr (tmpp, ',');
+ tmpp = strchr (tmpp, ',');
if (tmpp != 0)
*tmpp = 0;
}
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)
/* 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);
}
fh = fopen (filename, "r");
-#ifndef SINGLEFILE
+#ifndef SINGLEFILE
if (! fh)
return 0;
#endif
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;
}
return v;
}
-void cfgfile_backup (const char *path)
+void cfgfile_backup (const char *path)
{
char dpath[MAX_DPATH];
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. */
}
return separate_line (tmp, option, value);
}
-
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);
}
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 == ' ')
argv = 0;
p = 0;
if (index != 0xffffffff) {
- if (!configstore) {
+ if (!configstore) {
err = 20;
goto end;
}
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;
xfree (argc[i]);
xfree (p);
return err;
-}
+}
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;
tmp2[0] = 0;
i = 0;
while (rom[i] >= 0) {
- rd = getromdatabyid (rom[i]);
+ rd = getromdatabyid (rom[i]);
if (!rd) {
i++;
continue;
}
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;
}
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;
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;
if (compa > 1) {
p->immediate_blits = 1;
p->produce_sound = 2;
- }
+ }
}
/* 0: cycle-exact
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;
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;
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;
* 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
}
}
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
}
}
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;
{
#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) {
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);
+ }
}
}
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;
#endif
#ifdef PARALLEL_PORT
if (isprinter () < 0)
- parallel_direct_write_status (val, ciabdra);
+ parallel_direct_write_status (val, ciabdra);
#endif
break;
case 1:
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)
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) {
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 ();
}
{
struct zfile *f = zfile_fopen (currprefs.flashfile,"rb");
if (!f)
- return;
+ return;
zfile_fread (cdtv_battram, CDTV_NVRAM_SIZE,1 ,f);
zfile_fclose (f);
}
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;
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];
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;
int bogusframe;
#if DEBUG_COPPER
-/* 10000 isn't enough! */
+/* 10000 isn't enough! */
#define NR_COPPER_RECORDS 40000
#else
#define NR_COPPER_RECORDS 1
#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;
}
} 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;
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)
{
}
/* 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)
{
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) {
}
-/* Used by the copper. */
+/* Used by the copper. */
static int estimated_last_fetch_cycle;
static int cycle_diagram_shift;
#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.
#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;
#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);
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)
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;
}
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. */
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
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;
}
}
-#ifndef CUSTOM_SIMPLE
+#ifndef CUSTOM_SIMPLE
if (last_sprite_decide_line_hpos < SPR0_HPOS + 4 * MAX_SPRITES)
do_sprites (hpos);
#endif
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)
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;
}
}
}
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) {
// 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;
}
}
if (!fake_vblank_hz)
- fake_vblank_hz = vblank_hz;
+ fake_vblank_hz = vblank_hz;
if (turbo_emulation)
vsynctime = vsynctime_orig = 1;
else
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;
{
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
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)
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;
}
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);
}
events_schedule();
}
-
#define INTDELAY
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--) {
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);
}
}
}
if (bplcon0 == v)
return;
+ if ((bplcon0 & 2) && !(v & 2)) {
+ vpos_previous = vpos;
+ hpos_previous = hpos;
+ }
+
ddf_change = vpos;
decide_line (hpos);
decide_fetch (hpos);
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;
}
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)
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
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
#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
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
}
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;
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",
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;
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;
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;
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. */
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)
}
copper_enabled_thisline = 1;
- if (currprefs.fast_copper && FAST_COPPER)
- predict_copper ();
-
if (! eventtab[ev_copper].active)
set_special (SPCFLAG_COPPER);
}
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 ();
{
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
#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)
{
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 {
}
}
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) {
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;
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()) {
if (quit_program > 0) {
/* prevent possible infinite loop at wait_cycles().. */
framecnt = 0;
- reset_decisions ();
+ reset_decisions ();
return;
}
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);
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
{
next_lineno = lineno;
reset_decisions ();
}
-#ifdef FILESYS
+#ifdef FILESYS
if (uae_int_requested) {
set_uae_int_flag ();
INTREQ (0x8000 | 0x0008);
//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;
}
#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);
}
bogusframe = 1;
- init_regtypes ();
-
sprite_buffer_res = currprefs.chipset_mask & CSMASK_AGA ? RES_HIRES : RES_LORES;
if (savestate_state == STATE_RESTORE) {
uae_u16 v;
#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;
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);
}
drawing_init ();
- mousehack_set (mousehack_unknown);
- if (needmousehack ())
- mousehack_set (mousehack_follow);
-
create_cycle_diagram_table ();
}
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;
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;
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;
}
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;
}
#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);
}
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 ? */
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);
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)) {
{
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);
*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;
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;
#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;
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);
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
}
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);
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;
{
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);
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
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 */
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;
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;
if (drv->catweasel) {
- drv->wrprot = 1;
+ drv->wrprot = 1;
drv->filetype = ADF_CATWEASEL;
drv->num_tracks = 80;
drv->ddhd = 1;
#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;
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;
}
}
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;
#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;
}
{
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
/* 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;
while (getmfmword (mbuf, shift) != 0x4489) {
if (mbuf >= mend)
- return 1;
+ return 1;
shift++;
if (shift == 16) {
shift = 0;
}
while (getmfmword (mbuf, shift) == 0x4489) {
if (mbuf >= mend)
- return 1;
+ return 1;
mbuf++;
}
}
if (!needwritefile)
- diskfile_readonly (name, protect);
+ diskfile_readonly (name, protect);
diskfile_readonly (name2, protect);
DISK_reinsert (num);
return 1;
#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");
{
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:
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;
}
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)
indexhack = 0;
}
if (dskdmaen != 3 && mfmpos == drv->skipoffset) {
- int skipcnt = disk_jitter;
+ int skipcnt = disk_jitter;
while (skipcnt-- > 0) {
mfmpos++;
mfmpos %= drv->tracklen;
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 ();
}
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);
}
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;
}
if (word == dsksync) {
if (adkcon & 0x400)
- bitoffset = 15;
+ bitoffset = 15;
if (dskdmaen) {
#ifdef DISK_DEBUG
if (dma_enable == 0)
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;
}
#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();
if (drv->catweasel)
drive_fill_bigbuf (drv, 1);
}
- drv->floppybitcounter = 0;
+ drv->floppybitcounter = 0;
}
dma_enable = (adkcon & 0x400) ? 0 : 1;
}
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);
else
disk_doupdate_read (drv, drv->floppybitcounter);
disk_doupdate_predict (drv, disk_hpos);
- drv->floppybitcounter %= drv->trackspeed;
+ drv->floppybitcounter %= drv->trackspeed;
break;
}
}
DISK_update (hpos);
if ((v & 0x8000) && (dsklen & 0x8000)) {
dskdmaen = 2;
- DISK_start ();
+ DISK_start ();
}
if (!(v & 0x8000)) {
if (dskdmaen) {
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;
#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);
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;
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;
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 */
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 */
} 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];
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;
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
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;
{
#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;
}
} 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;
}
} 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;
}
#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) {
}
#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;
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;
}
}
-/* 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 */
}
}
-/* 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)
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;
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;
}
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 ();
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. */
int i, maxline;
if (can_use_lores > AUTO_LORES_FRAMES && 0) {
- lores_factor = 1;
+ lores_factor = 1;
lores_shift = 0;
} else {
can_use_lores++;
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;
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;
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);
s->p = 0;
}
-static void processclicks(struct drvsample *ds)
+static void processclicks(struct drvsample *ds)
{
unsigned int n = 0;
unsigned int nClick = 0;
}
}
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];
}
}
}
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]) {
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++;
}
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)
}
}
-#endif
\ No newline at end of file
+#endif
#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
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);
}
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);
}
do_put_mem_word (m, w);
}
-
void REGPARAM2 chipmem_bput2 (uaecptr addr, uae_u32 b)
{
addr -= chipmem_start & chipmem_mask;
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);
{
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
#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
#include "cdtv.h"
#include "arcadia.h"
-#define MAX_EXPANSION_BOARDS 8
+#define MAX_EXPANSION_BOARDS 8
/* ********************************************************** */
/* 00 / 02 */
#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
{
/* 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();
z3fastmem_start = 0x10000000;
map_banks (&z3fastmem_bank, z3fastmem_start >> 16, currprefs.z3fastmem_size >> 16,
- allocated_z3fastmem);
+ allocated_z3fastmem);
}
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);
#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
}
#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) {
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;
z3fastmem = 0;
gfxmemory = 0;
filesysory = 0;
-#ifdef CATWEASEL
+#if defined(CATWEASEL)
catweasel_free ();
#endif
}
/*
- FDI to raw bit stream converter
- Copyright (c) 2001 by Toni Wilen <twilen@arabuusimiehet.com>
+ FDI to raw bit stream converter
+ Copyright (c) 2001 by Toni Wilen <twilen@arabuusimiehet.com>
FDI 2.0 support
- Copyright (c) 2003-2004 by Toni Wilen <twilen@arabuusimiehet.com>
- and Vincent Joguin
+ Copyright (c) 2003-2004 by Toni Wilen <twilen@arabuusimiehet.com>
+ 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
*/
#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 <assert.h>
{
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;
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;
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;
/* 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 {
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);
}
}
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);
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) {
//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) {
} else {
temp2 >>= 1;
if (!temp2) {
- temp2 = 0x80;
+ temp2 = 0x80;
temp = *stream++;
}
if (temp & temp2)
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);
}
}
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() */
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;
}
/* 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 */
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--;
}
}
/* 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--;
}
}
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--;
}
/* 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--;
}
/* 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++;
}
}
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;
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];
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++;
}
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;
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);
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 {
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 {
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;
}
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;
}
/* 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);
}
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);
} 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 */
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);
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 */
{
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 */
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];
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);
{
}
-typedef void (*decode_described_track_func)(FDI*);
+typedef void (*decode_described_track_func)(FDI*);
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)
{
switch (max_sector)
{
- case 9:
+ case 9:
gap3 = 40;
break;
case 10:
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)
{
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 */
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;
}
}
{
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;
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;
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
}
{
int off1 = bitoffset / 8;
int off2 = bitoffset % 8;
- p[off1] |= bit << (7 - off2);
+ p[off1] |= bit << (7 - off2);
bitoffset++;
}
};
-#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;
{
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 */
i--;
eodat = i;
adjust = 0;
- total = 0;
+ total = 0;
totaldiv = 0;
init_array(standard_MFM_2_bit_cell_size, 2);
bitoffset = 0;
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;
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 */
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)
{
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;
eodat = i;
i--;
adjust = 0;
- total = 0;
+ total = 0;
totaldiv = 0;
init_array(standard_MFM_2_bit_cell_size, 1 + mfm);
bitoffset = 0;
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;
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 */
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;
}
#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;
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;
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];
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;
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 */
{
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;
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;
weakbits++;
}
p2++;
- p1 += idx_off3;
+ p1 += idx_off3;
idxp[i] = sum;
}
len = totalavg / 100000;
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);
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;
}
return fdi->bit_rate;
}
-int fdi2raw_get_type (FDI *fdi)
+int fdi2raw_get_type (FDI *fdi)
{
return fdi->disk_type;
}
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;
}
*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;
}
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);
} 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)) {
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;
#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)
#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);
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)
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
#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
#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 */
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) {
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;
}
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);
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). */
}
} 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);
}
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;
}
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 ();
/* 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);
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) {
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);
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;
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;
}
uip->rdb_filesyssize = 0;
}
if (m68k_dreg (regs, 3) >= 0)
- uip->startup = get_long (devicenode + 28);
+ uip->startup = get_long (devicenode + 28);
return devicenode;
}
addfakefilesys (parmpacket, dostype);
return;
}
- fsnode = get_long (fsnode);
+ fsnode = get_long (fsnode);
}
tmp[0] = 0;
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);
zf = zfile_fopen (tmp,"rb");
if (!zf) {
write_log ("RDB: filesys not found\n");
- return;
+ return;
}
zfile_fseek (zf, 0, SEEK_END);
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);
}
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;
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)
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
return answer;
}
-STATIC_INLINE void set_fpsr (uae_u32 x)
+STATIC_INLINE void set_fpsr (uae_u32 x)
{
regs.fpsr = x;
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);
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;
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);
}
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);
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);
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++) {
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++) {
#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
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;
#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
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];
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;
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)
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;
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;
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 */
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 */
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);
*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) {
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);
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));
}
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;
}
}
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);
}
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);
}
int immediate_blits;
unsigned int chipset_mask;
int ntscmode;
+ int genlock;
int chipset_refreshrate;
int collision_level;
int leds_on_screen;
#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
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];
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++) {
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
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++;
}
}
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++)
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];
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];
} 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];
custom = NULL;
for (subnum = 0; subnum < MAX_INPUT_SUB_EVENT; subnum++) {
- xfree (custom);
+ xfree (custom);
custom = NULL;
p2 = getstring (&p);
if (!p2)
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);
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)
{
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)
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);
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;
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)
mouse_delta[i][2] = 0;
mouse_frame_x[i] = mouse_x[i];
mouse_frame_y[i] = mouse_y[i];
- }
+ }
}
}
}
if (input_read) {
input_vpos = vpos;
- input_read = 0;
+ input_read = 0;
}
}
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)
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;
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
*/
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))
}
/* 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
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;
}
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;
{
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));
} 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;
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;
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)
void inputdevice_reset (void)
{
- if (needmousehack ())
- mousehack_set (mousehack_dontcare);
- else
- mousehack_set (mousehack_normal);
ievent_alive = 0;
}
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;
}
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;
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) {
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);
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;
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;
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;
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;
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;
}
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;
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;
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]);
}
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]];
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);
}
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;
}
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;
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++;
}
}
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
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;
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 ();
}
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 */
do_fake (1);
return;
} else {
- if ((kc >> 1) == AK_RCTRL) {
+ if ((kc >> 1) == AK_RCTRL) {
kc ^= AK_RCTRL << 1;
kc ^= AK_CTRL << 1;
}
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
{
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) {
{
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;
}
}
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");
}
}
p = load_keyfile (&currprefs, NULL, &keysize);
if (!p) {
-#ifndef SINGLEFILE
+#ifndef SINGLEFILE
notify_user (NUMSG_NOROMKEY);
#endif
return 0;
return rd;
}
-void getromname (struct romdata *rd, char *name)
+void getromname (struct romdata *rd, char *name)
{
name[0] = 0;
if (rd->type == ROMTYPE_ARCADIA)
}
#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;
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)
{
#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;
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;
}
}
}
}
}
- return kickmem_xlate (0); /* So we don't crash. */
+ return kickmem_xlate (0); /* So we don't crash. */
}
/* Address banks */
cksum++;
prevck = cksum;
}
-#ifndef SINGLEFILE
+#ifndef SINGLEFILE
if (cksum != 0xFFFFFFFFul)
notify_user (NUMSG_KSROMCRCERROR);
#endif
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;
}
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++;
}
j++;
}
- }
+ }
}
}
return patched;
#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);
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
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)
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) {
notify_user (NUMSG_NOROM);
}
#ifdef AUTOCONFIG
- init_ersatz_rom (kickmemory);
+ init_ersatz_rom (kickmemory);
ersatzkickfile = 1;
#else
uae_restart (-1, NULL);
/* 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
memcpy (currprefs.cartfile, changed_prefs.cartfile, sizeof currprefs.cartfile);
arcadia_unmap ();
}
- arcadia_map_banks ();
+ arcadia_map_banks ();
}
#endif
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);
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;
#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++) {
}
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)
#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;
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);
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;
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);
}
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;
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);
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;
}
} 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);
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;
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();
}
if (opcode == 0x4E7B && in_rom (pc) && get_long (0x10) == 0) {
- notify_user (NUMSG_KS68020);
+ notify_user (NUMSG_KS68020);
uae_restart (-1, NULL);
}
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);
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);
{
/*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())
#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);
}
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)) {
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);
#endif
lvpos = vpos;
if (sleepcnt < 0) {
- sleepcnt = IDLETIME / 2;
+ sleepcnt = IDLETIME / 2;
sleep_millis (1);
}
}
#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);
}
cycles = (*cpufunctbl[opcode])(opcode);
cycles &= cycles_mask;
cycles |= cycles_val;
- do_cycles (cycles);
+ do_cycles (cycles);
if (regs.spcflags) {
if (do_specialties (cycles))
return;
}
#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]++;
/*n_insns++;*/
cycles &= cycles_mask;
cycles |= cycles_val;
- do_cycles (cycles);
+ do_cycles (cycles);
if (regs.spcflags) {
if (do_specialties (cycles))
return;
: : "r" (func) : "%eax", "%edx", "%ecx", "memory", "cc");
}
#else
-#define m68k_run1(F) (F) ()
+#define m68k_run1(F) (F) ()
#endif
int in_m68k_go = 0;
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 ();
handle_active_events ();
if (regs.spcflags)
do_specialties (0);
- m68k_setpc (regs.pc);
+ m68k_setpc (regs.pc);
}
#ifdef DEBUGGER
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");
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++);
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;
}
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)
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");
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);
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 */
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;
}
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;
}
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
#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 );
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)
{
free(ahisndbuffer);
}
-void ahi_updatesound( int force )
+void ahi_updatesound(int force)
{
HRESULT hr;
int i;
/* 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;
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;
p2[i + 1] = p1[i + 0];
}
} else {
- memcpy(dwData1,ahisndbuffer,dwBytes1);
+ memcpy(dwData1,ahisndbuffer,dwBytes1);
}
sndptrmax = ahisndbuffer+ahisndbufsize;
DSCBUFFERDESC sound_buffer_rec;
if (lpDS2)
- return 0;
+ return 0;
enumerate_sound_devices (0);
wavfmt.wFormatTag = WAVE_FORMAT_PCM;
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 );
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);
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;
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];
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;
}
*/
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;
//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
// 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;
todo=cur_pos+(RECORDBUFFER*t)-cap_pos;
if (todo<t)
{ //if no complete buffer ready exit
- return -1;
+ return -1;
}
i = IDirectSoundCaptureBuffer_Lock(lpDSB2r,cap_pos,t,&pos1,&byte1,&pos2,&byte2,0);
addr=(char *)m68k_areg (regs, 0);
sndbufrecpt=(unsigned int*)pos1;
t=t/4;
- for (i=0;i<t;i++)
+ for (i=0;i<t;i++)
{
- put_long((uae_u32)addr,sndbufrecpt[0]);
+ put_long((uae_u32)addr,sndbufrecpt[0]);
addr+=4;
sndbufrecpt+=1;
}
return i;
case 5:
- if ( !ahi_on )
+ if ( !ahi_on )
return 0;
ahi_updatesound ( 1 );
- return 1;
+ return 1;
case 10:
i=OpenClipboard(0);
- clipdat=GetClipboardData(CF_TEXT);
+ clipdat=GetClipboardData(CF_TEXT);
if (clipdat)
{
clipsize=strlen(clipdat);
clipsize++;
return clipsize;
}
- return 0;
+ return 0;
case 11:
addr=(char *)m68k_areg (regs, 0);
- for (i=0;i<clipsize;i++)
+ for (i=0;i<clipsize;i++)
{
- put_byte((uae_u32)addr,clipdat[0]);
+ put_byte((uae_u32)addr,clipdat[0]);
addr++;
clipdat++;
}
case 12:
addr = (char *)m68k_areg (regs, 0);
- addr = (char *)get_real_address ((uae_u32)addr);
- i = OpenClipboard (0);
+ addr = (char *)get_real_address ((uae_u32)addr);
+ i = OpenClipboard (0);
EmptyClipboard();
- slen = strlen(addr);
+ slen = strlen(addr);
p = GlobalAlloc (GMEM_DDESHARE,slen+2);
p2 = GlobalLock (p);
- memcpy (p2,addr,slen);
+ memcpy (p2,addr,slen);
p2[slen]=0;
GlobalUnlock (p);
i = (int)SetClipboardData (CF_TEXT,p2);
case 25:
flushprinter ();
return 0;
-
+
#if defined(X86_MSVC_ASSEMBLY)
case 100: // open dll
num_vars = m68k_dreg(regs, 1);
if (bswap_buffer_size < num_vars * 2) {
- bswap_buffer_size = (num_vars + 1024) * 2;
- free(bswap_buffer);
+ bswap_buffer_size = (num_vars + 1024) * 2;
+ free(bswap_buffer);
bswap_buffer = (void*)malloc(bswap_buffer_size);
}
__asm {
add esi, 2
add edi, 2
loopne BSWAP_WORD_LOOP
-
+
BSWAP_WORD_4X:
mov ecx, ebx
shr ecx, 2
loopne BSWAP_WORD_4X_LOOP
BSWAP_WORD_END:
}
- return (uae_u32) bswap_buffer;
+ return (uae_u32) bswap_buffer;
case 107: //byteswap 32bit vars - see case 106
//a0 = start address
src = m68k_areg(regs, 0);
num_vars = m68k_dreg(regs, 1);
if (bswap_buffer_size < num_vars * 4) {
- bswap_buffer_size = (num_vars + 16384) * 4;
+ bswap_buffer_size = (num_vars + 16384) * 4;
free(bswap_buffer);
bswap_buffer = (void*)malloc(bswap_buffer_size);
}
mov ebx, ecx
and ecx, 3
je BSWAP_DWORD_4X
-
+
BSWAP_DWORD_LOOP:
mov eax, [esi]
bswap eax
add esi, 4
add edi, 4
loopne BSWAP_DWORD_LOOP
-
+
BSWAP_DWORD_4X:
mov ecx, ebx
shr ecx, 2
add esi, 16
add edi, 16
loopne BSWAP_DWORD_4X_LOOP
-
+
BSWAP_DWORD_END:
}
return (uae_u32) bswap_buffer;
bswap_buffer_size = 0;
free(bswap_buffer);
bswap_buffer = NULL;
- return 0;
+ return 0;
#endif
case 200:
case WAVE_FORMAT_IMA_ADPCM: // 0x0011 Intel Corporation
case WAVE_FORMAT_GSM610: // 0x0031 Microsoft Corporation
case WAVE_FORMAT_SONY_SCX: // 0x0270 Sony Corp.
- return TRUE;
+ return TRUE;
}
break;
}
}
-
+
return FALSE;
}
free(lpAudio);
lpAudio = NULL;
}
-
+
if(pwfxDst)
{
free(pwfxDst);
free(pcompvars);
pcompvars = NULL;
}
-
+
if(lpbi)
{
free(lpbi);
lpbi = NULL;
}
-
+
if(lpVideo)
{
free(lpVideo);
{
DWORD wfxMaxFmtSize;
MMRESULT err;
-
+
AVIOutput_ReleaseAudio();
-
+
if((err = acmMetrics(NULL, ACM_METRIC_MAX_SIZE_FORMAT, &wfxMaxFmtSize)))
{
gui_message("acmMetrics() FAILED (%X)\n", err);
return NULL;
}
-
+
// set the source format
wfxSrc.wFormatTag = WAVE_FORMAT_PCM;
wfxSrc.nChannels = workprefs.sound_stereo ? 2 : 1;
if(!(pwfxDst = (LPWAVEFORMATEX) malloc(wfxMaxFmtSize)))
return NULL;
-
+
// set the initial destination format to match source
memset(pwfxDst, 0, wfxMaxFmtSize);
memcpy(pwfxDst, &wfxSrc, sizeof(WAVEFORMATEX));
pwfxDst->cbSize = (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);
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;
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',' '))
return string;
}
}
-
+
return NULL;
}
{
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;
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)
}
checkAVIsize (0);
}
-
+
LeaveCriticalSection(&AVIOutput_CriticalSection);
return;
-
+
error:
-
LeaveCriticalSection(&AVIOutput_CriticalSection);
AVIOutput_End();
}
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);
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;
((uae_u32*)dst)[x] = v;
}
}
- src += gfxvidinfo.rowbytes;
+ src += gfxvidinfo.rowbytes;
}
return 1;
}
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 ())
else
v = getFromBuffer((LPBITMAPINFO)lpbi);
#else
- v = getFromDC((LPBITMAPINFO)lpbi);
+ v = getFromDC((LPBITMAPINFO)lpbi);
#endif
if (!v)
goto error;
{
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;
}
}
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;
}
if ((frame_count % (avioutput_fps * 10)) == 0)
write_log ("AVIOutput: %d frames, (%d fps)\n", frame_count, avioutput_fps);
return;
-
+
error:
LeaveCriticalSection(&AVIOutput_CriticalSection);
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);
fclose (wavfile);
wavfile = 0;
}
-
-
+
LeaveCriticalSection(&AVIOutput_CriticalSection);
}
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);
//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
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)
{
}
write_log ("AVIOutput enabled: video=%d audio=%d\n", avioutput_video, avioutput_audio);
return;
-
+
error:
-
AVIOutput_End();
}
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();
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;
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;
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;
*/
if (hAspiLib == NULL) {
write_log ("ASPI: failed to load wnaspi32.dll\n");
- return FALSE;
+ return FALSE;
}
/*
* Get a pointer to GetASPI32SupportInfo function
if ((pfnGetASPI32SupportInfo == NULL) || (pfnSendASPI32Command == NULL)) {
write_log ("ASPI: obsolete wnaspi32.dll found\n");
- return FALSE;
+ return FALSE;
}
pfnGetASPI32Buffer = (BOOL(*)(PASPI32BUFF))GetProcAddress(hAspiLib, "GetASPI32Buffer");
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;
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;
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;
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);
}
scgp = (SCSI *)malloc(sizeof(*scgp));
if (scgp == NULL)
- return 0;
+ return 0;
memset (scgp, 0, sizeof (*scgp));
scgp->deftimeout = 20;
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;
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;
* 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));
* More than we have ...
*/
if (busno >= busses) {
- close_driver ();
+ close_driver ();
return 0;
}
return scgp;
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));
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
*/
* 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
/*
* 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?
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);
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 */
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 */
scmd->cdb.g0_cdb.count = cnt;
scgp->scmd->timeout = 10 * 60;
if (scsicmd(scgp))
- return -1;
+ return -1;
return 0;
}
if(cp->error != SCG_NO_ERROR ||
cp->ux_errno != 0 || *(u_char *)&cp->scb != 0)
- return -1;
+ return -1;
return 0;
}
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);
}
write_log ("\n");
}
- }
- }
+ }
+ }
}
write_log ("ASPI: SCSI scan ended\n");
scanphase = 0;
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;
/* 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);
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;
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);
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;
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)
continue;
return 0;
}
- reseterrormode ();
+ reseterrormode ();
break;
}
cnt = 3;
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;
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;
}
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;
}
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;
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);
/* 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);
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;
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);
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;
}
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)
#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
#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) */
}
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)
unlocksigqueue();
}
-static unsigned int allocasyncmsg(SB,uae_u32 sd,SOCKET s)
+static unsigned int allocasyncmsg(SB,uae_u32 sd,SOCKET s)
{
int i;
locksigqueue();
}
void sockabort(SB)
-{
+{
locksigqueue();
unlocksigqueue();
s2 = getsock(sb,fd2);
if (s2 != INVALID_SOCKET)
{
- shutdown(s2,1);
+ shutdown(s2,1);
closesocket(s2);
}
setsd(sb,fd2,s1);
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));
{
if (protocol==IPPROTO_UDP)
{
- sb->ftable[sd-1] |= SF_RAW_UDP;
+ sb->ftable[sd-1] |= SF_RAW_UDP;
}
if (protocol==IPPROTO_ICMP)
{
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;
}
{
SOCKET s;
uae_u32 success = -1;
-
+
sd++;
TRACE(("listen(%d,%d) -> ",sd,backlog));
s = getsock(sb, sd);
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;
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;
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 )
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 );
}
static unsigned int __stdcall sock_thread(void *blah)
{
unsigned int result = 0;
- HANDLE WaitHandle;
+ HANDLE WaitHandle;
MSG msg;
if( hSockWnd )
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++;
}
}
}
write_log( "BSDSOCK: We have exited our sock_thread()\n" );
-#ifndef __GNUC__
- _endthreadex( result );
-#endif
+ THREADEND(result);
return result;
}
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));
}
char *realpt;
unsigned int wMsg;
char buf[MAXADDRLEN];
- int iCut;
+ int iCut;
#ifdef TRACING_ENABLED
if (to)
if (s != INVALID_SOCKET)
{
- realpt = get_real_address(msg);
+ realpt = get_real_address(msg);
if (to)
{
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;
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;
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)
return 0;
}
}
-
+
return -1;
}
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)
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;
}
{
switch (request)
{
- case FIOSETOWN:
+ case FIOSETOWN:
sb->ownertask = get_long(arg);
success = 0;
break;
{
unsigned int wMsg;
SOCKET s;
-
+
TRACE(("CloseSocket(%d) -> ",sd));
sd++;
for (;;)
{
- shutdown(s,1);
+ shutdown(s,1);
if (!closesocket(s))
{
releasesock(sb,sd);
else break;
}
- ENDBLOCKING;
+ ENDBLOCKING;
}
-
+
TRACE(("failed (%d)\n",sb->sb_errno));
return -1;
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);
}
}
else
{
- sb->needAbort = 0;
+ sb->needAbort = 0;
}
if (sb->resultval == SOCKET_ERROR)
{
SetEvent(sb->hEvent);
}
}
-#ifndef __GNUC__
- _endthreadex( result );
-#endif
+ THREADEND(result);
return result;
}
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;
}
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)
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)
{
{
TRACE(("%d errno %d\n",sb->resultval,sb->sb_errno));
}
- }
+ }
else TRACE(("%d\n",sb->resultval));
}
}
}
}
-#ifndef __GNUC__
- _endthreadex( result );
-#endif
+ THREADEND(result);
return result;
}
-
void host_gethostbynameaddr(SB, uae_u32 name, uae_u32 namelen, long addrtype)
{
HOSTENT *h;
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);
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)
{
if (sb->protoent)
{
- uae_FreeMem( sb->protoent, sb->protoentsize );
+ uae_FreeMem( sb->protoent, sb->protoentsize );
}
sb->protoent = uae_AllocMem( size, 0 );
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)
{
}
-
-
uae_u32 host_gethostname(uae_u32 name, uae_u32 namelen)
{
return gethostname(get_real_address(name),namelen);
notify_user (NUMSG_OLDCAPS);
noticed = 1;
return 0;
- }
+ }
pCAPSInit = (CAPSINIT)GetProcAddress (h, "CAPSInit");
pCAPSAddImage = (CAPSADDIMAGE)GetProcAddress (h, "CAPSAddImage");
pCAPSLockImageMemory = (CAPSLOCKIMAGEMEMORY)GetProcAddress (h, "CAPSLockImageMemory");
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;
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";
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)
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)
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;
#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
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;
} else if (did->acquired && hr == DIERR_NOTACQUIRED) {
acquire (lpdi, "mouse");
}
- IDirectInputDevice8_Poll (lpdi);
+ IDirectInputDevice8_Poll (lpdi);
}
}
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;
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)
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) {
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;
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;
}
-static int keyhack (int scancode,int pressed, int num)
+static int keyhack (int scancode,int pressed, int num)
{
static byte backslashstate,apostrophstate;
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)
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) {
superkb++;
else
normalkb++;
- di_keyboard[num].acquired = 1;
+ di_keyboard[num].acquired = 1;
}
return di_keyboard[num].acquired > 0 ? 1 : 0;
}
superkb--;
else
normalkb--;
- di_keyboard[num].acquired = 0;
+ di_keyboard[num].acquired = 0;
}
release_keys ();
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++) {
#endif
setjoystickstate (i, k, data, 32768);
}
- break;
+ break;
}
}
}
} else if (did->acquired && hr == DIERR_NOTACQUIRED) {
acquire (lpdi, "joystick");
}
- IDirectInputDevice8_Poll (lpdi);
+ IDirectInputDevice8_Poll (lpdi);
}
#if 0
{
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);
}
}
}
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;
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;
switch (currprefs.gfx_filter_filtermode & 1)
{
- case 0:
+ case 0:
v = D3DTEXF_POINT;
break;
- case 1:
- default:
+ case 1:
+ default:
v = D3DTEXF_LINEAR;
break;
}
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;
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);
}
}
}
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");
}
}
}
-
+
ret = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, ahwnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING, &dpp, &d3ddev);
if(FAILED(ret)) {
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
} 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;
// 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)
}
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;
}
{
switch (depth)
{
- case 32:
- *rb = 8;
+ case 32:
+ *rb = 8;
*gb = 8;
*bb = 8;
*ab = 8;
*as = 24;
*a = 255;
break;
- case 15:
- case 16:
- *rb = 5;
+ case 15:
+ case 16:
+ *rb = 5;
*gb = 5;
*bb = 5;
*ab = 1;
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;
#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;
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;
}
}
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;
}
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;
/* 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;
}
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;
}
}
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;
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;
}
* 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
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;
* 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
HRESULT ddrval;
ddrval = IDirectDraw7_SetDisplayMode( DirectDrawState.directdraw.dd,
- width, height, bits, freq, 0 );
+ width, height, bits, freq, 0 );
DirectDrawState.modeset = 1;
return ddrval;
}
/* 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;
}
HRESULT ddrval;
ddrval = IDirectDraw7_GetCaps( DirectDrawState.directdraw.dd,
- driver_caps, hel_caps );
+ driver_caps, hel_caps );
return ddrval;
}
{
HRESULT ddrval;
ddrval = IDirectDraw7_CreateClipper( DirectDrawState.directdraw.dd,
- 0,
- &DirectDrawState.lpDDC,
- NULL );
+ 0, &DirectDrawState.lpDDC, NULL );
return ddrval;
}
// 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
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);
}
} 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));
// 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:
{
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;
}
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;
}
{
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;
}
{
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;
}
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;
}
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 );
}
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;
}
} 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;
return 1;
}
if(SUCCEEDED(ddrval)) {
- result = 1;
+ result = 1;
} else {
if (ddrval == DDERR_SURFACELOST) {
static int recurse;
*
*/
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;
}
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
{
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 )
{
{
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;
}
{
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;
}
#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
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) {
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;
/* 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 */
/* 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);
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;
}
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;
}
}
return 0;
}
__try {
- initialized = pInitializeWinIo();
+ initialized = pInitializeWinIo();
} __except (EXCEPTION_EXECUTE_HANDLER) {
- initialized = 0;
+ initialized = 0;
}
#else
initialized = 1;
if (initialized) {
pShutdownWinIo();
FreeLibrary (ioh);
- io_log ("io freed\n");
+ io_log ("io freed\n");
}
#endif
initialized = 0;
if (para) {
if (pport)
pp_closeport (pport);
- pport = 0;
+ pport = 0;
FreeLibrary (para);
para = 0;
}
{ 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 }
};
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;
}
#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);
if (ctrlpressed ()) {
code = AKS_TOGGLEFULLSCREEN;
} else if (shiftpressed () || endpressed ()) {
- disablecapture ();
+ disablecapture ();
code = AKS_ENTERDEBUGGER;
} else {
code = AKS_ENTERGUI;
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
}
return;
if (currprefs.mmkeyboard)
- sendmmcodes(scancode, newstate);
+ sendmmcodes(scancode, newstate);
}
void keyboard_settrans (void)
//#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;
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 );
}
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;
}
/*
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;
}
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 );
}
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;
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
{
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));
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)
{
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;
}
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
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);
}
result=midiInPrepareHeader(inHandle,&midiin[i], sizeof(MIDIHDR));
result=midiInAddBuffer(inHandle,&midiin[i],sizeof(MIDIHDR));
}
- }
+ }
}
midi_ready = TRUE;
result = 1;
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 )
//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<MIDI_INBUFFERS;i++)
{
natmem_offset = blah;
} else {
VirtualFree(blah, 0, MEM_RELEASE);
- while (address < (LPBYTE)0xa0000000) {
+ while (address < (LPBYTE)0xa0000000) {
blah = VirtualAlloc(address, size + add, MEM_RESERVE, PAGE_EXECUTE_READWRITE);
if (blah == NULL) {
address += inc;
}
while (memstats.dwAvailPageFile + memstats.dwAvailPhys < max_z3fastmem)
- max_z3fastmem <<= 1;
+ max_z3fastmem <<= 1;
write_log("Max Z3FastRAM %dM\n", max_z3fastmem >> 20);
}
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;
if(!strcmp(shmids[shmid].name,"z3")) {
shmaddr=natmem_offset+0x10000000;
if (allocated_z3fastmem<0x1000000)
- gfxoffs=0x1000000;
+ gfxoffs=0x1000000;
else
gfxoffs=allocated_z3fastmem;
got = TRUE;
{
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;
}
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;
}
#else
int result = 0;
#endif
-
return result;
}
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++);
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];
}
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;
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);
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 ();
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;
}
closeprinter();
}
-void closeprinter( void )
+void closeprinter( void )
{
#ifdef PRINT_DUMP
zfile_fclose (prtdump);
if (!prtopen)
openprinter ();
if (prtopen)
- putprinter (val);
+ putprinter (val);
return prtopen;
}
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;
hCom = INVALID_HANDLE_VALUE;
}
if (midi_ready)
- Midi_Close();
+ Midi_Close();
if( writeevent )
CloseHandle( writeevent );
writeevent = 0;
{
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;
}
}
if (midi_ready)
{
BYTE outchar = (BYTE)c;
- Midi_Parse( midi_output, &outchar );
+ Midi_Parse( midi_output, &outchar );
}
else
{
if (midi_ready) {
return 1;
} else {
- outser ();
+ outser ();
if (datainoutput >= sizeof (outputbuffer) - 1)
return 0;
}
*buffer = inputbuffer[dataininputcnt++];
return 1;
}
- dataininput = 0;
+ dataininput = 0;
dataininputcnt = 0;
if (hCom != INVALID_HANDLE_VALUE)
{
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;
}
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);
{
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;
}
keycheck++;
if(keycheck==1000)
{
- flushprtbuf ();
- {
+ flushprtbuf ();
+ {
#if defined(AHI)
extern flashscreen;
int DX_Fill( int , int , int, int, uae_u32 , enum RGBFTYPE );
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;
}
* 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
#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
#endif
}
-#ifdef P96TRACING_ENABLED
+#ifdef P96TRACING_ENABLED
/*
* Debugging dumps
*/
}
}
-v
-
static char binary_byte[9] = { 0,0,0,0,0,0,0,0,0 };
static char *BuildBinaryString (uae_u8 value)
* 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();
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]];
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
}
/*
* 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;
flushpixels();
#endif
//PICASSO96_Lock();
-#endif
+#endif
/* Is our x/y origin on-screen? */
if( dsty >= picasso_vidinfo.height )
return;
// 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;
if (! picasso_vidinfo.extra_mem)
{
#ifdef LOCK_UNLOCK_MADNESS
- goto out;
+ goto out;
#else
return;
- #endif
+ #endif
}
#ifdef LOCK_UNLOCK_MADNESS
#endif
if (dstp == 0)
{
- write_log ("WARNING: do_blit() couldn't lock\n");
+ write_log ("WARNING: do_blit() couldn't lock\n");
goto out;
}
* 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]];
default:
write_log ("ERROR - do_blit() calling abort 2!\n");
abort ();
- break;
+ break;
}
srcp += ri->BytesPerRow;
dstp += picasso_vidinfo.rowbytes;
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;
static void wgfx_do_flushline (void)
{
uae_u8 *src, *dstp;
-
+
/* Mark these lines as "dirty" */
DX_Invalidate (wgfx_y, wgfx_y);
#ifdef LOCK_UNLOCK_MADNESS
dstp = picasso96_state.HostAddress;
-
+
#else
dstp = gfx_lock_picasso ();
#endif
#ifndef LOCK_UNLOCK_MADNESS
gfx_unlock_picasso ();
#endif
-
+
wgfx_linestart = 0xFFFFFFFF;
}
{
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++)
{
*(uae_u16 *)(start) = (Pen & 0x00FFFF00) >> 8;
start+=2;
}
- break;
+ break;
case 4:
for (cols = 0; cols < Width; cols++)
{
do_put_mem_long ((uae_u32 *)start, Pen);
start += 4;
}
- break;
+ break;
}
src = oldstart;
dst = src + ri->BytesPerRow;
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) {
{
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)
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 */
} /* 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)
{
#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
{
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;
* 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)
/*
* 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
write_log ("SetSwitch() - trying to show %s screen\n", flag ? "picasso96":"amiga");
/* Put old switch-state in D0 */
-
+
return !flag;
}
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;
}
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)
{
/***********************************************************
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)
{
//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 */
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 );
/***********************************************************
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
***********************************************************/
/***********************************************************
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)
{
#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));
#ifdef LOCK_UNLOCK_MADNESS
//PICASSO96_Unlock();
-
+
#else
wgfx_flushline ();
#endif
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);
bitoffset = tmp.XOffset % 8;
-#if defined( P96TRACING_ENABLED ) && ( P96TRACING_LEVEL > 0 )
+#if defined( P96TRACING_ENABLED ) && ( P96TRACING_LEVEL > 0 )
DumpTemplate(&tmp, W, H);
#endif
/*
* 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.
/*
* 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
}
if (p96hsync <= 0) {
rtarea[get_long (RTAREA_BASE + 36) + 12 - 1]++;
- p96hsync = p96syncrate;
+ p96hsync = p96syncrate;
}
}
else
rate = abs (currprefs.gfx_refreshrate);
if (rate <= 0)
- rate = 60;
+ rate = 60;
p96syncrate /= rate;
}
#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);
long eol_offset;
if( !bpp )
- return;
+ return;
/* Set up our bm->Planes[] pointers to the right horizontal offset */
for (j = 0; j < Depth; j++) {
#ifdef LOCK_UNLOCK_MADNESS
//PICASSO96_Unlock();
-#else
+#else
wgfx_flushline ();
#endif
if (pixelcount==0)return;
if (!picasso_on) {
- pixelcount=0;
+ pixelcount=0;
return;
}
xmaxaddr=0;
// +(picasso96_state.YOffset*picasso96_state.BytesPerRow);
DX_Invalidate (0,4000);
-#ifndef _DEBUG
+#ifndef _DEBUG
if(DirectDraw_IsLocked()==FALSE) {
dst = gfx_lock_picasso ();
lock=1;
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;
}
next:; }
-out:;if(lock)gfx_unlock_picasso ();
+out:;if(lock)gfx_unlock_picasso ();
pixelcount=0;
}
#endif
return;
#endif
#endif
-
+
if (!picasso_on)
return;
if (xbytes < (picasso96_state.Width*picasso96_state.BytesPerPixel) && y < picasso96_state.Height)
{
-
+
dst = picasso96_state.HostAddress;
//dst = gfx_lock_picasso ();
if (dst) {
pixelbase[pixelcount++].size=2;
}
return;
-#endif
+#endif
#endif
if (!picasso_on)
return;
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)
{
addr &= gfxmem_mask;
m = (uae_u32 *)(gfxmemory + addr);
-/* //only write difference
+/* //only write difference
__asm {
mov eax,m
mov eax,[eax]
}
if (!m) return;
*/
-#ifdef SWAPSPEEDUP
+#ifdef SWAPSPEEDUP
*m=l;
#else
do_put_mem_long(m, l);
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
#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
"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
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
BOTTOMMARGIN, 212
END
- IDD_FILESYS, DIALOG
- BEGIN
- RIGHTMARGIN, 229
- END
-
IDD_INPUT, DIALOG
BEGIN
BOTTOMMARGIN, 187
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)
{
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
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");
}
clockrate = qpfrate;
clockrate1000 = clockrate / 1000.0;
if (dummythread_die < 0) {
- dummythread_die = 0;
+ dummythread_die = 0;
_beginthread(&dummythread, 0, 0);
}
if (!qpc_avail)
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 ();
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);
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);
}
}
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);
}
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;
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);
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)
break;
case WM_CLOSE:
- uae_quit ();
+ uae_quit ();
return 0;
case WM_WINDOWPOSCHANGED:
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);
}
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;
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 */
if (!gui_active)
systraymenu (hWnd);
else
- SetForegroundWindow (hWnd);
+ SetForegroundWindow (hWnd);
break;
}
break;
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,
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--;
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;
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;
FreeLibrary(hRichEdit);
if (hHtmlHelp)
- FreeLibrary(hHtmlHelp);
+ FreeLibrary(hHtmlHelp);
if (hUIDLL)
FreeLibrary(hUIDLL);
{
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;
}
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);
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);
}
}
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)
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;
p->win32_alwaysontop = 0;
}
if (type == 1 || type == 0) {
- p->win32_midioutdev = -2;
+ p->win32_midioutdev = -2;
p->win32_midiindev = 0;
}
}
{
int i = 0;
while (priorities[i].name) {
- if (priorities[i].value == pri)
+ if (priorities[i].value == pri)
return i;
- i++;
+ i++;
}
return defpri;
}
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)
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);
}
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);
// 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 */
{
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) {
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;
// 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;
}
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;
}
}
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, "\\");
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)
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);
}
}
}
-#ifndef _DEBUG
+#ifndef _DEBUG
if (lRet == EXCEPTION_CONTINUE_SEARCH) {
char path[MAX_DPATH];
char path2[MAX_DPATH];
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);
HMODULE m = NULL;
char *newname;
DWORD err = -1;
+#ifdef CPU_64_BIT
char *p;
+#endif
int round;
newname = xmalloc(strlen(name) + 1 + 10);
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
}
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;
{
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;
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))
}
if (dd) {
- ddrval = DirectDraw_CreateClipper();
- if (FAILED(ddrval)) {
+ ddrval = DirectDraw_CreateClipper();
+ if (FAILED(ddrval)) {
write_log( "set_ddraw: No clipping support\n" );
goto oops;
}
overlay = 0;
}
- DirectDraw_ClearSurfaces();
+ DirectDraw_ClearSurfaces();
if (!DirectDraw_DetermineLocking (dxfullscreen))
{
goto oops;
}
- if (bits == 8) {
+ if (bits == 8) {
ddrval = DirectDraw_CreatePalette (currentmode->pal);
if (FAILED(ddrval))
{
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);
}
*/
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;
}
}
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())) {
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;
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))
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 ();
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];
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;
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;
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);
} 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);
}
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);
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() )
lockscr();
}
}
- p96_double_buffer_needs_flushing = 0;
+ p96_double_buffer_needs_flushing = 0;
}
}
if (hMainWnd)
systray (hMainWnd, TRUE);
if (hStatusWnd) {
- ShowWindow (hStatusWnd, SW_HIDE);
- DestroyWindow (hStatusWnd);
+ ShowWindow (hStatusWnd, SW_HIDE);
+ DestroyWindow (hStatusWnd);
}
if (hAmigaWnd) {
#ifdef OPENGL
hAmigaWnd = 0;
}
if (hMainWnd) {
- ShowWindow (hMainWnd, SW_HIDE);
+ ShowWindow (hMainWnd, SW_HIDE);
DestroyWindow (hMainWnd);
}
hMainWnd = 0;
#ifdef PICASSO96
}
#endif
- currentmode->amiga_width = currentmode->current_width;
+ currentmode->amiga_width = currentmode->current_width;
currentmode->amiga_height = currentmode->current_height;
}
ret = doInit ();
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
}
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 ||
}
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 ||
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;
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;
#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;
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
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;
/* 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;
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 );
* 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));
}
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];
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;
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--;
rc.left = 1;
else
rc.left = stored_x;
-
+
if (stored_y > GetSystemMetrics (SM_CYVIRTUALSCREEN))
rc.top = 1;
else
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,
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);
}
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];
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
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()) {
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;
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 ) &&
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;
goto oops;
}
if (! create_windows ())
- goto oops;
+ goto oops;
#ifdef PICASSO96
if (screen_is_picasso) {
currentmode->pal = (LPPALETTEENTRY) & picasso96_state.CLUT;
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) {
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;
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 {
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();
return D3D_getDC (0);
#endif
if(FAILED(DirectDraw_GetDC(&hdc, DirectDraw_GetLockableType())))
- hdc = 0;
+ hdc = 0;
return hdc;
}
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
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;
}
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++;
}
fetch_path ("ConfigurationPath", tmp2, sizeof (tmp2));
strcat (tmp2, tmp1);
v = i;
- cfgfile_load (p, tmp2, &v, 1);
+ cfgfile_load (p, tmp2, &v, 1);
}
}
}
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();
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 */
akiko_exitgui ();
#endif
if (flipflop >= 0)
- setmouseactive (1);
+ setmouseactive (1);
#ifdef D3D
D3D_guimode (FALSE);
#endif
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 );
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);
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;
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;
nextp += strlen (nextp) + 1;
}
switch (wParam)
- {
+ {
case IDC_PATH_NAME:
case IDC_PATH_FILESYS:
if (flag == 8) {
}
}
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;
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;
} 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;
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;
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);
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;
}
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 */
if (mbytes <= 0)
mbytes = 0;
if( !Translated )
- mbytes = 0;
+ mbytes = 0;
return mbytes;
}
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);
if (!stricmp (config->Name, CONFIG_HARDWARE))
config->hardware = 1;
child = GetConfigs (config, usedirs, level);
- (*level)--;
+ (*level)--;
if (child)
config->Child = child;
ok = 1;
} 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);
}
}
if (!ok) {
- FreeConfigStruct (config);
- config = NULL;
+ FreeConfigStruct (config);
+ config = NULL;
}
}
if (config) {
}
GetDlgItemText (hDlg, IDC_EDITDESCRIPTION, desc, MAX_DPATH);
if (config) {
- strcpy (path, config->Fullpath);
+ strcpy (path, config->Fullpath);
} else {
fetch_configurationpath (path, sizeof (path));
}
cfgfile_save (&workprefs, path, configtypepanel);
}
break;
-
+
case CONFIG_LOAD:
if (strlen (name) == 0) {
char szMessage[ MAX_DPATH ];
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;
}
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);
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
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;
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;
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)
{
while (j > 0) {
if ((tmp2[j - 1] == '\\' || tmp2[j - 1] == '/')) {
if (!(j >= 5 && (tmp2[j - 5] == '.' || tmp2[j - 4] == '.')))
- break;
+ break;
}
j--;
}
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 );
}
}
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;
}
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)"");
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)))
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;
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;
}
}
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);
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;
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) {
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;
}
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);
}
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);
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;
}
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" );
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)
// 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;
}
}
strcat (tmp, "\\");
if (!scan_roms (tmp))
gui_message_id (IDS_ROMSCANNOROMS);
- set_path ("KickstartPath", tmp);
+ set_path ("KickstartPath", tmp);
values_to_pathsdialog (hDlg);
}
break;
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)
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;
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;
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;
}
}
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);
}
for( i = 0; urls[i].id >= 0; i++ )
{
- SetupRichText( hDlg, &urls[i] );
+ SetupRichText( hDlg, &urls[i] );
}
}
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);
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;
}
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;
}
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;
}
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
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);
}
}
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
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++;
}
}
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);
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;
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);
}
workprefs.gfx_refreshrate = 0;
} else {
posn1--;
- workprefs.gfx_refreshrate = storedrefreshrates[posn1];
+ workprefs.gfx_refreshrate = storedrefreshrates[posn1];
}
values_to_displaydlg (hDlg);
#if 0
values_to_displaydlg (hDlg);
enable_for_displaydlg (hDlg);
recursive--;
- break;
+ break;
case WM_HSCROLL:
case WM_COMMAND:
}
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--;
}
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);
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) {
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:
values_to_chipsetdlg (hDlg);
enable_for_chipsetdlg (hDlg);
recursive--;
- break;
+ break;
case WM_HSCROLL:
case WM_COMMAND:
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)]];
fix_values_memorydlg ();
values_to_memorydlg (hDlg);
enable_for_memorydlg (hDlg);
- break;
+ break;
case WM_COMMAND:
if (recursive > 0)
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);
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);
}
}
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);
}
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);
}
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);
}
recursive--;
- break;
+ break;
}
return FALSE;
}
{
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);
}
{
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))
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)
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);
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);
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;
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;
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)
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:
{
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);
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)
}
}
- 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);
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,
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,
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;
}
}
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:
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;
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++;
}
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);
}
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;
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);
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:
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]);
}
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);
}
}
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);
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:
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;
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;
}
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;
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;
}
}
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)
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;
}
if( strcasecmp( workprefs.sername, "none") == 0 )
{
SendDlgItemMessage (hDlg, IDC_SERIAL, CB_SETCURSEL, 0, 0L);
- workprefs.use_serial = 0;
+ workprefs.use_serial = 0;
}
else
{
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;
}
}
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++] );
}
}
}
}
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 );
{
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 );
}
}
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 );
+ }
+ }
}
}
return TRUE;
case WM_COMMAND:
- if (recursive > 0)
+ if (recursive > 0)
break;
recursive++;
if (wParam == IDC_SWAP) {
values_from_portsdlg (hDlg);
updatejoyport (hDlg);
}
- inputdevice_updateconfig (&workprefs);
+ inputdevice_updateconfig (&workprefs);
inputdevice_config_change ();
- recursive--;
+ recursive--;
break;
}
return FALSE;
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;
}
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);
}
}
recursive--;
return TRUE;
case WM_COMMAND:
- if (recursive)
+ if (recursive)
break;
recursive++;
switch (wParam)
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;
input_selected_widget = -1;
}
update_listview_input (hDlg);
- init_inputdlg_2 (hDlg);
+ init_inputdlg_2 (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;
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);
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++;
}
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,
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) {
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);
}
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:
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 ();
{
char tmpstr[256];
- updatewinfsmode (&workprefs);
+ updatewinfsmode (&workprefs);
SetDlgItemText(hDlg, IDC_AVIOUTPUT_FILETEXT, avioutput_filename);
sprintf(tmpstr, "%d fps", avioutput_fps);
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;
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)
{
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)
{
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;
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;
}
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);
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);
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)
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];
{
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)));
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:
};
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;
}
if (quit_program)
- psresult = -2;
+ psresult = -2;
else if (qs_request_reset && quickstart)
uae_reset (qs_request_reset == 2 ? 1 : 0);
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);
}
}
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;
pause_sound ();
flipflop = fsdialog (&hwnd, &mbflags);
if (flipflop)
- ShowWindow (hAmigaWnd, SW_MINIMIZE);
+ ShowWindow (hAmigaWnd, SW_MINIMIZE);
va_start (parms, format);
vsprintf( msg, format, parms );
ret = MessageBox (hwnd, msg, szTitle, mbflags);
if (flipflop)
- ShowWindow (hAmigaWnd, SW_RESTORE);
+ ShowWindow (hAmigaWnd, SW_RESTORE);
resume_sound ();
setmouseactive (focuso);
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')
MessageBox (hwnd, msg, szTitle, flags);
if (flipflop)
- ShowWindow (hAmigaWnd, SW_RESTORE);
+ ShowWindow (hAmigaWnd, SW_RESTORE);
resume_sound();
setmouseactive (focuso);
}
gui_message (tmp);
}
-int translate_message (int msg, char *out)
+int translate_message (int msg, char *out)
{
msg = gettranslation (msg);
out[0] = 0;
Name="winuae"
ProjectGUID="{4ADAA943-1AC8-4FB5-82E5-4FB753B6C2DA}"
RootNamespace="winuae"
+ SignManifests="true"
>
<Platforms>
<Platform
totallen=0;
while(maxlen>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;
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;
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':
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;
*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. */
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);
#endif
}
-/* Save all subsystems */
+/* Save all subsystems */
void save_state (char *filename, char *description)
{
zfile_fwrite(tmp, len2, 1, f);
xfree(tmp);
}
- zfile_fclose (f);
+ zfile_fclose (f);
return;
}
#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) {
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;
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;
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
#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;
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));
}
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);
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);
}
}
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;
}
}
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++;
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)
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;
}
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);
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);
}
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));
}
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++;
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;
if (!currprefs.scsi)
return;
dev_reset ();
-}
\ No newline at end of file
+}
if(!first) first = nw;
if(last) {
- last->next = nw;
- last = nw;
+ last->next = nw;
+ last = nw;
} else last = nw;
return UAEEXE_OK;
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;
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
#if !defined(unix) && !defined(CASESENSITIVITYDEFAULT_YES) && \
- !defined(CASESENSITIVITYDEFAULT_NO)
+ !defined(CASESENSITIVITYDEFAULT_NO)
#define CASESENSITIVITYDEFAULT_NO
#endif
} 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 */
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;
int err = zfile_fread(&c, 1, 1, fin);
if (err==1)
{
- *pi = (int)c;
- return UNZ_OK;
+ *pi = (int)c;
+ return UNZ_OK;
}
else
{
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;
}
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;
}
}
-#ifdef CASESENSITIVITYDEFAULT_NO
+#ifdef CASESENSITIVITYDEFAULT_NO
#define CASESENSITIVITYDEFAULTVALUE 2
#else
#define CASESENSITIVITYDEFAULTVALUE 1
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)
return STRCMPCASENOSENTIVEFUNCTION(fileName1,fileName2);
}
-#define BUFREADCOMMENT (0x400)
+#define BUFREADCOMMENT (0x400)
/*
Locate the Central directory of a zipfile (at the end, just before
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))
{
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)
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;
s=(unz_s*)file;
if (s->pfile_in_zip_read!=NULL)
- unzCloseCurrentFile(file);
+ unzCloseCurrentFile(file);
zfile_fclose(s->file);
TRYFREE(s);
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;
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;
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;
return UNZ_PARAMERROR;
if (strlen(szFileName)>=UNZ_MAXFILENAMEINZIP)
- return UNZ_PARAMERROR;
+ return UNZ_PARAMERROR;
s=(unz_s*)file;
if (!s->current_file_ok)
/*
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,
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;
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;
*/
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)
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;
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;
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_compressed<uReadThis)
if (uReadThis == 0)
return UNZ_EOF;
if (zfile_fseek(pfile_in_zip_read_info->file,
- 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;
}
{
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;i<uDoCopy;i++)
*(pfile_in_zip_read_info->stream.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,
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
/*
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;
*/
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)
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;
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;
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;
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;
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;
}
}
}
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
}
i--;
}
- return 0;
+ return 0;
}
#ifdef SINGLEFILE
char zipname[1000];
if( *name == '\0' )
- return NULL;
+ return NULL;
l = zfile_create ();
l->name = strdup (name);
#ifdef SINGLEFILE
}
zfile_fclose (zf);
}
- if (fi.CompressedFileSize)
+ if (fi.CompressedFileSize)
skipsize = 0;
- skipsize += (int)fi.UncompressedFileSize;
+ skipsize += (int)fi.UncompressedFileSize;
}
closeArchive (ah);
arcacc_pop ();
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);
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);