diff --git a/src/cpu/386.c b/src/cpu/386.c index 313d98b..d375b22 100644 --- a/src/cpu/386.c +++ b/src/cpu/386.c @@ -96,9 +96,6 @@ uint32_t *mod1seg[8]; uint32_t rmdat32; #define rmdat rmdat32 #define fetchdat rmdat32 -//static int oldi; -//static uint32_t backupregs[16]; -//static uint32_t oldecx; #define fetch_ea_16(dat) \ @@ -190,6 +187,7 @@ exec386(int cycs) #endif cpu_state.pc++; + x86_opcodes[(opcode | cpu_state.op32) & 0x3ff](fetchdat); if (x86_was_reset) break; diff --git a/src/cpu/codegen_ops.c b/src/cpu/codegen_ops.c index 1c287bb..0786a42 100644 --- a/src/cpu/codegen_ops.c +++ b/src/cpu/codegen_ops.c @@ -8,7 +8,7 @@ * * Instruction parsing and generation. * - * Version: @(#)codegen_ops.c 1.0.1 2018/02/14 + * Version: @(#)codegen_ops.c 1.0.2 2018/10/24 * * Authors: Sarah Walker, * Miran Grca, @@ -50,10 +50,20 @@ #include "codegen.h" #include "codegen_ops.h" -#ifdef __amd64__ -#include "codegen_ops_x86-64.h" -#elif defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined _WIN32 -#include "codegen_ops_x86.h" +#ifdef _MSC_VER +# ifdef _M_X64 +# include "codegen_ops_x86-64.h" /* 64-bit */ +# else +# include "codegen_ops_x86.h" /* 32-bit */ +# endif +#endif + +#ifdef __GNUC__ +# ifdef __amd64__ +# include "codegen_ops_x86-64.h" /* 64-bit */ +# elif defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined _WIN32 +# include "codegen_ops_x86.h" /* 32-bit */ +# endif #endif #include "codegen_ops_arith.h" diff --git a/src/cpu/codegen_ops_fpu.h b/src/cpu/codegen_ops_fpu.h index 9f2ffab..a767fe4 100644 --- a/src/cpu/codegen_ops_fpu.h +++ b/src/cpu/codegen_ops_fpu.h @@ -8,7 +8,7 @@ * * Miscellaneous instructions. * - * Version: @(#)codegen_ops_fpu.h 1.0.3 2018/10/19 + * Version: @(#)codegen_ops_fpu.h 1.0.4 2018/10/23 * * Authors: Sarah Walker, * Miran Grca, @@ -183,7 +183,7 @@ static uint32_t ropFSTs(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint3 static uint32_t ropFSTd(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) { x86seg *target_seg; - int host_reg1, host_reg2; + int host_reg1 = 0, host_reg2 = 0; FP_ENTER(); op_pc--; @@ -593,7 +593,7 @@ static uint32_t ropFISTPl(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uin static uint32_t ropFISTPq(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) { x86seg *target_seg; - int host_reg1, host_reg2; + int host_reg1 = 0, host_reg2 = 0; FP_ENTER(); op_pc--; diff --git a/src/cpu/codegen_ops_mmx.h b/src/cpu/codegen_ops_mmx.h index ebe05bc..2beda0d 100644 --- a/src/cpu/codegen_ops_mmx.h +++ b/src/cpu/codegen_ops_mmx.h @@ -8,7 +8,7 @@ * * Miscellaneous Instructions. * - * Version: @(#)codegen_ops_mmx.h 1.0.1 2018/02/14 + * Version: @(#)codegen_ops_mmx.h 1.0.2 2018/10/24 * * Authors: Sarah Walker, * Miran Grca, @@ -36,7 +36,7 @@ */ static uint32_t ropMOVQ_q_mm(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) { - int host_reg1, host_reg2; + int host_reg1 = 0, host_reg2 = 0; MMX_ENTER(); @@ -67,7 +67,7 @@ static uint32_t ropMOVQ_mm_q(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, if ((fetchdat & 0xc0) == 0xc0) { - int host_reg1, host_reg2; + int host_reg1 = 0, host_reg2 = 0; LOAD_MMX_Q(fetchdat & 7, &host_reg1, &host_reg2); STORE_MMX_Q((fetchdat >> 3) & 7, host_reg1, host_reg2); diff --git a/src/cpu/codegen_ops_x86-64.h b/src/cpu/codegen_ops_x86-64.h index 85f30ce..4f9688c 100644 --- a/src/cpu/codegen_ops_x86-64.h +++ b/src/cpu/codegen_ops_x86-64.h @@ -8,7 +8,7 @@ * * Code generator definitions (64-bit) * - * Version: @(#)x86_ops_x86-64.h 1.0.1 2018/02/14 + * Version: @(#)x86_ops_x86-64.h 1.0.2 2018/10/24 * * Authors: Sarah Walker, * Miran Grca, @@ -65,7 +65,7 @@ static INLINE void call(codeblock_t *block, uintptr_t func) codegen_reg_loaded[0] = codegen_reg_loaded[1] = codegen_reg_loaded[2] = codegen_reg_loaded[3] = 0; codegen_reg_loaded[4] = codegen_reg_loaded[5] = codegen_reg_loaded[6] = codegen_reg_loaded[7] = 0; - if (diff >= -0x80000000 && diff < 0x7fffffff) + if (diff >= (uintptr_t) ((intptr_t)-0x80000000) && diff < (uintptr_t)0x7fffffff) { addbyte(0xE8); /*CALL*/ addlong((uint32_t)diff); @@ -542,7 +542,7 @@ static INLINE void STORE_IMM_ADDR_L(uintptr_t addr, uint32_t val) { addbyte(0xC7); /*MOVL [addr],val*/ addbyte(0x45); - addbyte(addr - (uintptr_t)&cpu_state - 128); + addbyte((uint8_t) (addr - (uintptr_t)&cpu_state - 128)); addlong(val); } else if (addr < 0x100000000) @@ -550,7 +550,7 @@ static INLINE void STORE_IMM_ADDR_L(uintptr_t addr, uint32_t val) addbyte(0xC7); /*MOVL [addr],val*/ addbyte(0x04); addbyte(0x25); - addlong(addr); + addlong((uint32_t)addr); addlong(val); } else @@ -981,7 +981,7 @@ static INLINE void CHECK_SEG_LIMITS(x86seg *seg, int end_offset) } addbyte(0x3b); /*CMP EAX, seg->limit_low*/ addbyte(0x46); - addbyte((uintptr_t)&seg->limit_low - (uintptr_t)seg); + addbyte((uint8_t) ((uintptr_t)&seg->limit_low - (uintptr_t)seg)); addbyte(0x0f); /*JB BLOCK_GPF_OFFSET*/ addbyte(0x82); addlong(BLOCK_GPF_OFFSET - (block_pos + 4)); @@ -992,7 +992,7 @@ static INLINE void CHECK_SEG_LIMITS(x86seg *seg, int end_offset) addbyte(end_offset); addbyte(0x3b); /*CMP EAX, seg->limit_high*/ addbyte(0x46); - addbyte((uintptr_t)&seg->limit_high - (uintptr_t)seg); + addbyte((uint8_t) ((uintptr_t)&seg->limit_high - (uintptr_t)seg)); addbyte(0x0f); /*JNBE BLOCK_GPF_OFFSET*/ addbyte(0x87); addlong(BLOCK_GPF_OFFSET - (block_pos + 4)); @@ -1771,7 +1771,7 @@ static INLINE void STORE_HOST_REG_ADDR_BL(uintptr_t addr, int host_reg) addbyte(0x89); /*MOV addr, temp_reg*/ addbyte(0x04 | (temp_reg << 3)); addbyte(0x25); - addlong(addr); + addlong((uint32_t)addr); } else { @@ -1805,7 +1805,7 @@ static INLINE void STORE_HOST_REG_ADDR_WL(uintptr_t addr, int host_reg) addbyte(0x89); /*MOV addr, temp_reg*/ addbyte(0x04 | (temp_reg << 3)); addbyte(0x25); - addlong(addr); + addlong((uint32_t)addr); } else { @@ -1835,7 +1835,7 @@ static INLINE void STORE_HOST_REG_ADDR_W(uintptr_t addr, int host_reg) addbyte(0x89); /*MOVW addr,host_reg*/ addbyte(0x04 | ((host_reg & 7) << 3)); addbyte(0x25); - addlong(addr); + addlong((uint32_t)addr); } else { @@ -1867,7 +1867,7 @@ static INLINE void STORE_HOST_REG_ADDR(uintptr_t addr, int host_reg) addbyte(0x89); /*MOVL addr,host_reg*/ addbyte(0x04 | ((host_reg & 7) << 3)); addbyte(0x25); - addlong(addr); + addlong((uint32_t)addr); } else { @@ -3274,7 +3274,7 @@ static INLINE void BRANCH_COND_BE(int pc_offset, uint32_t op_pc, uint32_t offset addbyte(7+5+(timing_bt ? 4 : 0)); if (!not) - *jump1 = (uintptr_t)&codeblock[block_current].data[block_pos] - (uintptr_t)jump1 - 1; + *jump1 = (uint8_t) ((uintptr_t)&codeblock[block_current].data[block_pos] - (uintptr_t)jump1 - 1); addbyte(0xC7); /*MOVL [pc], new_pc*/ addbyte(0x45); addbyte((uint8_t)cpu_state_offset(pc)); @@ -3289,7 +3289,7 @@ static INLINE void BRANCH_COND_BE(int pc_offset, uint32_t op_pc, uint32_t offset addbyte(0xe9); /*JMP end*/ addlong(BLOCK_EXIT_OFFSET - (block_pos + 4)); if (not) - *jump1 = (uintptr_t)&codeblock[block_current].data[block_pos] - (uintptr_t)jump1 - 1; + *jump1 = (uint8_t) ((uintptr_t)&codeblock[block_current].data[block_pos] - (uintptr_t)jump1 - 1); } static INLINE void BRANCH_COND_L(int pc_offset, uint32_t op_pc, uint32_t offset, int not) @@ -3368,7 +3368,7 @@ static INLINE void BRANCH_COND_LE(int pc_offset, uint32_t op_pc, uint32_t offset addbyte(0x74); /*JZ +*/ addbyte(7+5+(timing_bt ? 4 : 0)); if (!not) - *jump1 = (uintptr_t)&codeblock[block_current].data[block_pos] - (uintptr_t)jump1 - 1; + *jump1 = (uint8_t) ((uintptr_t)&codeblock[block_current].data[block_pos] - (uintptr_t)jump1 - 1); addbyte(0xC7); /*MOVL [pc], new_pc*/ addbyte(0x45); addbyte((uint8_t)cpu_state_offset(pc)); @@ -3383,7 +3383,7 @@ static INLINE void BRANCH_COND_LE(int pc_offset, uint32_t op_pc, uint32_t offset addbyte(0xe9); /*JMP end*/ addlong(BLOCK_EXIT_OFFSET - (block_pos + 4)); if (not) - *jump1 = (uintptr_t)&codeblock[block_current].data[block_pos] - (uintptr_t)jump1 - 1; + *jump1 = (uint8_t) ((uintptr_t)&codeblock[block_current].data[block_pos] - (uintptr_t)jump1 - 1); } static INLINE int LOAD_VAR_W(uintptr_t addr) @@ -3395,7 +3395,7 @@ static INLINE int LOAD_VAR_W(uintptr_t addr) addbyte(0x0f); /*MOVZX host_reg, offset[cpu_state]*/ addbyte(0xb7); addbyte(0x45 | (host_reg << 3)); - addbyte(addr - (uintptr_t)&cpu_state - 128); + addbyte((uint8_t) (addr - (uintptr_t)&cpu_state - 128)); } else if (IS_32_ADDR(addr)) { @@ -3429,7 +3429,7 @@ static INLINE int LOAD_VAR_L(uintptr_t addr) { addbyte(0x8b); /*MOVL host_reg, offset[cpu_state]*/ addbyte(0x45 | (host_reg << 3)); - addbyte(addr - (uintptr_t)&cpu_state - 128); + addbyte((uint8_t) (addr - (uintptr_t)&cpu_state - 128)); } else if (IS_32_ADDR(addr)) { @@ -3750,7 +3750,7 @@ static INLINE void FP_ENTER() addbyte(0xf6); /*TEST cr0, 0xc*/ addbyte(0x04); addbyte(0x25); - addlong((uintptr_t)&cr0); + addlong((uint32_t)(((uintptr_t)&cr0) & 0xffff)); addbyte(0x0c); } else @@ -4857,7 +4857,7 @@ static INLINE void SET_BITS(uintptr_t addr, uint32_t val) addbyte(0x81); /*OR [addr], val*/ addbyte(0x0c); addbyte(0x25); - addlong(addr); + addlong((uint32_t)addr); addlong(val); } else @@ -4865,7 +4865,7 @@ static INLINE void SET_BITS(uintptr_t addr, uint32_t val) addbyte(0x80); /*OR [addr], val*/ addbyte(0x0c); addbyte(0x25); - addlong(addr); + addlong((uint32_t)addr); addbyte(val); } } @@ -4898,7 +4898,7 @@ static INLINE void CLEAR_BITS(uintptr_t addr, uint32_t val) addbyte(0x81); /*AND [addr], val*/ addbyte(0x24); addbyte(0x25); - addlong(addr); + addlong((uint32_t)addr); addlong(~val); } else @@ -4906,7 +4906,7 @@ static INLINE void CLEAR_BITS(uintptr_t addr, uint32_t val) addbyte(0x80); /*AND [addr], val*/ addbyte(0x24); addbyte(0x25); - addlong(addr); + addlong((uint32_t)addr); addbyte(~val); } } @@ -4943,7 +4943,7 @@ static INLINE void MMX_ENTER() addbyte(0xf6); /*TEST cr0, 0xc*/ addbyte(0x04); addbyte(0x25); - addlong((uintptr_t)&cr0); + addlong((uint32_t)(((uintptr_t)&cr0) & 0xffff)); addbyte(0x0c); } else @@ -5390,7 +5390,7 @@ static INLINE void MEM_CHECK_WRITE(x86seg *seg) addbyte(0); if (!(seg == &_ds && codegen_flat_ds && !(cpu_cur_status & CPU_STATUS_NOTFLATDS)) && !(seg == &_ss && codegen_flat_ss && !(cpu_cur_status & CPU_STATUS_NOTFLATSS))) - *jump3 = (uintptr_t)&codeblock[block_current].data[block_pos] - (uintptr_t)jump3 - 1; + *jump3 = (uint8_t) ((uintptr_t)&codeblock[block_current].data[block_pos] - (uintptr_t)jump3 - 1); /*slowpath:*/ addbyte(0x67); /*LEA EDI, [EAX+ESI]*/ addbyte(0x8d); @@ -5408,9 +5408,9 @@ static INLINE void MEM_CHECK_WRITE(x86seg *seg) addbyte(0); addbyte(0x0f); /*JNE mem_abrt_rout*/ addbyte(0x85); - addlong((uintptr_t)&codeblock[block_current].data[BLOCK_EXIT_OFFSET] - ((uintptr_t)(&codeblock[block_current].data[block_pos]) + 4)); - *jump1 = (uintptr_t)&codeblock[block_current].data[block_pos] - (uintptr_t)jump1 - 1; - *jump2 = (uintptr_t)&codeblock[block_current].data[block_pos] - (uintptr_t)jump2 - 1; + addlong((uint32_t)((uintptr_t)&codeblock[block_current].data[BLOCK_EXIT_OFFSET] - ((uintptr_t)(&codeblock[block_current].data[block_pos]) + 4))); + *jump1 = (uint8_t) ((uintptr_t)&codeblock[block_current].data[block_pos] - (uintptr_t)jump1 - 1); + *jump2 = (uint8_t) ((uintptr_t)&codeblock[block_current].data[block_pos] - (uintptr_t)jump2 - 1); LOAD_EA(); } @@ -5534,9 +5534,9 @@ static INLINE void MEM_CHECK_WRITE_W(x86seg *seg) addbyte(0); /*slowpath:*/ - *jump2 = (uintptr_t)&codeblock[block_current].data[block_pos] - (uintptr_t)jump2 - 1; + *jump2 = (uint8_t) ((uintptr_t)&codeblock[block_current].data[block_pos] - (uintptr_t)jump2 - 1); if (!(seg == &_ds && codegen_flat_ds && !(cpu_cur_status & CPU_STATUS_NOTFLATDS)) && !(seg == &_ss && codegen_flat_ss && !(cpu_cur_status & CPU_STATUS_NOTFLATSS))) - *jump4 = (uintptr_t)&codeblock[block_current].data[block_pos] - (uintptr_t)jump4 - 1; + *jump4 = (uint8_t) ((uintptr_t)&codeblock[block_current].data[block_pos] - (uintptr_t)jump4 - 1); jump_pos = block_pos; load_param_1_reg_32(REG_EBX); load_param_2_32(&codeblock[block_current], 1); @@ -5550,7 +5550,7 @@ static INLINE void MEM_CHECK_WRITE_W(x86seg *seg) addbyte(0); addbyte(0x0f); /*JNE mem_abrt_rout*/ addbyte(0x85); - addlong((uintptr_t)&codeblock[block_current].data[BLOCK_EXIT_OFFSET] - ((uintptr_t)(&codeblock[block_current].data[block_pos]) + 4)); + addlong((uint32_t) ((uintptr_t)&codeblock[block_current].data[BLOCK_EXIT_OFFSET] - ((uintptr_t)(&codeblock[block_current].data[block_pos]) + 4))); /*If bits 0-11 of the address are now 0 then this crosses a page, so loop back*/ addbyte(0xf7); /*TEST $fff, EBX*/ addbyte(0xc3); @@ -5558,8 +5558,8 @@ static INLINE void MEM_CHECK_WRITE_W(x86seg *seg) addbyte(0x74); /*JNE slowpath*/ addbyte(jump_pos - block_pos - 1); - *jump1 = (uintptr_t)&codeblock[block_current].data[block_pos] - (uintptr_t)jump1 - 1; - *jump3 = (uintptr_t)&codeblock[block_current].data[block_pos] - (uintptr_t)jump3 - 1; + *jump1 = (uint8_t) ((uintptr_t)&codeblock[block_current].data[block_pos] - (uintptr_t)jump1 - 1); + *jump3 = (uint8_t) ((uintptr_t)&codeblock[block_current].data[block_pos] - (uintptr_t)jump3 - 1); LOAD_EA(); } @@ -5683,9 +5683,9 @@ static INLINE void MEM_CHECK_WRITE_L(x86seg *seg) addbyte(0); /*slowpath:*/ - *jump2 = (uintptr_t)&codeblock[block_current].data[block_pos] - (uintptr_t)jump2 - 1; + *jump2 = (uint8_t) ((uintptr_t)&codeblock[block_current].data[block_pos] - (uintptr_t)jump2 - 1); if (!(seg == &_ds && codegen_flat_ds && !(cpu_cur_status & CPU_STATUS_NOTFLATDS)) && !(seg == &_ss && codegen_flat_ss && !(cpu_cur_status & CPU_STATUS_NOTFLATSS))) - *jump4 = (uintptr_t)&codeblock[block_current].data[block_pos] - (uintptr_t)jump4 - 1; + *jump4 = (uint8_t) ((uintptr_t)&codeblock[block_current].data[block_pos] - (uintptr_t)jump4 - 1); jump_pos = block_pos; load_param_1_reg_32(REG_EBX); load_param_2_32(&codeblock[block_current], 1); @@ -5699,7 +5699,7 @@ static INLINE void MEM_CHECK_WRITE_L(x86seg *seg) addbyte(0); addbyte(0x0f); /*JNE mem_abrt_rout*/ addbyte(0x85); - addlong((uintptr_t)&codeblock[block_current].data[BLOCK_EXIT_OFFSET] - ((uintptr_t)(&codeblock[block_current].data[block_pos]) + 4)); + addlong((uint32_t) ((uintptr_t)&codeblock[block_current].data[BLOCK_EXIT_OFFSET] - ((uintptr_t)(&codeblock[block_current].data[block_pos]) + 4))); /*If bits 0-11 of the address are now 0 then this crosses a page, so loop back*/ addbyte(0xf7); /*TEST $ffc, EBX*/ addbyte(0xc3); @@ -5707,8 +5707,8 @@ static INLINE void MEM_CHECK_WRITE_L(x86seg *seg) addbyte(0x74); /*JE slowpath*/ addbyte(jump_pos - block_pos - 1); - *jump1 = (uintptr_t)&codeblock[block_current].data[block_pos] - (uintptr_t)jump1 - 1; - *jump3 = (uintptr_t)&codeblock[block_current].data[block_pos] - (uintptr_t)jump3 - 1; + *jump1 = (uint8_t) ((uintptr_t)&codeblock[block_current].data[block_pos] - (uintptr_t)jump1 - 1); + *jump3 = (uint8_t) ((uintptr_t)&codeblock[block_current].data[block_pos] - (uintptr_t)jump3 - 1); LOAD_EA(); } diff --git a/src/cpu/codegen_ops_x86.h b/src/cpu/codegen_ops_x86.h index f4612b7..ab5f56e 100644 --- a/src/cpu/codegen_ops_x86.h +++ b/src/cpu/codegen_ops_x86.h @@ -8,7 +8,7 @@ * * Code generator definitions (32-bit) * - * Version: @(#)x86_ops_x86.h 1.0.1 2018/02/14 + * Version: @(#)x86_ops_x86.h 1.0.2 2018/10/24 * * Authors: Sarah Walker, * Miran Grca, @@ -102,7 +102,7 @@ static INLINE void STORE_IMM_ADDR_L(uintptr_t addr, uint32_t val) { addbyte(0xC7); /*MOVL [addr],val*/ addbyte(0x05); - addlong(addr); + addlong((uint32_t) (addr & 0xffffffff)); addlong(val); } } diff --git a/src/cpu/codegen_x86-64.c b/src/cpu/codegen_x86-64.c index 7e279c6..decaadc 100644 --- a/src/cpu/codegen_x86-64.c +++ b/src/cpu/codegen_x86-64.c @@ -8,7 +8,7 @@ * * Dynamic Recompiler for Intel x64 systems. * - * Version: @(#)codegen_x86-64.c 1.0.3 2018/10/07 + * Version: @(#)codegen_x86-64.c 1.0.4 2018/10/24 * * Authors: Sarah Walker, * Miran Grca, @@ -34,10 +34,11 @@ * Boston, MA 02111-1307 * USA. */ -#ifdef __amd64__ +#if (defined(_MSC_VER) && defined(_M_X64)) || (defined(__GNUC__) && defined(__amd64__)) #include #include +#include #include #include "../emu.h" #include "cpu.h" @@ -1230,4 +1231,4 @@ generate_call: codegen_endpc = (cs + cpu_state.pc) + 8; } -#endif +#endif /*64bit mode*/ diff --git a/src/cpu/x87_ops.h b/src/cpu/x87_ops.h index dd24612..49c837a 100644 --- a/src/cpu/x87_ops.h +++ b/src/cpu/x87_ops.h @@ -8,7 +8,7 @@ * * x87 FPU instructions core. * - * Version: @(#)x87_ops.h 1.0.6 2018/10/05 + * Version: @(#)x87_ops.h 1.0.7 2018/10/24 * * Authors: Fred N. van Kempen, * Sarah Walker, @@ -44,7 +44,8 @@ # include #endif -#define fplog 0 +#define fplog 0 + static int rounding_modes[4] = {FE_TONEAREST, FE_DOWNWARD, FE_UPWARD, FE_TOWARDZERO}; @@ -296,15 +297,47 @@ static INLINE void x87_stmmx(MMX_REG r) static INLINE uint16_t x87_compare(double a, double b) { -#if defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined _WIN32 - uint32_t result; + uint32_t result = 0; +#if defined(_MSC_VER) && !defined(_M_X64) + if (!is386) + { + if (((a == INFINITY) || (a == -INFINITY)) && ((b == INFINITY) || (b == -INFINITY))) + { + /* DEBUG("Comparing infinity\n"); */ + _ReadWriteBarrier(); + __asm + { + fld a + fld a + fclex + fcompp + fnstsw result + } + + return result & (C0|C2|C3); + } + } + + _ReadWriteBarrier(); + _asm + { + fld b + fld a + fclex + fcompp + fnstsw result + } + + return result & (C0|C2|C3); +#endif + +#if defined(__GNUC__) if (!is386) { if (((a == INFINITY) || (a == -INFINITY)) && ((b == INFINITY) || (b == -INFINITY))) { /* DEBUG("Comparing infinity\n"); */ -#ifndef _MSC_VER __asm volatile ("" : : : "memory"); __asm( @@ -316,23 +349,9 @@ static INLINE uint16_t x87_compare(double a, double b) : "=m" (result) : "m" (a), "m" (a) ); -#else - _ReadWriteBarrier(); - __asm - { - fld a - fld a - fclex - fcompp - fnstsw result - } -#endif - - return result & (C0|C2|C3); } } - -#ifndef _MSC_VER + /* Memory barrier, to force GCC to write to the input parameters * before the compare rather than after */ __asm volatile ("" : : : "memory"); @@ -346,28 +365,17 @@ static INLINE uint16_t x87_compare(double a, double b) : "=m" (result) : "m" (a), "m" (b) ); -#else - _ReadWriteBarrier(); - _asm - { - fld b - fld a - fclex - fcompp - fnstsw result - } -#endif return result & (C0|C2|C3); -#else +#endif + /* Generic C version is known to give incorrect results in some * situations, eg comparison of infinity (Unreal) */ - uint32_t out = 0; - - if (is386) + if (!is386) { if (((a == INFINITY) || (a == -INFINITY)) && ((b == INFINITY) || (b == -INFINITY))) { + /* DEBUG("Comparing infinity\n"); */ result |= C3; return result; } @@ -386,15 +394,27 @@ static INLINE uint16_t x87_compare(double a, double b) } return result; -#endif } static INLINE uint16_t x87_ucompare(double a, double b) { -#if defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined _WIN32 - uint32_t result; - -#ifndef _MSC_VER + uint32_t result = 0; + +#if defined(_MSC_VER) && !defined(_M_X64) + _ReadWriteBarrier(); + _asm + { + fld b + fld a + fclex + fcompp + fnstsw result + } + + return result & (C0|C2|C3); +#endif + +#ifdef __GNUC__ /* Memory barrier, to force GCC to write to the input parameters * before the compare rather than after */ __asm volatile ("" : : : "memory"); @@ -408,33 +428,21 @@ static INLINE uint16_t x87_ucompare(double a, double b) : "=m" (result) : "m" (a), "m" (b) ); -#else - _ReadWriteBarrier(); - _asm - { - fld b - fld a - fclex - fcompp - fnstsw result - } -#endif return result & (C0|C2|C3); -#else +#endif + /* Generic C version is known to give incorrect results in some * situations, eg comparison of infinity (Unreal) */ - uint32_t result = 0; - if (a == b) result |= C3; else if (a < b) result |= C0; return result; -#endif } + typedef union { float s; diff --git a/src/devices/cdrom/cdrom_dosbox.cpp b/src/devices/cdrom/cdrom_dosbox.cpp index f1cf21f..8e286fe 100644 --- a/src/devices/cdrom/cdrom_dosbox.cpp +++ b/src/devices/cdrom/cdrom_dosbox.cpp @@ -8,7 +8,7 @@ * * CD-ROM image file handling module. * - * Version: @(#)cdrom_dosbox.cpp 1.0.9 2018/09/25 + * Version: @(#)cdrom_dosbox.cpp 1.0.10 2018/10/23 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -105,7 +105,7 @@ CDROM_Interface_Image::BinaryFile::read(Bit8u *buffer, uint64_t seek, size_t cou if (file == NULL) return 0; fseeko64(file, seek, SEEK_SET); - fread(buffer, 1, count, file); + if (fread(buffer, count, 1, file) != 1) return 0; return 1; } diff --git a/src/devices/disk/hdd_image.c b/src/devices/disk/hdd_image.c index 82a82e2..a8bdeeb 100644 --- a/src/devices/disk/hdd_image.c +++ b/src/devices/disk/hdd_image.c @@ -14,7 +14,7 @@ * merged with hdd.c, since that is the scope of hdd.c. The * actual format handlers can then be in hdd_format.c etc. * - * Version: @(#)hdd_image.c 1.0.8 2018/10/09 + * Version: @(#)hdd_image.c 1.0.9 2018/10/24 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -116,7 +116,7 @@ image_is_hdi(const wchar_t *s) int len; wchar_t ext[5] = { 0, 0, 0, 0, 0 }; char *ws = (char *) s; - len = wcslen(s); + len = (int)wcslen(s); if ((len < 4) || (s[0] == L'.')) return 0; memcpy(ext, ws + ((len - 4) << 1), 8); @@ -136,7 +136,7 @@ image_is_hdx(const wchar_t *s, int check_signature) uint64_t signature; char *ws = (char *) s; wchar_t ext[5] = { 0, 0, 0, 0, 0 }; - len = wcslen(s); + len = (int)wcslen(s); if ((len < 4) || (s[0] == L'.')) return 0; memcpy(ext, ws + ((len - 4) << 1), 8); @@ -173,7 +173,7 @@ image_is_vhd(const wchar_t *s, int check_signature) char *ws = (char *) s; wchar_t ext[5] = { 0, 0, 0, 0, 0 }; - len = wcslen(s); + len = (int)wcslen(s); if ((len < 4) || (s[0] == L'.')) return 0; diff --git a/src/devices/floppy/fdd_imd.c b/src/devices/floppy/fdd_imd.c index 43bb941..06ae574 100644 --- a/src/devices/floppy/fdd_imd.c +++ b/src/devices/floppy/fdd_imd.c @@ -8,7 +8,7 @@ * * Implementation of the IMD floppy image format. * - * Version: @(#)fdd_imd.c 1.0.10 2018/10/05 + * Version: @(#)fdd_imd.c 1.0.11 2018/10/24 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -649,7 +649,7 @@ imd_load(int drive, const wchar_t *fn) return(0); } - dev->start_offs = (buffer2 - buffer); + dev->start_offs = (uint32_t) (buffer2 - buffer); dev->disk_flags = 0x00; dev->track_count = 0; dev->sides = 1; @@ -686,7 +686,7 @@ imd_load(int drive, const wchar_t *fn) if ((dev->tracks[track][side].side_flags & 7) == 1) dev->tracks[track][side].side_flags |= 0x20; dev->tracks[track][side].is_present = 1; - dev->tracks[track][side].file_offs = (buffer2 - buffer); + dev->tracks[track][side].file_offs = (uint32_t) (buffer2 - buffer); memcpy(dev->tracks[track][side].params, buffer2, 5); dev->tracks[track][side].r_map_offs = dev->tracks[track][side].file_offs + 5; last_offset = dev->tracks[track][side].r_map_offs + track_spt; diff --git a/src/devices/floppy/fdd_img.c b/src/devices/floppy/fdd_img.c index 49b75a3..2b99177 100644 --- a/src/devices/floppy/fdd_img.c +++ b/src/devices/floppy/fdd_img.c @@ -13,7 +13,7 @@ * re-merged with the other files. Much of it is generic to * all formats. * - * Version: @(#)fdd_img.c 1.0.13 2018/10/05 + * Version: @(#)fdd_img.c 1.0.14 2018/10/24 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -486,7 +486,7 @@ img_seek(int drive, int track) cur_pos = (track * dev->sectors * ssize * dev->sides) + (side * dev->sectors * ssize); memcpy(dev->track_data[side], dev->disk_data + cur_pos, dev->sectors * ssize); } else { - read_bytes = fread(dev->track_data[side], 1, dev->sectors * ssize, dev->f); + read_bytes = (int)fread(dev->track_data[side], 1, dev->sectors * ssize, dev->f); if (read_bytes < (dev->sectors * ssize)) memset(dev->track_data[side] + read_bytes, 0xf6, (dev->sectors * ssize) - read_bytes); } diff --git a/src/devices/floppy/lzf/lzf_c.c b/src/devices/floppy/lzf/lzf_c.c index 17df2f6..174c1c0 100644 --- a/src/devices/floppy/lzf/lzf_c.c +++ b/src/devices/floppy/lzf/lzf_c.c @@ -150,7 +150,7 @@ lzf_compress (const void *const in_data, unsigned int in_len, hval = NEXT (hval, ip); hslot = htab + IDX (hval); - ref = *hslot + LZF_HSLOT_BIAS; + ref = (u8 *) ( *hslot + LZF_HSLOT_BIAS ); *hslot = *(LZF_HSLOT *)(ip - LZF_HSLOT_BIAS); if (1 @@ -169,7 +169,7 @@ lzf_compress (const void *const in_data, unsigned int in_len, { /* match found at *ref++ */ unsigned int len = 2; - unsigned int maxlen = in_end - ip - len; + unsigned int maxlen = (unsigned int) (in_end - ip - len); maxlen = maxlen > MAX_REF ? MAX_REF : maxlen; if (expect_false (op + 3 + 1 >= out_end)) /* first a faster conservative test */ @@ -294,6 +294,6 @@ lzf_compress (const void *const in_data, unsigned int in_len, op [- lit - 1] = lit - 1; /* end run */ op -= !lit; /* undo run if length is zero */ - return op - (u8 *)out_data; + return (unsigned int) (op - (u8 *)out_data); } diff --git a/src/devices/floppy/lzf/lzf_d.c b/src/devices/floppy/lzf/lzf_d.c index cab113c..cce2e48 100644 --- a/src/devices/floppy/lzf/lzf_d.c +++ b/src/devices/floppy/lzf/lzf_d.c @@ -180,6 +180,6 @@ lzf_decompress (const void *const in_data, unsigned int in_len, } while (ip < in_end); - return op - (u8 *)out_data; + return (unsigned int) (op - (u8 *)out_data); } diff --git a/src/devices/misc/isamem.c b/src/devices/misc/isamem.c index 5ea8197..bf87520 100644 --- a/src/devices/misc/isamem.c +++ b/src/devices/misc/isamem.c @@ -32,7 +32,7 @@ * TODO: The EV159 is supposed to support 16b EMS transfers, but the * EMM.sys driver for it doesn't seem to want to do that.. * - * Version: @(#)isamem.c 1.0.5 2018/09/22 + * Version: @(#)isamem.c 1.0.6 2018/10/24 * * Author: Fred N. van Kempen, * @@ -582,7 +582,7 @@ dev->frame_addr = 0xE0000; t = EMS_MAXSIZE; /* Set up where EMS begins in local RAM, and how much we have. */ - dev->ems_start = ptr - dev->ram; + dev->ems_start = (uint32_t) (ptr - dev->ram); dev->ems_size = t >> 10; dev->ems_pages = t / EMS_PGSIZE; INFO("ISAMEM: EMS enabled, I/O=%04XH, %iKB (%i pages)", diff --git a/src/devices/network/net_3c503.c b/src/devices/network/net_3c503.c index 3b8c791..f621dae 100644 --- a/src/devices/network/net_3c503.c +++ b/src/devices/network/net_3c503.c @@ -8,7 +8,7 @@ * Implementation of the following network controllers: * - 3Com Etherlink II 3c503 (ISA 8-bit). * - * Version: @(#)net_3c503.c 1.0.3 2018/10/16 + * Version: @(#)net_3c503.c 1.0.4 2018/10/24 * * Based on @(#)3c503.cpp Carl (MAME) * @@ -1416,8 +1416,8 @@ tc503_rx(void *priv, uint8_t *buf, int io_len) if (buf[0] & 0x01) pkthdr[0] |= 0x20; /* MULTICAST packet */ pkthdr[1] = nextpage; /* ptr to next packet */ - pkthdr[2] = (io_len + sizeof(pkthdr))&0xff; /* length-low */ - pkthdr[3] = (io_len + sizeof(pkthdr))>>8; /* length-hi */ + pkthdr[2] = (uint8_t) ((io_len + sizeof(pkthdr)) & 0xff); /* length-low */ + pkthdr[3] = (uint8_t) ((io_len + sizeof(pkthdr)) >> 8); /* length-hi */ DBGLOG(1, "3C503: RX pkthdr [%02x %02x %02x %02x]\n", pkthdr[0], pkthdr[1], pkthdr[2], pkthdr[3]); diff --git a/src/devices/network/net_ne2000.c b/src/devices/network/net_ne2000.c index be93e4a..0696aa8 100644 --- a/src/devices/network/net_ne2000.c +++ b/src/devices/network/net_ne2000.c @@ -16,7 +16,7 @@ * * FIXME: move statbar calls to upper layer * - * Version: @(#)net_ne2000.c 1.0.13 2018/10/16 + * Version: @(#)net_ne2000.c 1.0.14 2018/10/24 * * Based on @(#)ne2k.cc v1.56.2.1 2004/02/02 22:37:22 cbothamy * @@ -397,8 +397,8 @@ nic_rx(void *priv, uint8_t *buf, int io_len) if (buf[0] & 0x01) pkthdr[0] |= 0x20; /* MULTICAST packet */ pkthdr[1] = nextpage; /* ptr to next packet */ - pkthdr[2] = (io_len + sizeof(pkthdr))&0xff; /* length-low */ - pkthdr[3] = (io_len + sizeof(pkthdr))>>8; /* length-hi */ + pkthdr[2] = (uint8_t) ((io_len + sizeof(pkthdr)) & 0xff); /* length-low */ + pkthdr[3] = (uint8_t) ((io_len + sizeof(pkthdr)) >> 8); /* length-hi */ DBGLOG(1, "%s: RX pkthdr [%02x %02x %02x %02x]\n", dev->name, pkthdr[0], pkthdr[1], pkthdr[2], pkthdr[3]); diff --git a/src/devices/network/net_wd80x3.c b/src/devices/network/net_wd80x3.c index b7f7b95..d40cded 100644 --- a/src/devices/network/net_wd80x3.c +++ b/src/devices/network/net_wd80x3.c @@ -11,7 +11,7 @@ * - SMC/WD 8013EBT (ISA 16-bit); * - SMC/WD 8013EP/A (MCA). * - * Version: @(#)net_wd80x3.c 1.0.3 2018/10/16 + * Version: @(#)net_wd80x3.c 1.0.4 2018/10/24 * * Authors: Fred N. van Kempen, * TheCollector1995, @@ -1263,8 +1263,8 @@ wd_rx(void *priv, uint8_t *buf, int io_len) /* Set up packet header. */ pkthdr[0] = 0x01; /* RXOK - packet is OK */ pkthdr[1] = nextpage; /* ptr to next packet */ - pkthdr[2] = (io_len + sizeof(pkthdr))&0xff; /* length-low */ - pkthdr[3] = (io_len + sizeof(pkthdr))>>8; /* length-hi */ + pkthdr[2] = (uint8_t) ((io_len + sizeof(pkthdr)) & 0xff); /* length-low */ + pkthdr[3] = (uint8_t) ((io_len + sizeof(pkthdr)) >> 8); /* length-hi */ DBGLOG(1, "%s: RX pkthdr [%02x %02x %02x %02x]\n", dev->name, pkthdr[0], pkthdr[1], pkthdr[2], pkthdr[3]); diff --git a/src/devices/scsi/scsi_cdrom.c b/src/devices/scsi/scsi_cdrom.c index 2f78c91..270af98 100644 --- a/src/devices/scsi/scsi_cdrom.c +++ b/src/devices/scsi/scsi_cdrom.c @@ -2090,7 +2090,7 @@ scsi_cdrom_command(void *p, uint8_t *cdb) gesn_event_header->notification_class = 0x80; /* No event available */ used_len = sizeof(*gesn_event_header); } - gesn_event_header->len = used_len - sizeof(*gesn_event_header); + gesn_event_header->len = (uint16_t) (used_len - sizeof(*gesn_event_header)); memcpy(cdbufferb, gesn_event_header, 4); diff --git a/src/devices/sound/dbopl.cpp b/src/devices/sound/dbopl.cpp index 219a2cb..c3417f8 100644 --- a/src/devices/sound/dbopl.cpp +++ b/src/devices/sound/dbopl.cpp @@ -28,7 +28,7 @@ * multipliers sounds better or not * DUNNO Keyon in 4op, switch to 2op without keyoff. * - * Version: @(#)dbopl.cpp 1.0.2 2018/09/15 + * Version: @(#)dbopl.cpp 1.0.3 2018/10/24 * * Based on (dbopl.cpp,v 1.10 2009-06-10 19:54:51 harekiet) * @@ -1473,7 +1473,7 @@ void InitTables( void ) { if ( i >= 16 ) index += 9; intptr_t blah = reinterpret_cast( &(chip->chan[ index ]) ); - ChanOffsetTable[i] = blah; + ChanOffsetTable[i] = (Bit16u)blah; } //Same for operators for ( Bitu i = 0; i < 64; i++ ) { @@ -1488,7 +1488,7 @@ void InitTables( void ) { Bitu opNum = ( i % 8 ) / 3; DBOPL::Channel* chan = 0; intptr_t blah = reinterpret_cast( &(chan->op[opNum]) ); - OpOffsetTable[i] = ChanOffsetTable[ chNum ] + blah; + OpOffsetTable[i] = (Bit16u) (ChanOffsetTable[ chNum ] + blah); } #if 0 //Stupid checks if table's are correct diff --git a/src/devices/sound/openal.c b/src/devices/sound/openal.c index 84dd1af..e3acca1 100644 --- a/src/devices/sound/openal.c +++ b/src/devices/sound/openal.c @@ -8,7 +8,7 @@ * * Interface to the OpenAL sound processing library. * - * Version: @(#)openal.c 1.0.17 2018/10/05 + * Version: @(#)openal.c 1.0.18 2018/10/24 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -63,11 +63,7 @@ #define BUFLEN SOUNDBUFLEN #ifdef _WIN32 -# ifdef _DEBUG -# define PATH_AL_DLL "libopenal-1-debug.dll" -# else -# define PATH_AL_DLL "libopenal-1.dll" -# endif +# define PATH_AL_DLL "libopenal-1.dll" #else # define PATH_AL_DLL "libopenal.so.1" #endif diff --git a/src/devices/sound/resid-fp/sid.cpp b/src/devices/sound/resid-fp/sid.cpp index eda01ab..801f9e0 100644 --- a/src/devices/sound/resid-fp/sid.cpp +++ b/src/devices/sound/resid-fp/sid.cpp @@ -21,15 +21,23 @@ #include #include + extern float convolve(const float *a, const float *b, int n); extern float convolve_sse(const float *a, const float *b, int n); + enum host_cpu_feature { HOST_CPU_MMX=1, HOST_CPU_SSE=2, HOST_CPU_SSE2=4, HOST_CPU_SSE3=8 }; -/* This code is appropriate for 32-bit and 64-bit x86 CPUs. */ -#if defined(__x86_64__) || defined(__i386__) || defined(_MSC_VER) + +/* + * This code is appropriate for 32-bit and 64-bit x86 CPUs. + * + * Note that this inline does work for MSVC 32bit, but not for 64bit. + (defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__))) + */ +#if (defined(_MSC_VER) && !defined(_M_X64)) struct cpu_x86_regs_s { unsigned int eax; @@ -43,7 +51,7 @@ static cpu_x86_regs_t get_cpuid_regs(unsigned int index) { cpu_x86_regs_t retval; -#if defined(_MSC_VER) /* MSVC assembly */ +#ifdef _MSC_VER __asm { mov eax, [index] cpuid @@ -52,7 +60,9 @@ static cpu_x86_regs_t get_cpuid_regs(unsigned int index) mov [retval.ecx], ecx mov [retval.edx], edx } -#else /* GNU assembly */ +#endif + +#ifdef __GNUC__ asm("movl %1, %%eax; cpuid; movl %%eax, %0;" : "=m" (retval.eax) : "r" (index) @@ -149,10 +159,16 @@ static int host_cpu_features(void) #else /* !__x86_64__ && !__i386__ && !_MSC_VER */ static int host_cpu_features(void) { +#if defined(_MSC_VER) && defined(_M_X64) + /* 64bit Windows compiler, we can assume at least SSE2. */ + return HOST_CPU_SSE2; +#endif + return 0; } #endif + float SIDFP::kinked_dac(const int x, const float nonlinearity, const int max) { float value = 0.f; diff --git a/src/devices/system/intel_flash.c b/src/devices/system/intel_flash.c index e8642a3..36a7a18 100644 --- a/src/devices/system/intel_flash.c +++ b/src/devices/system/intel_flash.c @@ -8,7 +8,7 @@ * * Implementation of the Intel 2 Mbit 8-bit flash devices. * - * Version: @(#)intel_flash.c 1.0.7 2018/10/05 + * Version: @(#)intel_flash.c 1.0.8 2018/10/24 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -195,10 +195,10 @@ void *intel_flash_init(uint8_t type) flash = (flash_t *)mem_alloc(sizeof(flash_t)); memset(flash, 0, sizeof(flash_t)); - l = strlen(machine_get_internal_name_ex(machine))+1; + l = (int)strlen(machine_get_internal_name_ex(machine))+1; machine_name = (wchar_t *)mem_alloc(l * sizeof(wchar_t)); mbstowcs(machine_name, machine_get_internal_name_ex(machine), l); - l = wcslen(machine_name)+5; + l = (int)wcslen(machine_name)+5; flash_name = (wchar_t *)mem_alloc(l*sizeof(wchar_t)); swprintf(flash_name, l, L"%ls.bin", machine_name); diff --git a/src/devices/system/nvr_ps2.c b/src/devices/system/nvr_ps2.c index 6ef74f3..1d8efca 100644 --- a/src/devices/system/nvr_ps2.c +++ b/src/devices/system/nvr_ps2.c @@ -8,7 +8,7 @@ * * Handling of the PS/2 series CMOS devices. * - * Version: @(#)nvr_ps2.c 1.0.8 2018/10/05 + * Version: @(#)nvr_ps2.c 1.0.9 2018/10/24 * * Authors: Fred N. van Kempen, * Sarah Walker, @@ -116,7 +116,7 @@ ps2_nvr_init(const device_t *info) /* Set up the NVR file's name. */ sprintf(temp, "%s_sec.nvr", machine_get_internal_name()); - i = strlen(temp) + 1; + i = (int)strlen(temp) + 1; nvr->fn = (wchar_t *)mem_alloc(i * sizeof(wchar_t)); mbstowcs(nvr->fn, temp, i); diff --git a/src/devices/video/vid_voodoo.c b/src/devices/video/vid_voodoo.c index 6fbee9a..0fc3e33 100644 --- a/src/devices/video/vid_voodoo.c +++ b/src/devices/video/vid_voodoo.c @@ -8,7 +8,7 @@ * * Emulation of the 3DFX Voodoo Graphics controller. * - * Version: @(#)vid_voodoo.c 1.0.11 2018/09/23 + * Version: @(#)vid_voodoo.c 1.0.12 2018/10/24 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -2677,20 +2677,18 @@ static inline void voodoo_tmu_fetch_and_blend(voodoo_t *voodoo, voodoo_params_t state->tex_a[0] ^= 0xff; } -#ifdef _WIN32 -# if ((defined(i386) || defined(__i386) || defined(__i386__) || defined(_X86_) || defined(_WIN32)) && !(defined(__amd64__)) && (defined(USE_DYNAREC))) -# include "vid_voodoo_codegen_x86.h" -# elif ((defined(__amd64__)) && (defined(USE_DYNAREC))) +#ifdef USE_DYNAREC +# if (defined(_MSC_VER) && defined(_M_X64)) || (defined(__GNUC__) && defined(__amd64__)) # include "vid_voodoo_codegen_x86-64.h" # else -# define NO_CODEGEN -static int voodoo_recomp = 0; +# include "vid_voodoo_codegen_x86.h" # endif #else # define NO_CODEGEN -//static int voodoo_recomp = 0; +static int voodoo_recomp = 0; #endif + static void voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *state, int ystart, int yend, int odd_even) { /* int rgb_sel = params->fbzColorPath & 3; diff --git a/src/devices/video/vid_voodoo_codegen_x86-64.h b/src/devices/video/vid_voodoo_codegen_x86-64.h index 38a431a..52997a7 100644 --- a/src/devices/video/vid_voodoo_codegen_x86-64.h +++ b/src/devices/video/vid_voodoo_codegen_x86-64.h @@ -8,7 +8,7 @@ * * Implementation of the Voodoo Recompiler (64bit.) * - * Version: @(#)vid_voodoo_codegen_x86-64.h 1.0.1 2018/09/22 + * Version: @(#)vid_voodoo_codegen_x86-64.h 1.0.2 2018/10/24 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -47,12 +47,14 @@ fbzColorPath */ -#ifdef __linux__ -# include -# include -#endif -#if WIN64 +#ifdef _WIN32 # include +# include +#else +# ifdef __linux__ +# include +# include +# endif #endif #include diff --git a/src/machines/m_tandy.c b/src/machines/m_tandy.c index cd15d45..e569bee 100644 --- a/src/machines/m_tandy.c +++ b/src/machines/m_tandy.c @@ -11,7 +11,7 @@ * NOTE: It might be better (after all..) to split off the video * driver from the main code, to keep it a little cleaner. * - * Version: @(#)m_tandy.c 1.0.13 2018/10/05 + * Version: @(#)m_tandy.c 1.0.14 2018/10/24 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -1702,7 +1702,7 @@ eep_init(const device_t *info) /* Set up the EEPROM's file name. */ sprintf(temp, "%s.bin", machine_get_internal_name()); - i = strlen(temp) + 1; + i = (int)strlen(temp) + 1; eep->fn = (wchar_t *)mem_alloc(i * sizeof(wchar_t)); mbstowcs(eep->fn, temp, i); diff --git a/src/mem.c b/src/mem.c index 30def04..a683e67 100644 --- a/src/mem.c +++ b/src/mem.c @@ -173,7 +173,11 @@ flushmmucache(void) mmuflush++; pccache = (uint32_t)0xffffffff; +#ifdef _MSC_VER + pccache2 = (uint8_t *)0xffffffffffffffff; +#else pccache2 = (uint8_t *)0xffffffff; +#endif #ifdef USE_DYNAREC codegen_flush(); diff --git a/src/nvr.c b/src/nvr.c index 4934a23..d6deee2 100644 --- a/src/nvr.c +++ b/src/nvr.c @@ -150,7 +150,7 @@ nvr_init(nvr_t *nvr) strcpy(temp, (const char *)nvr->fn); else strcpy(temp, machine_get_internal_name()); - c = strlen(temp) + 1; + c = (int)strlen(temp) + 1; sp = (wchar_t *)mem_alloc((c+10) * sizeof(wchar_t)); mbstowcs(sp, temp, c); wcscat(sp, NVR_FILE_EXT); diff --git a/src/pc.c b/src/pc.c index 50656b7..285da5a 100644 --- a/src/pc.c +++ b/src/pc.c @@ -8,7 +8,7 @@ * * Main emulator module where most things are controlled. * - * Version: @(#)pc.c 1.0.57 2018/10/16 + * Version: @(#)pc.c 1.0.59 2018/10/24 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -181,7 +181,11 @@ static int fps, /* statistics */ static int unscaled_size_x = SCREEN_RES_X, /* current unscaled size X */ unscaled_size_y = SCREEN_RES_Y, /* current unscaled size Y */ efscrnsz_y = SCREEN_RES_Y; -static FILE *stdlog = NULL; /* file to log output to */ + +static FILE *logfp = NULL; /* logging variables */ +static char logbuff[PCLOG_BUFF_SIZE]; +static int logseen = 0; +static int logdetect = 1; /* @@ -198,16 +202,12 @@ static FILE *stdlog = NULL; /* file to log output to */ void pclog_ex(const char *fmt, va_list ap) { - static char buff[PCLOG_BUFF_SIZE]; - static int seen = 0; - static int detect = 1; char temp[PCLOG_BUFF_SIZE]; FILE *fp; if (fmt == NULL) { /* Initialize. */ - detect = (ap != NULL) ? 1 : 0; - seen = 0; + logseen = 0; return; } @@ -215,22 +215,22 @@ pclog_ex(const char *fmt, va_list ap) if (log_path[0] != L'\0') { fp = plat_fopen(log_path, L"w"); if (fp != NULL) - stdlog = fp; + logfp = fp; } vsprintf(temp, fmt, ap); - if (detect && !strcmp(buff, temp)) { - seen++; + if (logdetect && !strcmp(logbuff, temp)) { + logseen++; } else { - if (seen) { - fprintf(stdlog, "*** %i repeats ***\n", seen); - } - seen = 0; - strcpy(buff, temp); - fprintf(stdlog, temp, ap); + if (logseen) + fprintf(logfp, "*** %i repeats ***\n", logseen); + logseen = 0; + if (logdetect) + strcpy(logbuff, temp); + fprintf(logfp, temp, ap); } - fflush(stdlog); + fflush(logfp); } @@ -241,8 +241,9 @@ pclog(int level, const char *fmt, ...) va_list ap; if (fmt == NULL) { - fflush(stdlog); - fclose(stdlog); + fflush(logfp); + fclose(logfp); + logfp = NULL; return; } @@ -258,7 +259,7 @@ pclog(int level, const char *fmt, ...) void pclog_repeat(int enabled) { - pclog_ex(NULL, (va_list)enabled); + logdetect = !!enabled; } @@ -297,9 +298,8 @@ pclog_dump(int num) sp = NULL; } } - if (sp != NULL) { + if (sp != NULL) DBGLOG(2, "%s\n", buff); - } /* Re-enable the repeat-detection. */ pclog_repeat(1); @@ -317,19 +317,18 @@ fatal(const char *fmt, ...) va_start(ap, fmt); - if (stdlog == NULL) { + if (logfp == NULL) { if (log_path[0] != L'\0') { - stdlog = plat_fopen(log_path, L"w"); - if (stdlog == NULL) - stdlog = stdout; - } else { - stdlog = stdout; - } + logfp = plat_fopen(log_path, L"w"); + if (logfp == NULL) + logfp = stdout; + } else + logfp = stdout; } vsprintf(temp, fmt, ap); - fprintf(stdlog, "%s", temp); - fflush(stdlog); + fprintf(logfp, "%s", temp); + fflush(logfp); va_end(ap); nvr_save(); @@ -351,7 +350,7 @@ fatal(const char *fmt, ...) ui_msgbox(MBX_ERROR|MBX_FATAL|MBX_ANSI, temp); - fflush(stdlog); + fflush(logfp); exit(-1); } @@ -372,6 +371,11 @@ pc_version(const char *platform) #endif strcpy(emu_fullversion, emu_version); +#if (defined(_MSC_VER) && defined(_M_X64)) || \ + (defined(__GNUC__) && defined(__amd64__)) + strcat(emu_fullversion, " [64bit]"); +#endif + #if defined(_MSC_VER) sprintf(temp, " [VC %i]", _MSC_VER); #elif defined(__clang_major__) @@ -407,7 +411,7 @@ pc_version(const char *platform) * * Although we now use relative pathnames in the code, * we may still bump into old configuration files that - * still have old, absolute pathnames. + * have old, absolute pathnames. * * We try to "fix" those by stripping the "usr_path" * component from them, if they have that. If another @@ -418,7 +422,7 @@ pc_path(wchar_t *dst, int sz, const wchar_t *src) { const wchar_t *str = src; wchar_t *ptr = dst; - int i = wcslen(usr_path); + int i = (int)wcslen(usr_path); /* * Fix all the slashes. @@ -505,14 +509,14 @@ pc_setup(int argc, wchar_t *argv[]) plat_getcwd(usr_path, sizeof_w(usr_path)); /* - * Initialize the 'stdlog' variable, this is + * Initialize the 'logfp' variable, this is * somewhat platform-specific. On Windows, it * will always be 'stdout', but on UNIX-based * systems, it can be 'stderr' for the console - * mode (since 'stdout' is used by the UI), - * and 'stdout' for the GUI versins, etc... + * mode (since 'stdout' is used by the UI) and, + * 'stdout' for the GUI versins, etc... */ - stdlog = (FILE *)argv; + logfp = (FILE *)argv; return(0); } diff --git a/src/plat.h b/src/plat.h index 05f4fb4..b5903f3 100644 --- a/src/plat.h +++ b/src/plat.h @@ -8,7 +8,7 @@ * * Define the various platform support functions. * - * Version: @(#)plat.h 1.0.19 2018/10/16 + * Version: @(#)plat.h 1.0.20 2018/10/24 * * Author: Fred N. van Kempen, * @@ -73,7 +73,6 @@ # define off64_t off_t #endif - #ifdef _MSC_VER # define UNUSED(arg) arg #else diff --git a/src/ui/lang/VARCem-BY.str b/src/ui/lang/VARCem-BY.str index 75d044f..f41a01a 100644 --- a/src/ui/lang/VARCem-BY.str +++ b/src/ui/lang/VARCem-BY.str @@ -8,7 +8,7 @@ * * String definitions for "Belorussian (Belarus)" language. * - * Version: @(#)VARCem-BY.str 1.0.5 2018/10/18 + * Version: @(#)VARCem-BY.str 1.0.6 2018/10/23 * * Authors: paul_met, * Fred N. van Kempen, @@ -47,7 +47,7 @@ */ /* Main application strings (2000) - DO NOT TRANSLATE! */ -#define STR_VERSION 1,0,5 +#define STR_VERSION 1,0,6 #define STR_AUTHOR "paul_met" #define STR_EMAIL "paul_met@yandex.ru" #define STR_NAME "VARCem" @@ -71,12 +71,12 @@ /* Application error messages (2300.) */ -#define STR_2300 "System is out of memory!" +#define STR_2300 "Недастаткова памяці!" #define STR_2301 "Не знойдзены падтрымоўваныя вобразы ROM!" #define STR_2302 "Не знойдзена дапушчальная канфігурацыя.\n\nВы хацелі б адкрыць дыялог Налады і стварыць яе??" #define STR_2303 "Сканфігураваны %ls:\n\n %s\n\nнедаступны.\n\nАдкрыць дыялог Налады?" #define STR_2304 "Выбранны рэндэрэр:\n\n %s\n\nнедаступны. Выкарыстоўваць асноўны?" -#define STR_2305 "You must save your settings first!" +#define STR_2305 "Спачатку вы павінны захаваць новыя налады!" #define STR_2306 "Немагчыма стварыць bitmap-файл: %ls" #define STR_2307 "USB пакуль не падтрымліваецца" @@ -98,20 +98,20 @@ /* UI: common elements (3000.) */ #define STR_OK "Добра" #define STR_CANCEL "Адмяніць" -#define STR_YES "Yes" -#define STR_NO "No" +#define STR_YES "Да" +#define STR_NO "Не" #define STR_CONFIGURE "Наладзіць" #define STR_BROWSE "Агляд.." /* UI: dialog shared strings (3100.) */ #define STR_NONE "Адсутнічае" -#define STR_INTERNAL "Internal" +#define STR_INTERNAL "Ўнутраны" #define STR_DISABLED "Недаступна" #define STR_ENABLED "Даступна" #define STR_OFF "Выкл" #define STR_ON "Укл" -#define STR_UNLOCK "Unlock" -#define STR_LOCK "Lock" +#define STR_UNLOCK "Разблакаваць" +#define STR_LOCK "Заблакаваць" #define STR_TYPE "Тып" #define STR_FILENAME "Імя файла:" #define STR_PROGRESS "Прагрэс:" @@ -232,7 +232,7 @@ #define STR_3477 "Трацічны IDE" #define STR_3478 "Чацвярцічны IDE" #define STR_3479 "Прылада ISABugger" -#define STR_3480 "Карта расширения памяти (ISA)" +#define STR_3480 "Карта пашырэння памяці (ISA)" #define STR_3481 "ISA Clock/RTC карта" /* UI dialog: Settings (Hard Disks, 3500.) */ @@ -293,7 +293,7 @@ #define STR_3900 "(пуста)" #define STR_3901 "(хост-дыск %c:)" #define STR_3902 " [Абаронены ад запісу]" -#define STR_3903 " [Locked]" +#define STR_3903 " [Заблакаваны]" #define STR_3904 "Новы вобраз.." #define STR_3905 "Открыть образ.." #define STR_3906 "Загрузіць папярэдні лад" @@ -383,8 +383,8 @@ #define STR_4081 "Налады" #define STR_4082 "Мова" #define STR_4083 "Уваход" -#define STR_4084 "Log Breakpoint" -#define STR_4085 "Toggle %s logging" +#define STR_4084 "Падзельнік лога" +#define STR_4085 "Пераключыць %s логгер" #define STR_4086 "Загрузіць канфігурацыю" #define STR_4087 "Захаваць канфігурацыю" #define STR_4088 "Зрабіць здымак" diff --git a/src/ui/ui_cdrom.c b/src/ui/ui_cdrom.c index 0350cdc..3c4ab72 100644 --- a/src/ui/ui_cdrom.c +++ b/src/ui/ui_cdrom.c @@ -8,7 +8,7 @@ * * Handle the UI part of CD-ROM/ZIP/DISK media changes. * - * Version: @(#)ui_cdrom.c 1.0.4 2018/10/15 + * Version: @(#)ui_cdrom.c 1.0.5 2018/10/24 * * Author: Fred N. van Kempen, * @@ -71,7 +71,7 @@ ui_floppy_mount(uint8_t drive, int part, int8_t wp, const wchar_t *fn) ui_writeprot[drive] = wp; fdd_load(drive, fn); - len = wcslen(floppyfns[drive]); + len = (int)wcslen(floppyfns[drive]); ui_sb_icon_state(SB_FLOPPY | drive, len ? 0 : 1); sb_menu_enable_item(part, IDM_FLOPPY_EJECT | drive, len ? 1 : 0); @@ -145,7 +145,7 @@ ui_zip_mount(uint8_t drive, int part, int8_t wp, const wchar_t *fn) zip_load(zip[drive], fn); zip_insert(zip[drive]); - len = wcslen(zip_drives[drive].image_path); + len = (int)wcslen(zip_drives[drive].image_path); ui_sb_icon_state(SB_ZIP | drive, len ? 0 : 1); sb_menu_enable_item(part, IDM_ZIP_EJECT | drive, len ? 1 : 0); diff --git a/src/win/VARCem.rpp b/src/win/VARCem.rpp index fd2ffa5..473588d 100644 --- a/src/win/VARCem.rpp +++ b/src/win/VARCem.rpp @@ -64,6 +64,8 @@ PREAMBLE #include "resource.h" #define DLLNAME(l) __DLLNM(VARCem, l, dll) #define BLOCKNAME(l) __BLKNM(l) +PREAMBLE #define TEXT_(x) #x +PREAMBLE #define CATSTR(a,b) TEXT_(a ## b) PREAMBLE #ifndef SUBLANG PREAMBLE # define SUBLANG 0x01 /* Lithuanian, for example */ diff --git a/src/win/mingw/Makefile.MinGW b/src/win/mingw/Makefile.MinGW index f3abe41..bbae8dc 100644 --- a/src/win/mingw/Makefile.MinGW +++ b/src/win/mingw/Makefile.MinGW @@ -372,9 +372,9 @@ LIBS := -mwindows \ -lversion -lcomctl32 -lwinmm LIBS += -lwsock32 -liphlpapi -lpsapi LIBS += -static -lstdc++ -lgcc -ifneq ($(X64), y) - LIBS += -Wl,--large-address-aware -endif +#ifneq ($(X64), y) +# LIBS += -Wl,--large-address-aware +#endif # Optional modules. diff --git a/src/win/msvc/Makefile.VC b/src/win/msvc/Makefile.VC index a797cad..1873b28 100644 --- a/src/win/msvc/Makefile.VC +++ b/src/win/msvc/Makefile.VC @@ -8,7 +8,7 @@ # # Makefile for Windows using Visual Studio 2015. # -# Version: @(#)Makefile.VC 1.0.49 2018/10/18 +# Version: @(#)Makefile.VC 1.0.50 2018/10/24 # # Author: Fred N. van Kempen, # @@ -245,13 +245,13 @@ VPATH := $(EXPATH) . cpu \ # VCOPTS := -D_CRT_SECURE_NO_WARNINGS -D__MSC__ ifeq ($(X64), y) - CPP := cl -nologo -arch:amd64 - CC := cl -nologo -arch:amd64 ARCH := x64 + CPP := cl -nologo + CC := cl -nologo else + ARCH := x86 CPP := cl -nologo CC := cl -nologo #-TP - ARCH := x86 endif PREPROC := cl -nologo -EP MCPP := mcpp.exe @@ -272,14 +272,20 @@ OPTS := $(EXTRAS) $(STUFF) $(VCOPTS) \ -D_CRT_SECURE_NO_WARNINGS \ -D_CRT_STDIO_ISO_WIDE_SPECIFIERS \ $(WPCAPINC) $(SYSINC) -AFLAGS := /arch:SSE2 +AFLAGS := #/arch:SSE2 RFLAGS := /n COPTS := -W3 CXXOPTS := -EHsc DOPTS := +ifeq ($(X64), y) +LOPTS := -MACHINE:$(ARCH) -LIBPATH:win\msvc\Lib\$(ARCH) +#LOPTS_C := -SUBSYSTEM:CONSOLE +#LOPTS_W := -SUBSYSTEM:WINDOWS +else LOPTS := -MACHINE:$(ARCH) -LIBPATH:win\msvc\Lib\$(ARCH) LOPTS_C := -SUBSYSTEM:CONSOLE,5.01 LOPTS_W := -SUBSYSTEM:WINDOWS,5.01 +endif ifdef BUILD OPTS += -DBUILD=$(BUILD) endif diff --git a/src/win/win.c b/src/win/win.c index 4b0c9c0..e9d507c 100644 --- a/src/win/win.c +++ b/src/win/win.c @@ -8,7 +8,7 @@ * * Platform main support module for Windows. * - * Version: @(#)win.c 1.0.23 2018/10/17 + * Version: @(#)win.c 1.0.24 2018/10/24 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -122,7 +122,7 @@ ProcessCommandLine(wchar_t ***argw) int i, q, argc; cmdline = GetCommandLine(); - i = wcslen(cmdline) + 1; + i = (int)wcslen(cmdline) + 1; argbuf = (wchar_t *)malloc(sizeof(wchar_t)*i); wcscpy(argbuf, cmdline); @@ -440,7 +440,7 @@ plat_path_abs(const wchar_t *path) wchar_t * plat_get_basename(const wchar_t *path) { - int c = wcslen(path); + int c = (int)wcslen(path); while (c > 0) { if (path[c] == L'/' || path[c] == L'\\') @@ -455,7 +455,7 @@ plat_get_basename(const wchar_t *path) wchar_t * plat_get_filename(const wchar_t *path) { - int c = wcslen(path) - 1; + int c = (int)wcslen(path) - 1; while (c > 0) { if (path[c] == L'/' || path[c] == L'\\') @@ -470,7 +470,7 @@ plat_get_filename(const wchar_t *path) wchar_t * plat_get_extension(const wchar_t *path) { - int c = wcslen(path) - 1; + int c = (int)wcslen(path) - 1; if (c <= 0) return((wchar_t *)path); diff --git a/src/win/win.h b/src/win/win.h index a48f03a..599a930 100644 --- a/src/win/win.h +++ b/src/win/win.h @@ -10,7 +10,7 @@ * only things used globally within the Windows platform; the * generic platform defintions are in the plat.h file. * - * Version: @(#)win.h 1.0.21 2018/10/16 + * Version: @(#)win.h 1.0.22 2018/10/24 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -80,6 +80,15 @@ extern "C" { #endif +/* Cleans up the WinAPI sources a bit. */ +#if (defined(_MSC_VER) && defined(_M_X64)) || \ + (defined(__GNUC__) && defined(__amd64__)) +# define WIN_RESULT LRESULT +#else +# define WIN_RESULT BOOL +#endif + + extern HINSTANCE hInstance; extern HWND hwndMain, hwndRender; diff --git a/src/win/win_about.c b/src/win/win_about.c index d044a42..612a6b3 100644 --- a/src/win/win_about.c +++ b/src/win/win_about.c @@ -12,7 +12,7 @@ * 24bit image would be preferred, but we cant use LoadImage * for those (and keep transparency...) * - * Version: @(#)win_about.c 1.0.10 2018/10/05 + * Version: @(#)win_about.c 1.0.11 2018/10/24 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -109,11 +109,7 @@ localize_disp(HWND hdlg, int idx) } -#ifdef __amd64__ -static LRESULT CALLBACK -#else -static BOOL CALLBACK -#endif +static WIN_RESULT CALLBACK localize_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { HBITMAP hBmp; @@ -135,7 +131,7 @@ localize_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) /* Add the languages. */ h = GetDlgItem(hdlg, IDC_LOCALIZE); for (lang = ui_lang_get()->next; lang != NULL; lang = lang->next) { - c = SendMessage(h, LB_ADDSTRING, 0, (LPARAM)lang->name); + c = (int)SendMessage(h, LB_ADDSTRING, 0, (LPARAM)lang->name); SendMessage(h, LB_SETITEMDATA, c, (LPARAM)lang); } SendMessage(h, LB_SETCURSEL, (WPARAM)0, (LPARAM)0); @@ -169,11 +165,7 @@ localize_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) } -#ifdef __amd64__ -static LRESULT CALLBACK -#else -static BOOL CALLBACK -#endif +static WIN_RESULT CALLBACK about_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { static HBRUSH brush = NULL; diff --git a/src/win/win_cdrom.c b/src/win/win_cdrom.c index 645a309..c94686d 100644 --- a/src/win/win_cdrom.c +++ b/src/win/win_cdrom.c @@ -12,7 +12,7 @@ * * FIXME: Not yet fully working! Getting there, though ;-) * - * Version: @(#)win_cdrom.c 1.0.14 2018/10/20 + * Version: @(#)win_cdrom.c 1.0.15 2018/10/24 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -1271,9 +1271,9 @@ SCSICommand(cdrom_t *dev, const UCHAR *cdb, UCHAR *buf, uint32_t *len, int no_le sptd.s.DataIn = SCSI_IOCTL_DATA_IN; sptd.s.TimeOutValue = 80 * 60; sptd.s.DataTransferLength = get_block_length(dev, cdb, hdev->actual_requested_blocks, no_length_check); - sptd.s.SenseInfoOffset = (uintptr_t)&sptd.sense - (uintptr_t)&sptd; + sptd.s.SenseInfoOffset = (ULONG) ((uintptr_t)&sptd.sense - (uintptr_t)&sptd); sptd.s.SenseInfoLength = 32; - sptd.s.DataBufferOffset = (uintptr_t)&sptd.data - (uintptr_t)&sptd; + sptd.s.DataBufferOffset = (ULONG) ((uintptr_t)&sptd.data - (uintptr_t)&sptd); memcpy(sptd.s.Cdb, cdb, 12); ret = DeviceIoControl(hdev->hIOCTL, IOCTL_SCSI_PASS_THROUGH, diff --git a/src/win/win_crashdump.c b/src/win/win_crashdump.c index 8d85703..b0f1052 100644 --- a/src/win/win_crashdump.c +++ b/src/win/win_crashdump.c @@ -8,7 +8,7 @@ * * Handle generation of crash-dump reports. * - * Version: @(#)win_crashdump.c 1.0.8 2018/10/05 + * Version: @(#)win_crashdump.c 1.0.9 2018/10/24 * * Authors: Fred N. van Kempen, * Riley (Rai-chan), @@ -192,7 +192,7 @@ MakeCrashDump(PEXCEPTION_POINTERS ExceptionInfo) if (ipModule != 0) { sprintf(BufPtr," ["); GetModuleFileName(ipModule, &BufPtr[2], - ExceptionHandlerBufferSize - strlen(ExceptionHandlerBuffer)); + ExceptionHandlerBufferSize - (int)strlen(ExceptionHandlerBuffer)); if (GetLastError() == ERROR_SUCCESS) { BufPtr = &ExceptionHandlerBuffer[strlen(ExceptionHandlerBuffer)]; sprintf(BufPtr,"]"); @@ -231,7 +231,7 @@ MakeCrashDump(PEXCEPTION_POINTERS ExceptionInfo) /* Write the string to disk. */ WriteFile(hDumpFile, ExceptionHandlerBuffer, - strlen(ExceptionHandlerBuffer), NULL, NULL); + (int)strlen(ExceptionHandlerBuffer), NULL, NULL); /* Close the file. */ CloseHandle(hDumpFile); diff --git a/src/win/win_devconf.c b/src/win/win_devconf.c index 421a4d8..2de80d7 100644 --- a/src/win/win_devconf.c +++ b/src/win/win_devconf.c @@ -12,7 +12,7 @@ * and builds a complete Win32 DIALOG resource block in a * buffer in memory, and then passes that to the API handler. * - * Version: @(#)win_devconf.c 1.0.21 2018/10/05 + * Version: @(#)win_devconf.c 1.0.22 2018/10/24 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -170,11 +170,7 @@ dlg_init(HWND hdlg) } -#ifdef __amd64__ -static LRESULT CALLBACK -#else -static BOOL CALLBACK -#endif +static WIN_RESULT CALLBACK dlg_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { wchar_t ws[512], temp[512]; @@ -205,7 +201,7 @@ dlg_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case CONFIG_BINARY: val = config_get_int(dev->name, cfg->name, cfg->default_int); - if (val != SendMessage(h, BM_GETCHECK, 0, 0)) + if (val != (int)SendMessage(h, BM_GETCHECK, 0, 0)) changed = 1; id++; break; @@ -213,7 +209,7 @@ dlg_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case CONFIG_SELECTION: val = config_get_int(dev->name, cfg->name, cfg->default_int); - c = SendMessage(h, CB_GETCURSEL, 0, 0); + c = (int)SendMessage(h, CB_GETCURSEL, 0, 0); for (; c > 0; c--) sel++; @@ -226,7 +222,7 @@ dlg_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case CONFIG_MIDI: val = config_get_int(dev->name, cfg->name, cfg->default_int); - c = SendMessage(h, CB_GETCURSEL, 0, 0); + c = (int)SendMessage(h, CB_GETCURSEL, 0, 0); if (val != c) changed = 1; @@ -260,7 +256,7 @@ dlg_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case CONFIG_HEX16: val = config_get_hex16(dev->name, cfg->name, cfg->default_int); - c = SendMessage(h, CB_GETCURSEL, 0, 0); + c = (int)SendMessage(h, CB_GETCURSEL, 0, 0); for (; c > 0; c--) sel++; @@ -273,7 +269,7 @@ dlg_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case CONFIG_HEX20: val = config_get_hex20(dev->name, cfg->name, cfg->default_int); - c = SendMessage(h, CB_GETCURSEL, 0, 0); + c = (int)SendMessage(h, CB_GETCURSEL, 0, 0); for (; c > 0; c--) sel++; @@ -303,13 +299,13 @@ dlg_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) switch (cfg->type) { case CONFIG_BINARY: - config_set_int(dev->name, cfg->name, SendMessage(h, BM_GETCHECK, 0, 0)); + config_set_int(dev->name, cfg->name, (int)SendMessage(h, BM_GETCHECK, 0, 0)); id++; break; case CONFIG_SELECTION: - c = SendMessage(h, CB_GETCURSEL, 0, 0); + c = (int)SendMessage(h, CB_GETCURSEL, 0, 0); for (; c > 0; c--) sel++; config_set_int(dev->name, cfg->name, sel->value); @@ -318,7 +314,7 @@ dlg_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) break; case CONFIG_MIDI: - c = SendMessage(h, CB_GETCURSEL, 0, 0); + c = (int)SendMessage(h, CB_GETCURSEL, 0, 0); config_set_int(dev->name, cfg->name, c); id += 2; @@ -346,7 +342,7 @@ dlg_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) break; case CONFIG_HEX16: - c = SendMessage(h, CB_GETCURSEL, 0, 0); + c = (int)SendMessage(h, CB_GETCURSEL, 0, 0); for (; c > 0; c--) sel++; config_set_hex16(dev->name, cfg->name, sel->value); @@ -355,7 +351,7 @@ dlg_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) break; case CONFIG_HEX20: - c = SendMessage(h, CB_GETCURSEL, 0, 0); + c = (int)SendMessage(h, CB_GETCURSEL, 0, 0); for (; c > 0; c--) sel++; config_set_hex20(dev->name, cfg->name, sel->value); @@ -423,7 +419,7 @@ dlg_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) //FIXME: localize strcat(file_filter, "|All files (*.*)|*.*|"); mbstowcs(ws, file_filter, strlen(file_filter) + 1); - d = strlen(file_filter); + d = (int)strlen(file_filter); /* replace | with \0 */ for (c = 0; c < d; ++c) diff --git a/src/win/win_dialog.c b/src/win/win_dialog.c index 35f89ee..ada3793 100644 --- a/src/win/win_dialog.c +++ b/src/win/win_dialog.c @@ -8,7 +8,7 @@ * * Implementation of server several dialogs. * - * Version: @(#)win_dialog.c 1.0.13 2018/10/05 + * Version: @(#)win_dialog.c 1.0.14 2018/10/24 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -168,8 +168,14 @@ ui_msgbox(int flags, const void *arg) * higher than the numeric ID's. So, we guesswork * that if the value of 'arg' is low, its an ID.. */ - if (((uintptr_t)arg) < ((uintptr_t)65636)) +#if (defined(_MSC_VER) && defined(_M_X64)) || \ + (defined(__GNUC__) && defined(__amd64__)) + if (((uintptr_t)arg) < ((uintptr_t)65636ULL)) + str = get_string(((intptr_t)arg) & 0xffff); +#else + if (((uint32_t)arg) < ((uint32_t)65636)) str = get_string((intptr_t)arg); +#endif } /* Create a hook for the MessageBox dialog. */ diff --git a/src/win/win_joystick.cpp b/src/win/win_joystick.cpp index c316530..d8a8f67 100644 --- a/src/win/win_joystick.cpp +++ b/src/win/win_joystick.cpp @@ -13,7 +13,7 @@ * NOTE: Hacks currently needed to compile with MSVC; DX needs to * be updated to 11 or 12 or so. --FvK * - * Version: @(#)win_joystick.cpp 1.0.18 2018/10/05 + * Version: @(#)win_joystick.cpp 1.0.20 2018/10/24 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -387,7 +387,7 @@ rebuild_selections(HWND hdlg) HWND h; h = GetDlgItem(hdlg, IDC_CONFIGURE_DEV); - joystick = SendMessage(h, CB_GETCURSEL, 0, 0); + joystick = (int)SendMessage(h, CB_GETCURSEL, 0, 0); for (c = 0; c < gamedev_get_axis_count(joystick_config_type); c++) { int sel = c; @@ -467,7 +467,7 @@ static int get_axis(HWND hdlg, int id) { HWND h = GetDlgItem(hdlg, id); - int axis_sel = SendMessage(h, CB_GETCURSEL, 0, 0); + int axis_sel = (int)SendMessage(h, CB_GETCURSEL, 0, 0); int nr_axes = plat_joystick_state[joystick_state[joystick_nr].plat_joystick_nr-1].nr_axes; if (axis_sel < nr_axes) @@ -485,7 +485,7 @@ static int get_pov(HWND hdlg, int id) { HWND h = GetDlgItem(hdlg, id); - int axis_sel = SendMessage(h, CB_GETCURSEL, 0, 0); + int axis_sel = (int)SendMessage(h, CB_GETCURSEL, 0, 0); int nr_povs = plat_joystick_state[joystick_state[joystick_nr].plat_joystick_nr-1].nr_povs*2; if (axis_sel < nr_povs) { @@ -569,11 +569,7 @@ dlg_init(HWND hdlg) } -#ifdef __amd64__ -static LRESULT CALLBACK -#else -static BOOL CALLBACK -#endif +static WIN_RESULT CALLBACK dlg_proc(HWND hdlg, UINT message, WPARAM wParam, UNUSED(LPARAM lParam)) { HWND h; @@ -596,7 +592,7 @@ dlg_proc(HWND hdlg, UINT message, WPARAM wParam, UNUSED(LPARAM lParam)) id = IDC_CONFIGURE_DEV + 2; h = GetDlgItem(hdlg, IDC_CONFIGURE_DEV); - joystick_state[joystick_nr].plat_joystick_nr = SendMessage(h, CB_GETCURSEL, 0, 0); + joystick_state[joystick_nr].plat_joystick_nr = (int)SendMessage(h, CB_GETCURSEL, 0, 0); if (joystick_state[joystick_nr].plat_joystick_nr) { for (c = 0; c < gamedev_get_axis_count(joystick_config_type); c++) { @@ -605,7 +601,7 @@ dlg_proc(HWND hdlg, UINT message, WPARAM wParam, UNUSED(LPARAM lParam)) } for (c = 0; c < gamedev_get_button_count(joystick_config_type); c++) { h = GetDlgItem(hdlg, id); - joystick_state[joystick_nr].button_mapping[c] = SendMessage(h, CB_GETCURSEL, 0, 0); + joystick_state[joystick_nr].button_mapping[c] = (int)SendMessage(h, CB_GETCURSEL, 0, 0); id += 2; } for (c = 0; c < gamedev_get_button_count(joystick_config_type); c++) { diff --git a/src/win/win_lang.c b/src/win/win_lang.c index 13f0612..501bc0d 100644 --- a/src/win/win_lang.c +++ b/src/win/win_lang.c @@ -8,7 +8,7 @@ * * Handle language support for the platform. * - * Version: @(#)win_lang.c 1.0.7 2018/10/07 + * Version: @(#)win_lang.c 1.0.8 2018/10/24 * * Author: Fred N. van Kempen, * @@ -116,7 +116,7 @@ plat_lang_scan(void) DIR *dir; int l, lflen; - lflen = wcslen(LANG_FILE); + lflen = (int)wcslen(LANG_FILE); /* Open the "language modules" directory. */ swprintf(path, sizeof_w(path), L"%ls%ls", exe_path, LANGUAGE_PATH); @@ -137,7 +137,7 @@ plat_lang_scan(void) /* Looks like we have one here.. */ memset(temp, 0x00, sizeof(temp)); swprintf(temp, sizeof_w(temp), L"%ls\\%ls", path, de->d_name); - l = wcslen(temp) + 1; + l = (int)wcslen(temp) + 1; /* Create a buffer for the DLL file name. */ memset(&lang, 0x00, sizeof(lang)); @@ -191,7 +191,7 @@ plat_lang_scan(void) while (*str != L'\0') *ptr++ = *str++; *ptr++ = *str++; - l -= (ptr - temp); + l -= (int)(ptr - temp); ptr = (wchar_t *)mem_alloc(sizeof(wchar_t) * (ptr-temp)); wcscpy(ptr, temp); lang.author = (const wchar_t *)ptr; diff --git a/src/win/win_new_image.c b/src/win/win_new_image.c index 1fb55ca..e80ad84 100644 --- a/src/win/win_new_image.c +++ b/src/win/win_new_image.c @@ -8,7 +8,7 @@ * * Implementation of the New Floppy/ZIP Image dialog. * - * Version: @(#)win_new_image.c 1.0.20 2018/10/05 + * Version: @(#)win_new_image.c 1.0.21 2018/10/24 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -118,11 +118,7 @@ dlg_init(HWND hdlg) } -#ifdef __amd64__ -static LRESULT CALLBACK -#else -static BOOL CALLBACK -#endif +static WIN_RESULT CALLBACK dlg_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { wchar_t temp_path[512]; @@ -150,13 +146,13 @@ dlg_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) switch (LOWORD(wParam)) { case IDOK: h = GetDlgItem(hdlg, IDC_COMBO_DISK_SIZE); - disk_size = SendMessage(h, CB_GETCURSEL, 0, 0); + disk_size = (int)SendMessage(h, CB_GETCURSEL, 0, 0); if (is_zip) disk_size += 12; if (file_type == 2) { h = GetDlgItem(hdlg, IDC_COMBO_RPM_MODE); - rpm_mode = SendMessage(h, CB_GETCURSEL, 0, 0); + rpm_mode = (int)SendMessage(h, CB_GETCURSEL, 0, 0); ret = floppy_create_86f(fd_file_name, disk_size, rpm_mode); } else { if (is_zip) @@ -216,7 +212,7 @@ dlg_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) h = GetDlgItem(hdlg, IDC_COMBO_DISK_SIZE); if (!is_zip || zip_drives[drive_id].is_250) EnableWindow(h, TRUE); - wcs_len = wcslen(temp_path); + wcs_len = (int)wcslen(temp_path); ext_offs = wcs_len - 4; ext = &(temp_path[ext_offs]); if (is_zip) { diff --git a/src/win/win_opendir.h b/src/win/win_opendir.h index 8b0fdc5..bc14cfe 100644 --- a/src/win/win_opendir.h +++ b/src/win/win_opendir.h @@ -8,7 +8,7 @@ * * Definitions for the platform OpenDir module. * - * Version: @(#)win_opendir.h 1.0.4 2018/09/25 + * Version: @(#)win_opendir.h 1.0.5 2018/10/24 * * Author: Fred N. van Kempen, * @@ -68,7 +68,7 @@ struct direct { typedef struct { short flags; /* internal flags */ short offset; /* offset of entry into dir */ - long handle; /* open handle to Win32 system */ + intptr_t handle; /* open handle to Win32 system */ short sts; /* last known status code */ char *dta; /* internal work data */ wchar_t dir[MAXDIRLEN+1]; /* open dir */ diff --git a/src/win/win_settings.c b/src/win/win_settings.c index 6752f44..cc4b734 100644 --- a/src/win/win_settings.c +++ b/src/win/win_settings.c @@ -8,7 +8,7 @@ * * Implementation of the Settings dialog. * - * Version: @(#)win_settings.c 1.0.35 2018/10/15 + * Version: @(#)win_settings.c 1.0.37 2018/10/24 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -592,11 +592,7 @@ insert_categories(HWND hwndList) } -#ifdef __amd64__ -static LRESULT CALLBACK -#else -static BOOL CALLBACK -#endif +static WIN_RESULT CALLBACK dlg_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { HWND h; @@ -700,7 +696,7 @@ find_roms(void) /* Is this machine available? */ if (machine_available(c)) { /* Allocate space and copy name to Unicode. */ - i = strlen(str) + 1; + i = (int)strlen(str) + 1; mach_names[d] = (wchar_t *)mem_alloc(i * sizeof(wchar_t)); mbstowcs(mach_names[d], str, i); diff --git a/src/win/win_settings_disk.h b/src/win/win_settings_disk.h index 0756c86..1accf4a 100644 --- a/src/win/win_settings_disk.h +++ b/src/win/win_settings_disk.h @@ -8,7 +8,7 @@ * * Implementation of the Settings dialog. * - * Version: @(#)win_settings_disk.h 1.0.16 2018/10/15 + * Version: @(#)win_settings_disk.h 1.0.18 2018/10/24 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -290,7 +290,7 @@ disk_recalc_location_controls(HWND hdlg, int is_add_dlg, int assign_id) if ((hd_listview_items > 0) || is_add_dlg) { h = GetDlgItem(hdlg, IDC_COMBO_HD_BUS); - bus = SendMessage(h, CB_GETCURSEL, 0, 0); + bus = (int)SendMessage(h, CB_GETCURSEL, 0, 0); switch(bus) { case HDD_BUS_ST506: /* ST506 MFM/RLL */ @@ -705,7 +705,7 @@ get_combo_box_selection(HWND hdlg, int id, uint64_t *val) HWND h; h = GetDlgItem(hdlg, id); - *val = SendMessage(h, CB_GETCURSEL, 0, 0); + *val = (uint64_t)SendMessage(h, CB_GETCURSEL, 0, 0); } @@ -780,11 +780,7 @@ disk_recalc_selection(HWND hdlg) } -#ifdef __amd64__ -static LRESULT CALLBACK -#else -static BOOL CALLBACK -#endif +static WIN_RESULT CALLBACK disk_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { wchar_t temp_path[512]; @@ -936,7 +932,7 @@ disk_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case IDOK: if (!(existing & 2)) { h = GetDlgItem(hdlg, IDC_COMBO_HD_BUS); - hdd_ptr->bus = SendMessage(h, CB_GETCURSEL, 0, 0) & 0xff; + hdd_ptr->bus = (int)SendMessage(h, CB_GETCURSEL, 0, 0) & 0xff; } /* Do we have a file name? */ @@ -979,24 +975,24 @@ disk_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) switch(hdd_ptr->bus) { case HDD_BUS_ST506: h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL); - hdd_ptr->bus_id.st506_channel = SendMessage(h, CB_GETCURSEL, 0, 0) & 0xff; + hdd_ptr->bus_id.st506_channel = (int)SendMessage(h, CB_GETCURSEL, 0, 0) & 0xff; break; case HDD_BUS_ESDI: h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL); - hdd_ptr->bus_id.esdi_channel = SendMessage(h, CB_GETCURSEL, 0, 0) & 0xff; + hdd_ptr->bus_id.esdi_channel = (int)SendMessage(h, CB_GETCURSEL, 0, 0) & 0xff; break; case HDD_BUS_IDE: h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL_IDE); - hdd_ptr->bus_id.ide_channel = SendMessage(h, CB_GETCURSEL, 0, 0) & 0xff; + hdd_ptr->bus_id.ide_channel = (int)SendMessage(h, CB_GETCURSEL, 0, 0) & 0xff; break; case HDD_BUS_SCSI: h = GetDlgItem(hdlg, IDC_COMBO_HD_ID); - hdd_ptr->bus_id.scsi.id = SendMessage(h, CB_GETCURSEL, 0, 0) & 0xff; + hdd_ptr->bus_id.scsi.id = (uint8_t)SendMessage(h, CB_GETCURSEL, 0, 0) & 0xff; h = GetDlgItem(hdlg, IDC_COMBO_HD_LUN); - hdd_ptr->bus_id.scsi.lun = SendMessage(h, CB_GETCURSEL, 0, 0) & 0xff; + hdd_ptr->bus_id.scsi.lun = (uint8_t)SendMessage(h, CB_GETCURSEL, 0, 0) & 0xff; break; case HDD_BUS_USB: @@ -1380,7 +1376,7 @@ hdd_add_file_open_error: no_update = 1; disk_recalc_location_controls(hdlg, 1, 0); h = GetDlgItem(hdlg, IDC_COMBO_HD_BUS); - b = SendMessage(h,CB_GETCURSEL,0,0) + 1; + b = (int)SendMessage(h,CB_GETCURSEL,0,0) + 1; if (b == hdd_ptr->bus) goto hd_add_bus_skip; @@ -1575,11 +1571,7 @@ disk_track_all(void) } -#ifdef __amd64__ -static LRESULT CALLBACK -#else -static BOOL CALLBACK -#endif +static WIN_RESULT CALLBACK disk_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { HWND h; @@ -1655,7 +1647,7 @@ disk_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) ignore_change = 1; h = GetDlgItem(hdlg, IDC_COMBO_HD_BUS); - b = SendMessage(h, CB_GETCURSEL, 0, 0); + b = (int)SendMessage(h, CB_GETCURSEL, 0, 0); if (b == temp_hdd[hdlv_current_sel].bus) goto hd_bus_skip; disk_untrack(hdlv_current_sel); @@ -1679,9 +1671,9 @@ hd_bus_skip: h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL); disk_untrack(hdlv_current_sel); if (temp_hdd[hdlv_current_sel].bus == HDD_BUS_ST506) - temp_hdd[hdlv_current_sel].bus_id.st506_channel = SendMessage(h, CB_GETCURSEL, 0, 0) & 0xff; + temp_hdd[hdlv_current_sel].bus_id.st506_channel = (int)SendMessage(h, CB_GETCURSEL, 0, 0) & 0xff; else if (temp_hdd[hdlv_current_sel].bus == HDD_BUS_ESDI) - temp_hdd[hdlv_current_sel].bus_id.esdi_channel = SendMessage(h, CB_GETCURSEL, 0, 0) & 0xff; + temp_hdd[hdlv_current_sel].bus_id.esdi_channel = (int)SendMessage(h, CB_GETCURSEL, 0, 0) & 0xff; disk_track(hdlv_current_sel); h = GetDlgItem(hdlg, IDC_LIST_HARD_DISKS); disk_update_item(h, hdlv_current_sel, 0); @@ -1695,7 +1687,7 @@ hd_bus_skip: ignore_change = 1; h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL_IDE); disk_untrack(hdlv_current_sel); - temp_hdd[hdlv_current_sel].bus_id.ide_channel = SendMessage(h, CB_GETCURSEL, 0, 0) & 0xff; + temp_hdd[hdlv_current_sel].bus_id.ide_channel = (int)SendMessage(h, CB_GETCURSEL, 0, 0) & 0xff; disk_track(hdlv_current_sel); h = GetDlgItem(hdlg, IDC_LIST_HARD_DISKS); disk_update_item(h, hdlv_current_sel, 0); @@ -1709,7 +1701,7 @@ hd_bus_skip: ignore_change = 1; h = GetDlgItem(hdlg, IDC_COMBO_HD_ID); disk_untrack(hdlv_current_sel); - temp_hdd[hdlv_current_sel].bus_id.scsi.id = SendMessage(h, CB_GETCURSEL, 0, 0) & 0xff; + temp_hdd[hdlv_current_sel].bus_id.scsi.id = (uint8_t)SendMessage(h, CB_GETCURSEL, 0, 0) & 0xff; disk_track(hdlv_current_sel); h = GetDlgItem(hdlg, IDC_LIST_HARD_DISKS); disk_update_item(h, hdlv_current_sel, 0); @@ -1723,7 +1715,7 @@ hd_bus_skip: ignore_change = 1; h = GetDlgItem(hdlg, IDC_COMBO_HD_LUN); disk_untrack(hdlv_current_sel); - temp_hdd[hdlv_current_sel].bus_id.scsi.lun = SendMessage(h, CB_GETCURSEL, 0, 0) & 0xff; + temp_hdd[hdlv_current_sel].bus_id.scsi.lun = (uint8_t)SendMessage(h, CB_GETCURSEL, 0, 0) & 0xff; disk_track(hdlv_current_sel); h = GetDlgItem(hdlg, IDC_LIST_HARD_DISKS); disk_update_item(h, hdlv_current_sel, 0); diff --git a/src/win/win_settings_floppy.h b/src/win/win_settings_floppy.h index 1a62c72..7ffc43c 100644 --- a/src/win/win_settings_floppy.h +++ b/src/win/win_settings_floppy.h @@ -8,7 +8,7 @@ * * Implementation of the Settings dialog. * - * Version: @(#)win_settings_floppy.h 1.0.7 2018/09/19 + * Version: @(#)win_settings_floppy.h 1.0.9 2018/10/24 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -202,11 +202,7 @@ floppy_update_item(HWND hwndList, int i) } -#ifdef __amd64__ -static LRESULT CALLBACK -#else -static BOOL CALLBACK -#endif +static WIN_RESULT CALLBACK floppy_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { WCHAR temp[128]; @@ -281,7 +277,7 @@ floppy_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) fd_ignore_change = 1; h = GetDlgItem(hdlg, IDC_COMBO_FD_TYPE); - temp_fdd_types[fdlv_current_sel] = SendMessage(h, CB_GETCURSEL, 0, 0); + temp_fdd_types[fdlv_current_sel] = (int)SendMessage(h, CB_GETCURSEL, 0, 0); h = GetDlgItem(hdlg, IDC_LIST_FLOPPY_DRIVES); floppy_update_item(h, fdlv_current_sel); fd_ignore_change = 0; @@ -293,7 +289,7 @@ floppy_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) fd_ignore_change = 1; h = GetDlgItem(hdlg, IDC_CHECKTURBO); - temp_fdd_turbo[fdlv_current_sel] = SendMessage(h, BM_GETCHECK, 0, 0); + temp_fdd_turbo[fdlv_current_sel] = (int)SendMessage(h, BM_GETCHECK, 0, 0); h = GetDlgItem(hdlg, IDC_LIST_FLOPPY_DRIVES); floppy_update_item(h, fdlv_current_sel); fd_ignore_change = 0; @@ -305,7 +301,7 @@ floppy_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) fd_ignore_change = 1; h = GetDlgItem(hdlg, IDC_CHECKBPB); - temp_fdd_check_bpb[fdlv_current_sel] = SendMessage(h, BM_GETCHECK, 0, 0); + temp_fdd_check_bpb[fdlv_current_sel] = (int)SendMessage(h, BM_GETCHECK, 0, 0); h = GetDlgItem(hdlg, IDC_LIST_FLOPPY_DRIVES); floppy_update_item(h, fdlv_current_sel); fd_ignore_change = 0; diff --git a/src/win/win_settings_input.h b/src/win/win_settings_input.h index ee08911..fb4788c 100644 --- a/src/win/win_settings_input.h +++ b/src/win/win_settings_input.h @@ -8,7 +8,7 @@ * * Implementation of the Settings dialog. * - * Version: @(#)win_settings_input.h 1.0.9 2018/10/20 + * Version: @(#)win_settings_input.h 1.0.11 2018/10/24 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -60,11 +60,7 @@ mouse_valid(int num, int m) } -#ifdef __amd64__ -static LRESULT CALLBACK -#else -static BOOL CALLBACK -#endif +static WIN_RESULT CALLBACK input_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { WCHAR temp[128]; @@ -165,7 +161,7 @@ input_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case IDC_COMBO_JOYSTICK: h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK); - temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0); + temp_joystick = (int)SendMessage(h, CB_GETCURSEL, 0, 0); h = GetDlgItem(hdlg, IDC_CONFIGURE_JOY1); EnableWindow(h, (gamedev_get_max_joysticks(temp_joystick) >= 1) ? TRUE : FALSE); @@ -179,25 +175,25 @@ input_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case IDC_CONFIGURE_JOY1: h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK); - temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0); + temp_joystick = (int)SendMessage(h, CB_GETCURSEL, 0, 0); temp_deviceconfig |= dlg_jsconf(hdlg, 0, temp_joystick); break; case IDC_CONFIGURE_JOY2: h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK); - temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0); + temp_joystick = (int)SendMessage(h, CB_GETCURSEL, 0, 0); temp_deviceconfig |= dlg_jsconf(hdlg, 1, temp_joystick); break; case IDC_CONFIGURE_JOY3: h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK); - temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0); + temp_joystick = (int)SendMessage(h, CB_GETCURSEL, 0, 0); temp_deviceconfig |= dlg_jsconf(hdlg, 2, temp_joystick); break; case IDC_CONFIGURE_JOY4: h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK); - temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0); + temp_joystick = (int)SendMessage(h, CB_GETCURSEL, 0, 0); temp_deviceconfig |= dlg_jsconf(hdlg, 3, temp_joystick); break; } @@ -208,7 +204,7 @@ input_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) temp_mouse = list_to_mouse[SendMessage(h, CB_GETCURSEL, 0, 0)]; h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK); - temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0); + temp_joystick = (int)SendMessage(h, CB_GETCURSEL, 0, 0); return FALSE; default: diff --git a/src/win/win_settings_machine.h b/src/win/win_settings_machine.h index b1571fa..64d72e9 100644 --- a/src/win/win_settings_machine.h +++ b/src/win/win_settings_machine.h @@ -8,7 +8,7 @@ * * Implementation of the Settings dialog. * - * Version: @(#)win_settings_machine.h 1.0.9 2018/09/29 + * Version: @(#)win_settings_machine.h 1.0.11 2018/10/24 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -200,11 +200,7 @@ machine_recalc_machine(HWND hdlg) } -#ifdef __amd64__ -static LRESULT CALLBACK -#else -static BOOL CALLBACK -#endif +static WIN_RESULT CALLBACK machine_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { WCHAR temp[128]; @@ -269,7 +265,7 @@ machine_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case IDC_COMBO_MACHINE: if (HIWORD(wParam) == CBN_SELCHANGE) { h = GetDlgItem(hdlg, IDC_COMBO_MACHINE); - d = SendMessage(h, CB_GETCURSEL, 0, 0); + d = (int)SendMessage(h, CB_GETCURSEL, 0, 0); temp_machine = list_to_mach[d]; machine_recalc_machine(hdlg); } @@ -278,7 +274,7 @@ machine_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case IDC_COMBO_CPU_TYPE: if (HIWORD(wParam) == CBN_SELCHANGE) { h = GetDlgItem(hdlg, IDC_COMBO_CPU_TYPE); - temp_cpu_m = SendMessage(h, CB_GETCURSEL, 0, 0); + temp_cpu_m = (int)SendMessage(h, CB_GETCURSEL, 0, 0); temp_cpu = 0; machine_recalc_cpu_m(hdlg); @@ -288,7 +284,7 @@ machine_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case IDC_COMBO_CPU: if (HIWORD(wParam) == CBN_SELCHANGE) { h = GetDlgItem(hdlg, IDC_COMBO_CPU); - temp_cpu = SendMessage(h, CB_GETCURSEL, 0, 0); + temp_cpu = (int)SendMessage(h, CB_GETCURSEL, 0, 0); machine_recalc_cpu(hdlg); } @@ -296,7 +292,7 @@ machine_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case IDC_CONFIGURE_MACHINE: h = GetDlgItem(hdlg, IDC_COMBO_MACHINE); - d = SendMessage(h, CB_GETCURSEL, 0, 0); + d = (int)SendMessage(h, CB_GETCURSEL, 0, 0); temp_machine = list_to_mach[d]; temp_deviceconfig |= dlg_devconf(hdlg, machine_getdevice(temp_machine)); break; @@ -304,7 +300,7 @@ machine_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case IDC_COMBO_SYNC: if (HIWORD(wParam) == CBN_SELCHANGE) { h = GetDlgItem(hdlg, IDC_COMBO_SYNC); - temp_sync = SendMessage(h, CB_GETCURSEL, 0, 0); + temp_sync = (int)SendMessage(h, CB_GETCURSEL, 0, 0); } break; } @@ -314,14 +310,14 @@ machine_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case WM_SAVE_CFG: #ifdef USE_DYNAREC h = GetDlgItem(hdlg, IDC_CHECK_DYNAREC); - temp_dynarec = SendMessage(h, BM_GETCHECK, 0, 0); + temp_dynarec = (int)SendMessage(h, BM_GETCHECK, 0, 0); #endif h = GetDlgItem(hdlg, IDC_CHECK_FPU); - temp_fpu = SendMessage(h, BM_GETCHECK, 0, 0); + temp_fpu = (int)SendMessage(h, BM_GETCHECK, 0, 0); h = GetDlgItem(hdlg, IDC_COMBO_WS); - temp_wait_states = SendMessage(h, CB_GETCURSEL, 0, 0); + temp_wait_states = (int)SendMessage(h, CB_GETCURSEL, 0, 0); h = GetDlgItem(hdlg, IDC_MEMTEXT); SendMessage(h, WM_GETTEXT, sizeof_w(temp), (LPARAM)temp); diff --git a/src/win/win_settings_network.h b/src/win/win_settings_network.h index 831e945..1e03461 100644 --- a/src/win/win_settings_network.h +++ b/src/win/win_settings_network.h @@ -8,7 +8,7 @@ * * Implementation of the Settings dialog. * - * Version: @(#)win_settings_network.h 1.0.8 2018/10/20 + * Version: @(#)win_settings_network.h 1.0.10 2018/10/24 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -84,11 +84,7 @@ network_recalc_combos(HWND hdlg) } -#ifdef __amd64__ -static LRESULT CALLBACK -#else -static BOOL CALLBACK -#endif +static WIN_RESULT CALLBACK network_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { char tempA[128]; @@ -170,7 +166,7 @@ network_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) return FALSE; h = GetDlgItem(hdlg, IDC_COMBO_NET_TYPE); - temp_net_type = SendMessage(h, CB_GETCURSEL, 0, 0); + temp_net_type = (int)SendMessage(h, CB_GETCURSEL, 0, 0); network_recalc_combos(hdlg); break; @@ -210,7 +206,7 @@ network_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case WM_SAVE_CFG: h = GetDlgItem(hdlg, IDC_COMBO_NET_TYPE); - temp_net_type = SendMessage(h, CB_GETCURSEL, 0, 0); + temp_net_type = (int)SendMessage(h, CB_GETCURSEL, 0, 0); h = GetDlgItem(hdlg, IDC_COMBO_PCAP); memset(temp_host_dev, '\0', sizeof(temp_host_dev)); diff --git a/src/win/win_settings_periph.h b/src/win/win_settings_periph.h index 5d72078..44b2b04 100644 --- a/src/win/win_settings_periph.h +++ b/src/win/win_settings_periph.h @@ -8,7 +8,7 @@ * * Implementation of the Settings dialog. * - * Version: @(#)win_settings_periph.h 1.0.14 2018/10/20 + * Version: @(#)win_settings_periph.h 1.0.16 2018/10/24 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -154,11 +154,7 @@ INFO("[%d]=%d\n", c, hdc_to_list[c], d, list_to_hdc[d]); } -#ifdef __amd64__ -static LRESULT CALLBACK -#else -static BOOL CALLBACK -#endif +static WIN_RESULT CALLBACK peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { WCHAR temp[128]; @@ -304,7 +300,7 @@ peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case IDC_CHECK_IDE_TER: h = GetDlgItem(hdlg, IDC_CHECK_IDE_TER); - temp_ide_ter = SendMessage(h, BM_GETCHECK, 0, 0); + temp_ide_ter = (int)SendMessage(h, BM_GETCHECK, 0, 0); h = GetDlgItem(hdlg, IDC_CONFIGURE_IDE_TER); EnableWindow(h, temp_ide_ter ? TRUE : FALSE); break; @@ -315,7 +311,7 @@ peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case IDC_CHECK_IDE_QUA: h = GetDlgItem(hdlg, IDC_CHECK_IDE_QUA); - temp_ide_qua = SendMessage(h, BM_GETCHECK, 0, 0); + temp_ide_qua = (int)SendMessage(h, BM_GETCHECK, 0, 0); h = GetDlgItem(hdlg, IDC_CONFIGURE_IDE_QUA); EnableWindow(h, temp_ide_qua ? TRUE : FALSE); break; @@ -326,7 +322,7 @@ peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case IDC_COMBO_ISARTC: h = GetDlgItem(hdlg, IDC_COMBO_ISARTC); - temp_isartc = SendMessage(h, CB_GETCURSEL, 0, 0); + temp_isartc = (int)SendMessage(h, CB_GETCURSEL, 0, 0); h = GetDlgItem(hdlg, IDC_CONFIGURE_ISARTC); if (temp_isartc != 0) EnableWindow(h, TRUE); @@ -340,7 +336,7 @@ peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case IDC_COMBO_ISAMEM_4: c = LOWORD(wParam) - IDC_COMBO_ISAMEM_1; h = GetDlgItem(hdlg, LOWORD(wParam)); - temp_isamem[c] = SendMessage(h, CB_GETCURSEL, 0, 0); + temp_isamem[c] = (int)SendMessage(h, CB_GETCURSEL, 0, 0); h = GetDlgItem(hdlg, IDC_CONFIGURE_ISAMEM_1 + c); if (temp_isamem[c] != 0) @@ -371,15 +367,15 @@ peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case WM_SAVE_CFG: h = GetDlgItem(hdlg, IDC_COMBO_HDC); - c = SendMessage(h, CB_GETCURSEL, 0, 0); + c = (int)SendMessage(h, CB_GETCURSEL, 0, 0); temp_hdc_type = list_to_hdc[c]; h = GetDlgItem(hdlg, IDC_COMBO_SCSI); - c = SendMessage(h, CB_GETCURSEL, 0, 0); + c = (int)SendMessage(h, CB_GETCURSEL, 0, 0); temp_scsi_card = list_to_scsi[c]; h = GetDlgItem(hdlg, IDC_CHECK_BUGGER); - temp_bugger = SendMessage(h, BM_GETCHECK, 0, 0); + temp_bugger = (int)SendMessage(h, BM_GETCHECK, 0, 0); return FALSE; diff --git a/src/win/win_settings_ports.h b/src/win/win_settings_ports.h index 7422ee4..a0728f3 100644 --- a/src/win/win_settings_ports.h +++ b/src/win/win_settings_ports.h @@ -8,7 +8,7 @@ * * Implementation of the Settings dialog. * - * Version: @(#)win_settings_ports.h 1.0.5 2018/10/20 + * Version: @(#)win_settings_ports.h 1.0.7 2018/10/24 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -42,11 +42,7 @@ * * ************************************************************************/ -#ifdef __amd64__ -static LRESULT CALLBACK -#else -static BOOL CALLBACK -#endif +static WIN_RESULT CALLBACK ports_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { WCHAR temp[128]; @@ -106,7 +102,7 @@ ports_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case IDC_CHECK_PARALLEL2: case IDC_CHECK_PARALLEL3: h = GetDlgItem(hdlg, LOWORD(wParam)); - d = SendMessage(h, BM_GETCHECK, 0, 0); + d = (int)SendMessage(h, BM_GETCHECK, 0, 0); c = (LOWORD(wParam) - IDC_CHECK_PARALLEL1); h = GetDlgItem(hdlg, IDC_COMBO_PARALLEL1+c); EnableWindow(h, d ? TRUE : FALSE); @@ -116,20 +112,20 @@ ports_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case WM_SAVE_CFG: h = GetDlgItem(hdlg, IDC_CHECK_GAME); - temp_game = SendMessage(h, BM_GETCHECK, 0, 0); + temp_game = (int)SendMessage(h, BM_GETCHECK, 0, 0); for (i = 0; i < PARALLEL_MAX; i++) { h = GetDlgItem(hdlg, IDC_CHECK_PARALLEL1+i); - temp_parallel[i] = SendMessage(h, BM_GETCHECK, 0, 0); + temp_parallel[i] = (int)SendMessage(h, BM_GETCHECK, 0, 0); h = GetDlgItem(hdlg, IDC_COMBO_PARALLEL1+i); - c = SendMessage(h, CB_GETCURSEL, 0, 0); + c = (int)SendMessage(h, CB_GETCURSEL, 0, 0); temp_parallel_device[i] = c; } for (i = 0; i < SERIAL_MAX; i++) { h = GetDlgItem(hdlg, IDC_CHECK_SERIAL1+i); - temp_serial[i] = SendMessage(h, BM_GETCHECK, 0, 0); + temp_serial[i] = (int)SendMessage(h, BM_GETCHECK, 0, 0); } return FALSE; diff --git a/src/win/win_settings_remov.h b/src/win/win_settings_remov.h index 4d611db..1fc8167 100644 --- a/src/win/win_settings_remov.h +++ b/src/win/win_settings_remov.h @@ -8,7 +8,7 @@ * * Implementation of the "Removable Devices" dialog. * - * Version: @(#)win_settings_remov.h 1.0.10 2018/10/21 + * Version: @(#)win_settings_remov.h 1.0.12 2018/10/24 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -720,11 +720,7 @@ zip_track_all(void) #endif -#ifdef __amd64__ -static LRESULT CALLBACK -#else -static BOOL CALLBACK -#endif +static WIN_RESULT CALLBACK rmv_devices_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { HWND h; @@ -822,7 +818,7 @@ rmv_devices_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) rd_ignore_change = 1; h = GetDlgItem(hdlg, IDC_COMBO_CD_BUS); - b = SendMessage(h, CB_GETCURSEL, 0, 0); + b = (int)SendMessage(h, CB_GETCURSEL, 0, 0); if (b == temp_cdrom_drives[cdlv_current_sel].bus_type) goto cdrom_bus_skip; cdrom_untrack(cdlv_current_sel); @@ -845,7 +841,7 @@ cdrom_bus_skip: rd_ignore_change = 1; h = GetDlgItem(hdlg, IDC_COMBO_CD_ID); cdrom_untrack(cdlv_current_sel); - b = SendMessage(h, CB_GETCURSEL, 0, 0); + b = (int)SendMessage(h, CB_GETCURSEL, 0, 0); temp_cdrom_drives[cdlv_current_sel].bus_id.scsi.id = (uint8_t)b; cdrom_track(cdlv_current_sel); h = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES); @@ -860,7 +856,7 @@ cdrom_bus_skip: rd_ignore_change = 1; h = GetDlgItem(hdlg, IDC_COMBO_CD_LUN); cdrom_untrack(cdlv_current_sel); - b = SendMessage(h, CB_GETCURSEL, 0, 0); + b = (int)SendMessage(h, CB_GETCURSEL, 0, 0); temp_cdrom_drives[cdlv_current_sel].bus_id.scsi.lun = (uint8_t)b; cdrom_track(cdlv_current_sel); h = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES); @@ -875,7 +871,7 @@ cdrom_bus_skip: rd_ignore_change = 1; h = GetDlgItem(hdlg, IDC_COMBO_CD_CHANNEL_IDE); cdrom_untrack(cdlv_current_sel); - b = SendMessage(h, CB_GETCURSEL, 0, 0); + b = (int)SendMessage(h, CB_GETCURSEL, 0, 0); temp_cdrom_drives[cdlv_current_sel].bus_id.ide_channel = (uint8_t)b; cdrom_track(cdlv_current_sel); h = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES); @@ -889,7 +885,7 @@ cdrom_bus_skip: rd_ignore_change = 1; h = GetDlgItem(hdlg, IDC_COMBO_CD_SPEED); - b = SendMessage(h, CB_GETCURSEL, 0, 0); + b = (int)SendMessage(h, CB_GETCURSEL, 0, 0); temp_cdrom_drives[cdlv_current_sel].speed_idx = (uint8_t)b; h = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES); cdrom_update_item(h, cdlv_current_sel); @@ -902,7 +898,7 @@ cdrom_bus_skip: rd_ignore_change = 1; h = GetDlgItem(hdlg, IDC_COMBO_ZIP_BUS); - b = SendMessage(h, CB_GETCURSEL, 0, 0); + b = (int)SendMessage(h, CB_GETCURSEL, 0, 0); if (temp_zip_drives[zdlv_current_sel].bus_type == b) goto zip_bus_skip; zip_untrack(zdlv_current_sel); @@ -923,7 +919,7 @@ zip_bus_skip: rd_ignore_change = 1; h = GetDlgItem(hdlg, IDC_COMBO_ZIP_ID); zip_untrack(zdlv_current_sel); - b = SendMessage(h, CB_GETCURSEL, 0, 0); + b = (int)SendMessage(h, CB_GETCURSEL, 0, 0); temp_zip_drives[zdlv_current_sel].bus_id.scsi.id = (uint8_t)b; zip_track(zdlv_current_sel); h = GetDlgItem(hdlg, IDC_LIST_ZIP_DRIVES); @@ -938,7 +934,7 @@ zip_bus_skip: rd_ignore_change = 1; h = GetDlgItem(hdlg, IDC_COMBO_ZIP_LUN); zip_untrack(zdlv_current_sel); - b = SendMessage(h, CB_GETCURSEL, 0, 0); + b = (int)SendMessage(h, CB_GETCURSEL, 0, 0); temp_zip_drives[zdlv_current_sel].bus_id.scsi.lun = (uint8_t)b; zip_track(zdlv_current_sel); h = GetDlgItem(hdlg, IDC_LIST_ZIP_DRIVES); @@ -953,7 +949,7 @@ zip_bus_skip: rd_ignore_change = 1; h = GetDlgItem(hdlg, IDC_COMBO_ZIP_CHANNEL_IDE); zip_untrack(zdlv_current_sel); - b = SendMessage(h, CB_GETCURSEL, 0, 0); + b = (int)SendMessage(h, CB_GETCURSEL, 0, 0); temp_zip_drives[zdlv_current_sel].bus_id.ide_channel = (uint8_t)b; zip_track(zdlv_current_sel); h = GetDlgItem(hdlg, IDC_LIST_ZIP_DRIVES); @@ -967,7 +963,7 @@ zip_bus_skip: rd_ignore_change = 1; h = GetDlgItem(hdlg, IDC_CHECK250); - b = SendMessage(h, BM_GETCHECK, 0, 0); + b = (int)SendMessage(h, BM_GETCHECK, 0, 0); temp_zip_drives[zdlv_current_sel].is_250 = (int8_t)b; h = GetDlgItem(hdlg, IDC_LIST_ZIP_DRIVES); zip_update_item(h, zdlv_current_sel); diff --git a/src/win/win_settings_sound.h b/src/win/win_settings_sound.h index fb9a0df..0f6541f 100644 --- a/src/win/win_settings_sound.h +++ b/src/win/win_settings_sound.h @@ -8,7 +8,7 @@ * * Implementation of the Settings dialog. * - * Version: @(#)win_settings_sound.h 1.0.11 2018/09/29 + * Version: @(#)win_settings_sound.h 1.0.13 2018/10/24 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -72,11 +72,7 @@ mpu401_standalone_allow(void) } -#ifdef __amd64__ -static LRESULT CALLBACK -#else -static BOOL CALLBACK -#endif +static WIN_RESULT CALLBACK sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { WCHAR temp[128]; @@ -241,7 +237,7 @@ sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case IDC_CHECK_MPU401: h = GetDlgItem(hdlg, IDC_CHECK_MPU401); - temp_mpu401 = SendMessage(h, BM_GETCHECK, 0, 0); + temp_mpu401 = (int)SendMessage(h, BM_GETCHECK, 0, 0); h = GetDlgItem(hdlg, IDC_CONFIGURE_MPU401); EnableWindow(h, mpu401_present() ? TRUE : FALSE); @@ -262,13 +258,13 @@ sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) temp_midi_device = list_to_midi[SendMessage(h, CB_GETCURSEL, 0, 0)]; h = GetDlgItem(hdlg, IDC_CHECK_MPU401); - temp_mpu401 = SendMessage(h, BM_GETCHECK, 0, 0); + temp_mpu401 = (int)SendMessage(h, BM_GETCHECK, 0, 0); h = GetDlgItem(hdlg, IDC_CHECK_NUKEDOPL); - temp_opl_type = SendMessage(h, BM_GETCHECK, 0, 0); + temp_opl_type = (int)SendMessage(h, BM_GETCHECK, 0, 0); h = GetDlgItem(hdlg, IDC_CHECK_FLOAT); - temp_float = SendMessage(h, BM_GETCHECK, 0, 0); + temp_float = (int)SendMessage(h, BM_GETCHECK, 0, 0); return FALSE; default: diff --git a/src/win/win_settings_video.h b/src/win/win_settings_video.h index 90826a8..92e2cfa 100644 --- a/src/win/win_settings_video.h +++ b/src/win/win_settings_video.h @@ -8,7 +8,7 @@ * * Implementation of the Settings dialog. * - * Version: @(#)win_settings_video.h 1.0.7 2018/09/29 + * Version: @(#)win_settings_video.h 1.0.9 2018/10/24 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -46,11 +46,7 @@ static int list_to_vid[100], vid_to_list[100]; -#ifdef __amd64__ -static LRESULT CALLBACK -#else -static BOOL CALLBACK -#endif +static WIN_RESULT CALLBACK video_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { char tempA[128]; @@ -135,7 +131,7 @@ video_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) switch (LOWORD(wParam)) { case IDC_COMBO_VIDEO: h = GetDlgItem(hdlg, IDC_COMBO_VIDEO); - c = SendMessage(h, CB_GETCURSEL, 0, 0); + c = (int)SendMessage(h, CB_GETCURSEL, 0, 0); temp_video_card = list_to_vid[c]; h = GetDlgItem(hdlg, IDC_CONFIGURE_VIDEO); @@ -147,7 +143,7 @@ video_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case IDC_CHECK_VOODOO: h = GetDlgItem(hdlg, IDC_CHECK_VOODOO); - temp_voodoo = SendMessage(h, BM_GETCHECK, 0, 0); + temp_voodoo = (int)SendMessage(h, BM_GETCHECK, 0, 0); h = GetDlgItem(hdlg, IDC_CONFIGURE_VOODOO); EnableWindow(h, temp_voodoo ? TRUE : FALSE); @@ -168,11 +164,11 @@ video_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case WM_SAVE_CFG: h = GetDlgItem(hdlg, IDC_COMBO_VIDEO); - c = SendMessage(h, CB_GETCURSEL, 0, 0); + c = (int)SendMessage(h, CB_GETCURSEL, 0, 0); temp_video_card = list_to_vid[c]; h = GetDlgItem(hdlg, IDC_CHECK_VOODOO); - temp_voodoo = SendMessage(h, BM_GETCHECK, 0, 0); + temp_voodoo = (int)SendMessage(h, BM_GETCHECK, 0, 0); return FALSE; default: diff --git a/src/win/win_snd_gain.c b/src/win/win_snd_gain.c index 152da4e..0380a99 100644 --- a/src/win/win_snd_gain.c +++ b/src/win/win_snd_gain.c @@ -8,7 +8,7 @@ * * Implementation of the Sound Gain dialog. * - * Version: @(#)win_snd_gain.c 1.0.8 2018/10/05 + * Version: @(#)win_snd_gain.c 1.0.9 2018/10/24 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -55,11 +55,7 @@ static uint8_t old_gain; -#ifdef __amd64__ -static LRESULT CALLBACK -#else -static BOOL CALLBACK -#endif +static WIN_RESULT CALLBACK dlg_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { HWND h; @@ -78,14 +74,14 @@ dlg_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case WM_VSCROLL: h = GetDlgItem(hdlg, IDC_SLIDER_GAIN); - sound_gain = (9 - SendMessage(h, TBM_GETPOS, (WPARAM)0, 0)) << 1; + sound_gain = (9 - (int)SendMessage(h, TBM_GETPOS, (WPARAM)0, 0)) << 1; break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: h = GetDlgItem(hdlg, IDC_SLIDER_GAIN); - sound_gain = (9 - SendMessage(h, TBM_GETPOS, (WPARAM)0, 0)) << 1; + sound_gain = (9 - (int)SendMessage(h, TBM_GETPOS, (WPARAM)0, 0)) << 1; config_save(); EndDialog(hdlg, 0); return TRUE; diff --git a/src/win/win_ui.c b/src/win/win_ui.c index 2e1e6d6..204fa33 100644 --- a/src/win/win_ui.c +++ b/src/win/win_ui.c @@ -8,7 +8,7 @@ * * Implement the user Interface module. * - * Version: @(#)win_ui.c 1.0.30 2018/10/18 + * Version: @(#)win_ui.c 1.0.31 2018/10/24 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -111,11 +111,7 @@ PopupMenu(HWND hwnd, POINT pt, int part) /* Handle messages for the Status Bar window. */ -#ifdef __amd64__ -static LRESULT CALLBACK -#else -static BOOL CALLBACK -#endif +static WIN_RESULT CALLBACK sb_dlg_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { RECT r; @@ -413,8 +409,8 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) case WM_SIZE: /* Note: this is the *client area* size!! */ - x = (lParam & 0xffff); - y = (lParam >> 16); + x = (int)(lParam & 0xffff); + y = (int)(lParam >> 16); if (cruft_x == 0) { /* Determine the window cruft. */ cruft_x = (scrnsz_x - x); @@ -568,11 +564,7 @@ SubWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) /* Catch WM_INPUT messages for 'current focus' window. */ -#ifdef __amd64__ -static LRESULT CALLBACK -#else -static BOOL CALLBACK -#endif +static WIN_RESULT CALLBACK input_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { @@ -900,7 +892,7 @@ again: win_mouse_close(); - return(messages.wParam); + return((int)messages.wParam); }