Skip to content

Commit a6354a9

Browse files
author
El_Patas
authored
Merge pull request ps2homebrew#198 from sp193/fix-feb19-2
Fixes, February 2019 (II)
2 parents ce5f832 + 918b6a5 commit a6354a9

File tree

4 files changed

+10
-25
lines changed

4 files changed

+10
-25
lines changed

ee_core/src/iopmgr.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ static void ResetIopSpecial(const char *args, unsigned int arglen)
5959

6060
DIntr();
6161
ee_kmode_enter();
62-
Old_SifSetReg(SIF_REG_SMFLAG, SIF_STAT_SIFINIT | SIF_STAT_CMDINIT);
62+
Old_SifSetReg(SIF_REG_SMFLAG, SIF_STAT_SIFINIT);
63+
Old_SifSetReg(SIF_REG_SMFLAG, SIF_STAT_CMDINIT);
6364
Old_SifSetReg(SIF_SYSREG_RPCINIT, 0);
6465
Old_SifSetReg(SIF_SYSREG_SUBADDR, (int)NULL);
6566
ee_kmode_exit();
@@ -221,7 +222,8 @@ int Reset_Iop(const char *arg, int mode)
221222
return 0;
222223
}
223224

224-
Old_SifSetReg(SIF_REG_SMFLAG, SIF_STAT_SIFINIT | SIF_STAT_CMDINIT);
225+
Old_SifSetReg(SIF_REG_SMFLAG, SIF_STAT_SIFINIT);
226+
Old_SifSetReg(SIF_REG_SMFLAG, SIF_STAT_CMDINIT);
225227
Old_SifSetReg(SIF_SYSREG_RPCINIT, 0);
226228
Old_SifSetReg(SIF_SYSREG_SUBADDR, (int)NULL);
227229
ee_kmode_exit();

ee_core/src/patches.c

+3-8
Original file line numberDiff line numberDiff line change
@@ -331,21 +331,16 @@ static void RnC3_UYA_patches(void *address)
331331
1. if it's a module with no name (first 4 characters are 0s), left-shift once.
332332
2. if it's a module beginning with "Deci", left-shift once.
333333
3. if it's a module beginning with "cdvd", right-shift once.
334+
Otherwise, nothing is done for the module.
335+
336+
Only modules up to before the 3rd last will be considered.
334337
335338
For us, it's about preserving the pointer to the allocated buffer and to adjust it accordingly:
336339
For TOOL units, there are 6 DECI2 modules and 2 libcdvd modules. Therefore the pointer should be right-shifted by 4.
337340
For retail units, there are 2 libcdvd modules. Therefore the pointer should be left-shifted by 2. */
338341

339342
word1 = JAL((unsigned int)&RnC3_AlwaysAllocMem);
340343
switch (GameMode) {
341-
case HDD_MODE:
342-
//For HDD mode, the CDVDMAN module has its name as "dev9", so adjust the shifting accordingly.
343-
#ifdef _DTL_T10000
344-
word2 = 0x00021943; //sra $v1, $v0, 5 For DTL-T10000.
345-
#else
346-
word2 = 0x00021840; //sll $v1, $v0, 1 For retail sets.
347-
#endif
348-
break;
349344
default:
350345
#ifdef _DTL_T10000
351346
word2 = 0x00021903; //sra $v1, $v0, 4 For DTL-T10000.

modules/network/SMSTCPIP/api_lib.c

+1-13
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "lwip/opt.h"
3737
#include "lwip/api.h"
3838
#include "lwip/api_msg.h"
39+
#include "lwip/tcpip.h"
3940
#include "lwip/memp.h"
4041

4142
#include <intrman.h>
@@ -44,9 +45,6 @@
4445

4546
#include "smsutils.h"
4647

47-
extern void tcpip_apimsg(struct api_msg *apimsg);
48-
49-
5048
struct netbuf *netbuf_new(void)
5149
{
5250
struct netbuf *buf = memp_malloc(MEMP_NETBUF);
@@ -169,7 +167,6 @@ struct
169167
msg->msg.msg.bc.port = proto; /* misusing the port field */
170168
msg->msg.conn = conn;
171169
api_msg_post(msg);
172-
sys_mbox_fetch(conn->mbox, NULL);
173170
memp_free(MEMP_API_MSG, msg);
174171

175172
if (conn->err != ERR_OK) {
@@ -196,7 +193,6 @@ err_t netconn_delete(struct netconn *conn)
196193
msg->type = API_MSG_DELCONN;
197194
msg->msg.conn = conn;
198195
api_msg_post(msg);
199-
sys_mbox_fetch(conn->mbox, NULL);
200196
memp_free(MEMP_API_MSG, msg);
201197

202198
/* Drain the recvmbox. */
@@ -304,7 +300,6 @@ err_t netconn_bind(struct netconn *conn, struct ip_addr *addr,
304300
msg->msg.msg.bc.ipaddr = addr;
305301
msg->msg.msg.bc.port = port;
306302
api_msg_post(msg);
307-
sys_mbox_fetch(conn->mbox, NULL);
308303
memp_free(MEMP_API_MSG, msg);
309304
return conn->err;
310305
}
@@ -334,7 +329,6 @@ err_t netconn_connect(struct netconn *conn, struct ip_addr *addr,
334329
msg->msg.msg.bc.ipaddr = addr;
335330
msg->msg.msg.bc.port = port;
336331
api_msg_post(msg);
337-
sys_mbox_fetch(conn->mbox, NULL);
338332
memp_free(MEMP_API_MSG, msg);
339333
return conn->err;
340334
}
@@ -353,7 +347,6 @@ err_t netconn_disconnect(struct netconn *conn)
353347
msg->type = API_MSG_DISCONNECT;
354348
msg->msg.conn = conn;
355349
api_msg_post(msg);
356-
sys_mbox_fetch(conn->mbox, NULL);
357350
memp_free(MEMP_API_MSG, msg);
358351
return conn->err;
359352
}
@@ -379,7 +372,6 @@ err_t netconn_listen(struct netconn *conn)
379372
msg->type = API_MSG_LISTEN;
380373
msg->msg.conn = conn;
381374
api_msg_post(msg);
382-
sys_mbox_fetch(conn->mbox, NULL);
383375
memp_free(MEMP_API_MSG, msg);
384376
return conn->err;
385377
}
@@ -476,7 +468,6 @@ netconn_recv(struct netconn *conn)
476468
}
477469
api_msg_post(msg);
478470

479-
sys_mbox_fetch(conn->mbox, NULL);
480471
memp_free(MEMP_API_MSG, msg);
481472
} else {
482473
sys_mbox_fetch(conn->recvmbox, (void **)&buf);
@@ -509,7 +500,6 @@ err_t netconn_send(struct netconn *conn, struct netbuf *buf)
509500
msg->msg.msg.p = buf->p;
510501
api_msg_post(msg);
511502

512-
sys_mbox_fetch(conn->mbox, NULL);
513503
memp_free(MEMP_API_MSG, msg);
514504
return conn->err;
515505
}
@@ -561,7 +551,6 @@ err_t netconn_write(struct netconn *conn, void *dataptr, u16_t size, u8_t copy)
561551
LWIP_DEBUGF(API_LIB_DEBUG, ("netconn_write: writing %d bytes (%d)\n", len, copy));
562552
msg->msg.msg.w.len = len;
563553
api_msg_post(msg);
564-
sys_mbox_fetch(conn->mbox, NULL);
565554
if (conn->err == ERR_OK) {
566555
dataptr = (void *)((u8_t *)dataptr + len);
567556
size -= len;
@@ -595,7 +584,6 @@ err_t netconn_close(struct netconn *conn)
595584
msg->type = API_MSG_CLOSE;
596585
msg->msg.conn = conn;
597586
api_msg_post(msg);
598-
sys_mbox_fetch(conn->mbox, NULL);
599587
if (conn->err == ERR_MEM &&
600588
conn->sem != SYS_SEM_NULL) {
601589
sys_sem_wait(conn->sem);

modules/network/SMSTCPIP/tcpip.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,9 @@ void tcpip_apimsg(struct api_msg *apimsg)
149149
msg->type = TCPIP_MSG_API;
150150
msg->msg.apimsg = apimsg;
151151
sys_mbox_post(g_TCPIPMBox, msg);
152+
sys_mbox_fetch(apimsg->msg.conn->mbox, NULL);
152153

153-
} else
154-
memp_free(MEMP_API_MSG, apimsg);
154+
}
155155
#endif /* LWIP_TCPIP_CORE_LOCKING */
156156

157157
} /* end tcpip_apimsg */

0 commit comments

Comments
 (0)