From: notaz Date: Tue, 14 Dec 2021 19:09:45 +0000 (+0200) Subject: fix some issues and warnings seen on ctr build X-Git-Tag: r23~46 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=337887986422262fb88611d0b6cfcd79936e11c8;p=pcsx_rearmed.git fix some issues and warnings seen on ctr build --- diff --git a/libpcsxcore/new_dynarec/assem_arm.c b/libpcsxcore/new_dynarec/assem_arm.c index 3267cb6b..381a5419 100644 --- a/libpcsxcore/new_dynarec/assem_arm.c +++ b/libpcsxcore/new_dynarec/assem_arm.c @@ -473,6 +473,7 @@ static void emit_loadlp(u_int imm,u_int rt) output_w32(0xe5900000|rd_rn_rm(rt,15,0)); } +#ifdef HAVE_ARMV7 static void emit_movw(u_int imm,u_int rt) { assert(imm<65536); @@ -485,6 +486,7 @@ static void emit_movt(u_int imm,u_int rt) assem_debug("movt %s,#%d (0x%x)\n",regname[rt],imm&0xffff0000,imm&0xffff0000); output_w32(0xe3400000|rd_rn_rm(rt,0,0)|((imm>>16)&0xfff)|((imm>>12)&0xf0000)); } +#endif static void emit_movimm(u_int imm,u_int rt) { @@ -530,17 +532,20 @@ static void emit_loadreg(int r, int hr) if((r&63)==0) emit_zeroreg(hr); else { - int addr = (int)&psxRegs.GPR.r[r]; + void *addr; switch (r) { //case HIREG: addr = &hi; break; //case LOREG: addr = &lo; break; - case CCREG: addr = (int)&cycle_count; break; - case CSREG: addr = (int)&Status; break; - case INVCP: addr = (int)&invc_ptr; break; - case ROREG: addr = (int)&ram_offset; break; - default: assert(r < 34); break; + case CCREG: addr = &cycle_count; break; + case CSREG: addr = &Status; break; + case INVCP: addr = &invc_ptr; break; + case ROREG: addr = &ram_offset; break; + default: + assert(r < 34); + addr = &psxRegs.GPR.r[r]; + break; } - u_int offset = addr-(u_int)&dynarec_local; + u_int offset = (u_char *)addr - (u_char *)&dynarec_local; assert(offset<4096); assem_debug("ldr %s,fp+%d\n",regname[hr],offset); output_w32(0xe5900000|rd_rn_rm(hr,FP,0)|offset); @@ -2119,10 +2124,10 @@ static void c2op_assemble(int i, const struct regstat *i_regs) } #else if(cv==3&&shift) - emit_far_call((int)gteMVMVA_part_cv3sh12_arm); + emit_far_call(gteMVMVA_part_cv3sh12_arm); else { emit_movimm(shift,1); - emit_far_call((int)(need_flags?gteMVMVA_part_arm:gteMVMVA_part_nf_arm)); + emit_far_call(need_flags?gteMVMVA_part_arm:gteMVMVA_part_nf_arm); } if(need_flags||need_ir) c2op_call_MACtoIR(lm,need_flags); diff --git a/libpcsxcore/new_dynarec/assem_arm64.c b/libpcsxcore/new_dynarec/assem_arm64.c index 0b492211..84e4fc6e 100644 --- a/libpcsxcore/new_dynarec/assem_arm64.c +++ b/libpcsxcore/new_dynarec/assem_arm64.c @@ -453,7 +453,7 @@ static void emit_loadreg(u_int r, u_int hr) if (r == 0) emit_zeroreg(hr); else { - void *addr = &psxRegs.GPR.r[r]; + void *addr; switch (r) { //case HIREG: addr = &hi; break; //case LOREG: addr = &lo; break; @@ -461,7 +461,10 @@ static void emit_loadreg(u_int r, u_int hr) case CSREG: addr = &Status; break; case INVCP: addr = &invc_ptr; is64 = 1; break; case ROREG: addr = &ram_offset; is64 = 1; break; - default: assert(r < 34); break; + default: + assert(r < 34); + addr = &psxRegs.GPR.r[r]; + break; } if (is64) emit_readdword(addr, hr); diff --git a/libpcsxcore/new_dynarec/emu_if.h b/libpcsxcore/new_dynarec/emu_if.h index 30cb9ef6..0ce9584c 100644 --- a/libpcsxcore/new_dynarec/emu_if.h +++ b/libpcsxcore/new_dynarec/emu_if.h @@ -85,7 +85,7 @@ extern void *scratch_buf_ptr; extern u32 inv_code_start, inv_code_end; /* cycles/irqs */ -extern unsigned int next_interupt; +extern u32 next_interupt; extern int pending_exception; /* called by drc */ diff --git a/libpcsxcore/psxbios.c b/libpcsxcore/psxbios.c index 16b48d9c..8e993c3f 100644 --- a/libpcsxcore/psxbios.c +++ b/libpcsxcore/psxbios.c @@ -1065,7 +1065,7 @@ void psxBios_qsort() { // 0x31 } void psxBios_malloc() { // 0x33 - unsigned int *chunk, *newchunk = NULL; + u32 *chunk, *newchunk = NULL; unsigned int dsize = 0, csize, cstat; int colflag; #ifdef PSXBIOS_LOG diff --git a/libpcsxcore/psxcommon.h b/libpcsxcore/psxcommon.h index 2dd91cf1..224caa54 100644 --- a/libpcsxcore/psxcommon.h +++ b/libpcsxcore/psxcommon.h @@ -37,6 +37,10 @@ extern "C" { #pragma GCC diagnostic ignored "-Wformat-overflow" #pragma GCC diagnostic ignored "-Wstringop-truncation" #endif +// devkitpro has uint32_t as long, unfortunately +#ifdef _3DS +#pragma GCC diagnostic ignored "-Wformat" +#endif // System includes #include diff --git a/plugins/dfsound/spu.c b/plugins/dfsound/spu.c index 637e8521..b0b083dd 100644 --- a/plugins/dfsound/spu.c +++ b/plugins/dfsound/spu.c @@ -1318,14 +1318,12 @@ static void SetupStreams(void) spu.pSpuBuffer = (unsigned char *)malloc(32768); // alloc mixing buffer spu.SSumLR = calloc(NSSIZE * 2, sizeof(spu.SSumLR[0])); - spu.XAStart = // alloc xa buffer - (uint32_t *)malloc(44100 * sizeof(uint32_t)); + spu.XAStart = malloc(44100 * sizeof(uint32_t)); // alloc xa buffer spu.XAEnd = spu.XAStart + 44100; spu.XAPlay = spu.XAStart; spu.XAFeed = spu.XAStart; - spu.CDDAStart = // alloc cdda buffer - (uint32_t *)malloc(CDDA_BUFFER_SIZE); + spu.CDDAStart = malloc(CDDA_BUFFER_SIZE); // alloc cdda buffer spu.CDDAEnd = spu.CDDAStart + 16384; spu.CDDAPlay = spu.CDDAStart; spu.CDDAFeed = spu.CDDAStart;