summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2009-12-04 10:19:29 +0000
committerSND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2009-12-04 10:19:29 +0000
commit821c3db4efeef0fd6b93ceb8d1446fe94fea5a95 (patch)
tree6d97b32e3f56b13e537b9d31100e171c4bafd8da
parent41e7b60e2e6397c4f8ae91495eb74728b6f562c7 (diff)
downloadpcsxr-821c3db4efeef0fd6b93ceb8d1446fe94fea5a95.tar.gz
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@38796 e17a0e51-4ae3-4d35-97c3-1a29b211df97
-rw-r--r--ChangeLog3
-rw-r--r--libpcsxcore/psxbios.c46
2 files changed, 25 insertions, 24 deletions
diff --git a/ChangeLog b/ChangeLog
index b34c3696..82432388 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,9 @@ December 4, 2009 Wei Mingzhi <weimingzhi@gmail.com>
* plugins/dfinput/xkb.c: Likewise.
* plugins/dfinput/pad.h: Likewise.
* po/zh_CN.po, po/zh_TW.po, po/pt_BR.po, po/pcsx.pot: Updated.
+ * libpcsxcore/psxbios.c: Don't touch the stack pointer if pointed to the
+ hardware area, which fixes FF7 chocobo racing problem. Don't always
+ allocate stack spaces before softcall.
December 3, 2009 Wei Mingzhi <weimingzhi@gmail.com>
diff --git a/libpcsxcore/psxbios.c b/libpcsxcore/psxbios.c
index 3afdf7dc..c6a6a050 100644
--- a/libpcsxcore/psxbios.c
+++ b/libpcsxcore/psxbios.c
@@ -263,22 +263,15 @@ static __inline void softCall(u32 pc) {
pc0 = pc;
ra = 0x80001000;
- // Fixes crashing problems with at least Final Fantasy 7 and Xenogears.
- // This should be considered a temporary fix; after all, we do not
- // know how much space below sp is in use. It may be worth considering
- // creating a new stack for interrupt handlers.
- sp -= 256;
while (pc0 != 0x80001000) psxCpu->ExecuteBlock();
- sp += 256;
}
static __inline void softCall2(u32 pc) {
u32 sra = ra;
pc0 = pc;
ra = 0x80001000;
- sp -= 128;
+
while (pc0 != 0x80001000) psxCpu->ExecuteBlock();
- sp += 128;
ra = sra;
}
@@ -490,9 +483,9 @@ void psxBios_malloc() { // 33
unsigned int *chunk, *newchunk;
unsigned int dsize, csize, cstat;
int colflag;
-#ifdef PSXBIOS_LOG
- PSXBIOS_LOG("psxBios_%s\n", biosA0n[0x33]);
-#endif
+#ifdef PSXBIOS_LOG
+ PSXBIOS_LOG("psxBios_%s\n", biosA0n[0x33]);
+#endif
// scan through heap and combine free chunks of space
chunk = heap_addr;
@@ -593,9 +586,9 @@ void psxBios_calloc() { // 37
void psxBios_realloc() { // 38
u32 block = a0;
u32 size = a1;
-#ifdef PSXBIOS_LOG
- PSXBIOS_LOG("psxBios_%s\n", biosA0n[0x38]);
-#endif
+#ifdef PSXBIOS_LOG
+ PSXBIOS_LOG("psxBios_%s\n", biosA0n[0x38]);
+#endif
a0 = block;
psxBios_free();
@@ -606,11 +599,11 @@ void psxBios_realloc() { // 38
/* InitHeap(void *block , int n) */
void psxBios_InitHeap() { // 39
- unsigned int size;
+ unsigned int size;
-#ifdef PSXBIOS_LOG
- PSXBIOS_LOG("psxBios_%s\n", biosA0n[0x39]);
-#endif
+#ifdef PSXBIOS_LOG
+ PSXBIOS_LOG("psxBios_%s\n", biosA0n[0x39]);
+#endif
if (((a0 & 0x1fffff) + a1)>= 0x200000) size = 0x1ffffc - (a0 & 0x1fffff);
else size = a1;
@@ -892,11 +885,11 @@ void psxBios__96_remove() { // 72
void psxBios_SetMem() { // 9f
u32 new = psxHu32(0x1060);
-
-#ifdef PSXBIOS_LOG
- PSXBIOS_LOG("psxBios_%s: %x, %x\n", biosA0n[0x9f], a0, a1);
-#endif
-
+
+#ifdef PSXBIOS_LOG
+ PSXBIOS_LOG("psxBios_%s: %x, %x\n", biosA0n[0x9f], a0, a1);
+#endif
+
switch(a0) {
case 2:
psxHu32ref(0x1060) = SWAP32(new);
@@ -2297,7 +2290,6 @@ void biosInterrupt() {
if (NET_recvPadData(&((u16*)buf)[1], 2) == -1)
netError();
}
-
}
if (Config.UseNet && pad_buf1 && pad_buf2) {
psxBios_PADpoll(1);
@@ -2332,7 +2324,13 @@ void biosInterrupt() {
for (i=0; i<3; i++) {
if (psxHu32(0x1070) & (1 << (i+4))) {
if (RcEV[i][1].status == EvStACTIVE) {
+ // Fixes crashing problems with at least Final Fantasy 7 and Xenogears.
+ // This should be considered a temporary fix; after all, we do not
+ // know how much space below sp is in use. It may be worth considering
+ // creating a new stack for interrupt handlers.
+ if ((sp >> 24) != 0x1f) sp -= 256;
softCall(RcEV[i][1].fhandler);
+ if ((sp >> 24) != 0x1f) sp += 256;
}
psxHwWrite32(0x1f801070, ~(1 << (i+4)));
}