From: notaz Date: Wed, 24 Jul 2019 20:39:11 +0000 (+0300) Subject: Merge pull request #137 from gameblabla/hle X-Git-Tag: r23~156 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=commitdiff_plain;h=39ecfba491cd7ae374847b990b189e89ff878f1c;hp=1059caaf959bf28d2cd1020b8bc30d33fb71ed93 Merge pull request #137 from gameblabla/hle HLE BIOS improvements (based on nocash doc, pcsx4all, upstream pcsxr etc...) --- diff --git a/frontend/main.c b/frontend/main.c index a824fdcc..43a55481 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -138,6 +138,7 @@ void emu_set_default_config(void) pl_rearmed_cbs.gpu_peopsgl.iTexGarbageCollection = 1; spu_config.iUseReverb = 1; + spu_config.idiablofix = 0; spu_config.iUseInterpolation = 1; spu_config.iXAPitch = 0; spu_config.iVolume = 768; diff --git a/frontend/menu.c b/frontend/menu.c index cf9382a8..0b3f553c 100644 --- a/frontend/menu.c +++ b/frontend/menu.c @@ -443,6 +443,7 @@ static const struct { CE_INTVAL_P(gpu_peopsgl.iTexGarbageCollection), CE_INTVAL_P(gpu_peopsgl.dwActFixes), CE_INTVAL(spu_config.iUseReverb), + CE_INTVAL(spu_config.idiablofix), CE_INTVAL(spu_config.iXAPitch), CE_INTVAL(spu_config.iUseInterpolation), CE_INTVAL(spu_config.iTempo), @@ -1454,6 +1455,7 @@ static menu_entry e_menu_plugin_spu[] = mee_range_h ("Volume boost", 0, volume_boost, -5, 30, h_spu_volboost), mee_onoff ("Reverb", 0, spu_config.iUseReverb, 1), mee_enum ("Interpolation", 0, spu_config.iUseInterpolation, men_spu_interp), + mee_onoff ("Diablo Music fix", 0, spu_config.idiablofix, 1), mee_onoff ("Adjust XA pitch", 0, spu_config.iXAPitch, 1), mee_onoff_h ("Adjust tempo", 0, spu_config.iTempo, 1, h_spu_tempo), mee_end, diff --git a/libpcsxcore/cdriso.c b/libpcsxcore/cdriso.c index 515370f7..dca64fad 100644 --- a/libpcsxcore/cdriso.c +++ b/libpcsxcore/cdriso.c @@ -1089,7 +1089,7 @@ static int cdread_sub_mixed(FILE *f, unsigned int base, void *dest, int sector) return ret; } -static int uncompress2(void *out, unsigned long *out_size, void *in, unsigned long in_size) +static int uncompress2_pcsx(void *out, unsigned long *out_size, void *in, unsigned long in_size) { static z_stream z; int ret = 0; @@ -1169,7 +1169,7 @@ static int cdread_compressed(FILE *f, unsigned int base, void *dest, int sector) if (is_compressed) { cdbuffer_size_expect = sizeof(compr_img->buff_raw[0]) << compr_img->block_shift; cdbuffer_size = cdbuffer_size_expect; - ret = uncompress2(compr_img->buff_raw[0], &cdbuffer_size, compr_img->buff_compressed, size); + ret = uncompress2_pcsx(compr_img->buff_raw[0], &cdbuffer_size, compr_img->buff_compressed, size); if (ret != 0) { SysPrintf("uncompress failed with %d for block %d, sector %d\n", ret, block, sector); diff --git a/libpcsxcore/gte.c b/libpcsxcore/gte.c index 62fc7f38..77dff1b1 100644 --- a/libpcsxcore/gte.c +++ b/libpcsxcore/gte.c @@ -170,7 +170,7 @@ #ifndef FLAGLESS -static inline s32 BOUNDS_(psxCP2Regs *regs, s64 n_value, s64 n_max, int n_maxflag, s64 n_min, int n_minflag) { +static inline s64 BOUNDS_(psxCP2Regs *regs, s64 n_value, s64 n_max, int n_maxflag, s64 n_min, int n_minflag) { if (n_value > n_max) { gteFLAG |= n_maxflag; } else if (n_value < n_min) { @@ -404,6 +404,7 @@ static u32 DIVIDE_(s16 n, u16 d) { void gteRTPS(psxCP2Regs *regs) { int quotient; + s64 tmp; #ifdef GTE_LOG GTE_LOG("GTE RTPS\n"); @@ -426,14 +427,16 @@ void gteRTPS(psxCP2Regs *regs) { gteSX2 = limG1(F((s64)gteOFX + ((s64)gteIR1 * quotient)) >> 16); gteSY2 = limG2(F((s64)gteOFY + ((s64)gteIR2 * quotient)) >> 16); - gteMAC0 = F((s64)gteDQB + ((s64)gteDQA * quotient)); - gteIR0 = limH(gteMAC0 >> 12); + tmp = (s64)gteDQB + ((s64)gteDQA * quotient); + gteMAC0 = F(tmp); + gteIR0 = limH(tmp >> 12); } void gteRTPT(psxCP2Regs *regs) { int quotient; int v; s32 vx, vy, vz; + s64 tmp; #ifdef GTE_LOG GTE_LOG("GTE RTPT\n"); @@ -456,8 +459,10 @@ void gteRTPT(psxCP2Regs *regs) { fSX(v) = limG1(F((s64)gteOFX + ((s64)gteIR1 * quotient)) >> 16); fSY(v) = limG2(F((s64)gteOFY + ((s64)gteIR2 * quotient)) >> 16); } - gteMAC0 = F((s64)gteDQB + ((s64)gteDQA * quotient)); - gteIR0 = limH(gteMAC0 >> 12); + + tmp = (s64)gteDQB + ((s64)gteDQA * quotient); + gteMAC0 = F(tmp); + gteIR0 = limH(tmp >> 12); } void gteMVMVA(psxCP2Regs *regs) { diff --git a/libpcsxcore/psxmem.c b/libpcsxcore/psxmem.c index 14fd9113..a1a641df 100644 --- a/libpcsxcore/psxmem.c +++ b/libpcsxcore/psxmem.c @@ -187,7 +187,7 @@ void psxMemReset() { char bios[1024]; memset(psxM, 0, 0x00200000); - memset(psxP, 0, 0x00010000); + memset(psxP, 0xff, 0x00010000); if (strcmp(Config.Bios, "HLE") != 0) { sprintf(bios, "%s/%s", Config.BiosDir, Config.Bios); diff --git a/maemo/main.c b/maemo/main.c index 85db400b..c382c511 100644 --- a/maemo/main.c +++ b/maemo/main.c @@ -197,7 +197,7 @@ int main(int argc, char **argv) strcpy(Config.Bios, "HLE"); spu_config.iUseReverb = 1; spu_config.iUseInterpolation = 1; - + spu_config.idiablofix = 0; in_type1 = PSE_PAD_TYPE_STANDARD; in_type2 = PSE_PAD_TYPE_STANDARD; diff --git a/plugins/cdrcimg/cdrcimg.c b/plugins/cdrcimg/cdrcimg.c index 76cdfbaa..91cf1cad 100644 --- a/plugins/cdrcimg/cdrcimg.c +++ b/plugins/cdrcimg/cdrcimg.c @@ -98,7 +98,7 @@ static long CDRgetTD(unsigned char track, unsigned char *buffer) return 0; } -int uncompress2(void *out, unsigned long *out_size, void *in, unsigned long in_size) +static int uncompress2_pcsx(void *out, unsigned long *out_size, void *in, unsigned long in_size) { static z_stream z; int ret = 0; @@ -199,7 +199,7 @@ static long CDRreadTrack(unsigned char *time) ret = uncompress(cdbuffer->raw[0], &cdbuffer_size, cdbuffer->compressed, size); break; case CDRC_ZLIB2: - ret = uncompress2(cdbuffer->raw[0], &cdbuffer_size, cdbuffer->compressed, size); + ret = uncompress2_pcsx(cdbuffer->raw[0], &cdbuffer_size, cdbuffer->compressed, size); break; case CDRC_BZ: ret = pBZ2_bzBuffToBuffDecompress((char *)cdbuffer->raw, (unsigned int *)&cdbuffer_size, diff --git a/plugins/dfsound/registers.c b/plugins/dfsound/registers.c index 91bcaf86..bb64658d 100644 --- a/plugins/dfsound/registers.c +++ b/plugins/dfsound/registers.c @@ -352,7 +352,7 @@ static void SoundOn(int start,int end,unsigned short val) if((val&1) && regAreaGet(ch,6)) // mmm... start has to be set before key on !?! { spu.s_chan[ch].pCurr=spu.spuMemC+((regAreaGet(ch,6)&~1)<<3); // must be block aligned - spu.s_chan[ch].pLoop=spu.spuMemC+((regAreaGet(ch,14)&~1)<<3); + if (spu_config.idiablofix == 0) spu.s_chan[ch].pLoop=spu.spuMemC+((regAreaGet(ch,14)&~1)<<3); spu.dwNewChannel|=(1<