ref: 5916b49c6743cd9b031fe92ae313af9cf409d455
parent: 875c9be90ac2e915ede8b631f4634d1aecabee6e
author: allkern <lisandroaalarcon@gmail.com>
date: Mon Aug 5 06:04:29 EDT 2024
Fix warnings
--- a/build-win64.ps1
+++ b/build-win64.ps1
@@ -27,6 +27,6 @@
-m64 -lSDL2main -lSDL2 -Wno-overflow `
-Wall -pedantic -DLOG_USE_COLOR `
-Wno-address-of-packed-member `
- -ffast-math -Ofast -g -flto
+ -ffast-math -Ofast -g -flto -Werror
Copy-Item -Path "$($SDL2_DIR)\bin\SDL2.dll" -Destination "bin"
\ No newline at end of file
--- a/compat.txt
+++ b/compat.txt
@@ -1,7 +1,7 @@
Not working:
Fixed: Aconcagua (Japan) (Disc 1) *6
Fixed: Animetic Story Game 1 - Card Captor Sakura (Japan) (Disc 1) *1 (2989bb6)
-Ape Escape (USA) *21
+ Fixed: Ape Escape (USA) *21 (0=10000h CDROM DMA BS)
Fixed: Blade (USA) *3
CTR - Crash Team Racing (USA) *16 (regression)
Fixed: Crash Bash (USA) *1 (2989bb6)
--- a/psx/cpu.c
+++ b/psx/cpu.c
@@ -298,7 +298,7 @@
int cyc = psx_cpu_execute(cpu);
if (!cyc) {
- printf("psxe: Illegal instruction %08x at %08x (next=%08x, saved=%08x)\n", cpu->opcode, cpu->next_pc, cpu->saved_pc);
+ printf("psxe: Illegal instruction %08x at %08x (next=%08x, saved=%08x)\n", cpu->opcode, cpu->pc, cpu->next_pc, cpu->saved_pc);
psx_cpu_exception(cpu, CAUSE_RI);
}
@@ -534,18 +534,6 @@
cpu->r[T] = IMM16 << 16;
}
-static inline void psx_cpu_i_cop1(psx_cpu_t* cpu) {
- DO_PENDING_LOAD;
-
- psx_cpu_exception(cpu, CAUSE_CPU);
-}
-
-static inline void psx_cpu_i_cop3(psx_cpu_t* cpu) {
- DO_PENDING_LOAD;
-
- psx_cpu_exception(cpu, CAUSE_CPU);
-}
-
static inline void psx_cpu_i_lb(psx_cpu_t* cpu) {
TRACE_M("lb");
@@ -1806,42 +1794,6 @@
R_RC2 = gte_clamp_rgb(cpu, 1, R_MAC1 >> 4); \
R_GC2 = gte_clamp_rgb(cpu, 2, R_MAC2 >> 4); \
R_BC2 = gte_clamp_rgb(cpu, 3, R_MAC3 >> 4); }
-
-static inline void gte_interpolate_color(psx_cpu_t* cpu, int64_t mac1, int64_t mac2, int64_t mac3) {
- R_MAC1 = gte_clamp_mac(cpu, 1, (I64(R_RFC) << 12) - mac1);
- R_MAC2 = gte_clamp_mac(cpu, 2, (I64(R_GFC) << 12) - mac2);
- R_MAC3 = gte_clamp_mac(cpu, 3, (I64(R_BFC) << 12) - mac3);
-
- // printf("input=(%08x, %08x, %08x) (%d, %d, %d) mac=(%08x, %08x, %08x), (%d, %d, %d) fc=(%08x, %08x, %08x)\n",
- // mac1,
- // mac2,
- // mac3,
- // mac1,
- // mac2,
- // mac3,
- // R_MAC1,
- // R_MAC2,
- // R_MAC3,
- // R_MAC1,
- // R_MAC2,
- // R_MAC3,
- // I64(R_RFC) << 12,
- // I64(R_GFC) << 12,
- // I64(R_BFC) << 12
- // );
-
- R_IR1 = gte_clamp_ir(cpu, 1, R_MAC1, 0);
- R_IR2 = gte_clamp_ir(cpu, 2, R_MAC2, 0);
- R_IR3 = gte_clamp_ir(cpu, 3, R_MAC3, 0);
-
- R_MAC1 = gte_clamp_mac(cpu, 1, (R_IR1 * R_IR0) + mac1);
- R_MAC2 = gte_clamp_mac(cpu, 2, (R_IR2 * R_IR0) + mac2);
- R_MAC3 = gte_clamp_mac(cpu, 3, (R_IR3 * R_IR0) + mac3);
-
- R_IR1 = gte_clamp_ir(cpu, 1, R_MAC1, cpu->gte_sf);
- R_IR2 = gte_clamp_ir(cpu, 2, R_MAC2, cpu->gte_sf);
- R_IR3 = gte_clamp_ir(cpu, 3, R_MAC3, cpu->gte_sf);
-}
static inline void psx_gte_i_rtps(psx_cpu_t* cpu) {
R_FLAG = 0;
--- a/psx/dev/cdrom/cdrom.c
+++ b/psx/dev/cdrom/cdrom.c
@@ -518,8 +518,6 @@
if (cdrom->state == CD_STATE_READ) {cdrom_process_setloc(cdrom);
- int ts = psx_disc_query(cdrom->disc, cdrom->lba);
-
cdrom->state = CD_STATE_READ;
cdrom->prev_state = CD_STATE_READ;
cdrom->delay = CD_DELAY_ONGOING_READ;
@@ -534,8 +532,6 @@
if (cdrom->state == CD_STATE_READ) {cdrom_process_setloc(cdrom);
- int ts = psx_disc_query(cdrom->disc, cdrom->lba);
-
cdrom->state = CD_STATE_READ;
cdrom->prev_state = CD_STATE_READ;
cdrom->delay = CD_DELAY_ONGOING_READ;
@@ -586,7 +582,10 @@
case 2: return cdrom_read_data(cdrom);
case 3: return (cdrom->index & 1) ? (0xe0 | cdrom->ifr) : cdrom->ier;
}
+
+ return 0;
}
+
void psx_cdrom_write8(psx_cdrom_t* cdrom, uint32_t addr, uint32_t value) { switch ((cdrom->index << 2) | addr) {case 0: cdrom_write_stat(cdrom, value); break;
@@ -707,11 +706,13 @@
}
uint32_t psx_cdrom_read32(psx_cdrom_t* cdrom, uint32_t addr) {- assert(("32-bit CDROM reads are not supported", 0));+ assert("32-bit CDROM reads are not supported" && 0);+
+ return 0;
}
uint32_t psx_cdrom_read16(psx_cdrom_t* cdrom, uint32_t addr) {- assert(("16-bit CDROM reads are not supported", 0));+ assert("16-bit CDROM reads are not supported" && 0);// The CDROM controller is connected to the SUB-BUS which is a 16-bit
// bus, but the output from the controller itself is 8-bit. I think
@@ -720,9 +721,9 @@
}
void psx_cdrom_write32(psx_cdrom_t* cdrom, uint32_t addr, uint32_t value) {- assert(("32-bit CDROM writes are not supported", 0));+ assert("32-bit CDROM writes are not supported" && 0);}
void psx_cdrom_write16(psx_cdrom_t* cdrom, uint32_t addr, uint32_t value) {- assert(("16-bit CDROM writes are not supported", 0));+ assert("16-bit CDROM writes are not supported" && 0);}
\ No newline at end of file
--- a/psx/dev/cdrom/cue.c
+++ b/psx/dev/cdrom/cue.c
@@ -530,8 +530,8 @@
// then we are being requested a pregap sector. Clear buffer
// and initialize sync data (not actually needed)
if (!track) {- memset(buf, 0, 2352);
- memset(buf + 1, 255, 10);
+ memset((uint8_t*)buf, 0, 2352);
+ memset((uint8_t*)buf + 1, 255, 10);
return TS_PREGAP;
}
@@ -548,7 +548,7 @@
// );
if (file->buf_mode == LD_BUFFERED) {- uint8_t* ptr = file->buf + ((lba - file->start) * 2352);
+ uint8_t* ptr = (uint8_t*)file->buf + ((lba - file->start) * 2352);
memcpy(buf, ptr, 2352);
} else {@@ -584,10 +584,10 @@
void cue_init_disc(cue_t* cue, psx_disc_t* disc) {disc->udata = cue;
- disc->read_sector = cue_read;
- disc->query_sector = cue_query;
- disc->get_track_number = cue_get_track_number;
- disc->get_track_count = cue_get_track_count;
- disc->get_track_lba = cue_get_track_lba;
- disc->destroy = cue_destroy;
+ disc->read_sector = (read_sector_func)cue_read;
+ disc->query_sector = (query_sector_func)cue_query;
+ disc->get_track_number = (get_track_number_func)cue_get_track_number;
+ disc->get_track_count = (get_track_count_func)cue_get_track_count;
+ disc->get_track_lba = (get_track_lba_func)cue_get_track_lba;
+ disc->destroy = (destroy_func)cue_destroy;
}
\ No newline at end of file
--- a/psx/dev/cdrom/impl.c
+++ b/psx/dev/cdrom/impl.c
@@ -516,7 +516,6 @@
int mm = f / (60 * 75);
int ss = (f % (60 * 75)) / 75;
- int ff = (f % (60 * 75)) % 75;
// printf("gettd: track %u lba=%08x (%u) %02u:%02u:%02u\n",// track,
@@ -536,9 +535,7 @@
cdrom_set_int(cdrom, 3);
queue_push(cdrom->response, cdrom_get_stat(cdrom));
- int ts = psx_disc_query(cdrom->disc, cdrom->pending_lba);
-
- cdrom->delay = CD_DELAY_1MS; // cdrom_get_seek_delay(cdrom, ts);
+ cdrom->delay = CD_DELAY_1MS;
cdrom->state = CD_STATE_TX_RESP2;
} else {int ts = psx_disc_query(cdrom->disc, cdrom->pending_lba);
@@ -577,7 +574,7 @@
cdrom_set_int(cdrom, 3);
queue_push(cdrom->response, cdrom_get_stat(cdrom));
- cdrom->delay = CD_DELAY_1MS; // cdrom_get_seek_delay(cdrom, ts);
+ cdrom->delay = CD_DELAY_1MS;
cdrom->state = CD_STATE_TX_RESP2;
cdrom->busy = 1;
} else {--- a/psx/dev/spu.c
+++ b/psx/dev/spu.c
@@ -10,14 +10,14 @@
#define VOICE_COUNT 24
-static float interpolate_hermite(float a, float b, float c, float d, float t) {
- float x = -a/2.0f + (3.0f*b)/2.0f - (3.0f*c)/2.0f + d/2.0f;
- float y = a - (5.0f*b)/2.0f + 2.0f*c - d / 2.0f;
- float z = -a/2.0f + c/2.0f;
- float w = b;
+// static float interpolate_hermite(float a, float b, float c, float d, float t) {
+// float x = -a/2.0f + (3.0f*b)/2.0f - (3.0f*c)/2.0f + d/2.0f;
+// float y = a - (5.0f*b)/2.0f + 2.0f*c - d / 2.0f;
+// float z = -a/2.0f + c/2.0f;
+// float w = b;
- return (x*t*t*t) + (y*t*t) + (z*t) + w;
-}
+// return (x*t*t*t) + (y*t*t) + (z*t) + w;
+// }
static const int g_spu_pos_adpcm_table[] = {
0, +60, +115, +98, +122
@@ -572,7 +572,6 @@
uint32_t psx_spu_get_sample(psx_spu_t* spu) {
spu->even_cycle ^= 1;
- int active_voice_count = 0;
int left = 0;
int right = 0;
int revl = 0;
@@ -587,8 +586,6 @@
spu_handle_adsr(spu, v);
- ++active_voice_count;
-
uint32_t sample_index = spu->data[v].counter >> 12;
if (sample_index > 27) {
@@ -681,9 +678,6 @@
spu->data[v].counter += step;
}
- // if (!active_voice_count)
- // return 0x00000000;
-
int16_t clamprl = CLAMP(revl, INT16_MIN, INT16_MAX);
int16_t clamprr = CLAMP(revr, INT16_MIN, INT16_MAX);
int16_t clampsl = CLAMP(left, INT16_MIN, INT16_MAX);
--- a/psx/psx.c
+++ b/psx/psx.c
@@ -119,7 +119,7 @@
return aspect;
}
-void atcons_tx(void* udata, char c) {
+void atcons_tx(void* udata, unsigned char c) {
putchar(c);
}
--
⑨