Skip to content
This repository has been archived by the owner on Aug 31, 2024. It is now read-only.

Commit

Permalink
Merge pull request ps2homebrew#198 from sp193/fix-feb19-2
Browse files Browse the repository at this point in the history
Fixes, February 2019 (II)
  • Loading branch information
ElPatas1 authored Feb 13, 2019
2 parents bf8ae95 + f3e81bf commit 60b7f13
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 25 deletions.
6 changes: 4 additions & 2 deletions ee_core/src/iopmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ static void ResetIopSpecial(const char *args, unsigned int arglen)

DIntr();
ee_kmode_enter();
Old_SifSetReg(SIF_REG_SMFLAG, SIF_STAT_SIFINIT | SIF_STAT_CMDINIT);
Old_SifSetReg(SIF_REG_SMFLAG, SIF_STAT_SIFINIT);
Old_SifSetReg(SIF_REG_SMFLAG, SIF_STAT_CMDINIT);
Old_SifSetReg(SIF_SYSREG_RPCINIT, 0);
Old_SifSetReg(SIF_SYSREG_SUBADDR, (int)NULL);
ee_kmode_exit();
Expand Down Expand Up @@ -221,7 +222,8 @@ int Reset_Iop(const char *arg, int mode)
return 0;
}

Old_SifSetReg(SIF_REG_SMFLAG, SIF_STAT_SIFINIT | SIF_STAT_CMDINIT);
Old_SifSetReg(SIF_REG_SMFLAG, SIF_STAT_SIFINIT);
Old_SifSetReg(SIF_REG_SMFLAG, SIF_STAT_CMDINIT);
Old_SifSetReg(SIF_SYSREG_RPCINIT, 0);
Old_SifSetReg(SIF_SYSREG_SUBADDR, (int)NULL);
ee_kmode_exit();
Expand Down
11 changes: 3 additions & 8 deletions ee_core/src/patches.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,21 +331,16 @@ static void RnC3_UYA_patches(void *address)
1. if it's a module with no name (first 4 characters are 0s), left-shift once.
2. if it's a module beginning with "Deci", left-shift once.
3. if it's a module beginning with "cdvd", right-shift once.
Otherwise, nothing is done for the module.
Only modules up to before the 3rd last will be considered.
For us, it's about preserving the pointer to the allocated buffer and to adjust it accordingly:
For TOOL units, there are 6 DECI2 modules and 2 libcdvd modules. Therefore the pointer should be right-shifted by 4.
For retail units, there are 2 libcdvd modules. Therefore the pointer should be left-shifted by 2. */

word1 = JAL((unsigned int)&RnC3_AlwaysAllocMem);
switch (GameMode) {
case HDD_MODE:
//For HDD mode, the CDVDMAN module has its name as "dev9", so adjust the shifting accordingly.
#ifdef _DTL_T10000
word2 = 0x00021943; //sra $v1, $v0, 5 For DTL-T10000.
#else
word2 = 0x00021840; //sll $v1, $v0, 1 For retail sets.
#endif
break;
default:
#ifdef _DTL_T10000
word2 = 0x00021903; //sra $v1, $v0, 4 For DTL-T10000.
Expand Down
14 changes: 1 addition & 13 deletions modules/network/SMSTCPIP/api_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "lwip/opt.h"
#include "lwip/api.h"
#include "lwip/api_msg.h"
#include "lwip/tcpip.h"
#include "lwip/memp.h"

#include <intrman.h>
Expand All @@ -44,9 +45,6 @@

#include "smsutils.h"

extern void tcpip_apimsg(struct api_msg *apimsg);


struct netbuf *netbuf_new(void)
{
struct netbuf *buf = memp_malloc(MEMP_NETBUF);
Expand Down Expand Up @@ -169,7 +167,6 @@ struct
msg->msg.msg.bc.port = proto; /* misusing the port field */
msg->msg.conn = conn;
api_msg_post(msg);
sys_mbox_fetch(conn->mbox, NULL);
memp_free(MEMP_API_MSG, msg);

if (conn->err != ERR_OK) {
Expand All @@ -196,7 +193,6 @@ err_t netconn_delete(struct netconn *conn)
msg->type = API_MSG_DELCONN;
msg->msg.conn = conn;
api_msg_post(msg);
sys_mbox_fetch(conn->mbox, NULL);
memp_free(MEMP_API_MSG, msg);

/* Drain the recvmbox. */
Expand Down Expand Up @@ -304,7 +300,6 @@ err_t netconn_bind(struct netconn *conn, struct ip_addr *addr,
msg->msg.msg.bc.ipaddr = addr;
msg->msg.msg.bc.port = port;
api_msg_post(msg);
sys_mbox_fetch(conn->mbox, NULL);
memp_free(MEMP_API_MSG, msg);
return conn->err;
}
Expand Down Expand Up @@ -334,7 +329,6 @@ err_t netconn_connect(struct netconn *conn, struct ip_addr *addr,
msg->msg.msg.bc.ipaddr = addr;
msg->msg.msg.bc.port = port;
api_msg_post(msg);
sys_mbox_fetch(conn->mbox, NULL);
memp_free(MEMP_API_MSG, msg);
return conn->err;
}
Expand All @@ -353,7 +347,6 @@ err_t netconn_disconnect(struct netconn *conn)
msg->type = API_MSG_DISCONNECT;
msg->msg.conn = conn;
api_msg_post(msg);
sys_mbox_fetch(conn->mbox, NULL);
memp_free(MEMP_API_MSG, msg);
return conn->err;
}
Expand All @@ -379,7 +372,6 @@ err_t netconn_listen(struct netconn *conn)
msg->type = API_MSG_LISTEN;
msg->msg.conn = conn;
api_msg_post(msg);
sys_mbox_fetch(conn->mbox, NULL);
memp_free(MEMP_API_MSG, msg);
return conn->err;
}
Expand Down Expand Up @@ -476,7 +468,6 @@ netconn_recv(struct netconn *conn)
}
api_msg_post(msg);

sys_mbox_fetch(conn->mbox, NULL);
memp_free(MEMP_API_MSG, msg);
} else {
sys_mbox_fetch(conn->recvmbox, (void **)&buf);
Expand Down Expand Up @@ -509,7 +500,6 @@ err_t netconn_send(struct netconn *conn, struct netbuf *buf)
msg->msg.msg.p = buf->p;
api_msg_post(msg);

sys_mbox_fetch(conn->mbox, NULL);
memp_free(MEMP_API_MSG, msg);
return conn->err;
}
Expand Down Expand Up @@ -561,7 +551,6 @@ err_t netconn_write(struct netconn *conn, void *dataptr, u16_t size, u8_t copy)
LWIP_DEBUGF(API_LIB_DEBUG, ("netconn_write: writing %d bytes (%d)\n", len, copy));
msg->msg.msg.w.len = len;
api_msg_post(msg);
sys_mbox_fetch(conn->mbox, NULL);
if (conn->err == ERR_OK) {
dataptr = (void *)((u8_t *)dataptr + len);
size -= len;
Expand Down Expand Up @@ -595,7 +584,6 @@ err_t netconn_close(struct netconn *conn)
msg->type = API_MSG_CLOSE;
msg->msg.conn = conn;
api_msg_post(msg);
sys_mbox_fetch(conn->mbox, NULL);
if (conn->err == ERR_MEM &&
conn->sem != SYS_SEM_NULL) {
sys_sem_wait(conn->sem);
Expand Down
4 changes: 2 additions & 2 deletions modules/network/SMSTCPIP/tcpip.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ void tcpip_apimsg(struct api_msg *apimsg)
msg->type = TCPIP_MSG_API;
msg->msg.apimsg = apimsg;
sys_mbox_post(g_TCPIPMBox, msg);
sys_mbox_fetch(apimsg->msg.conn->mbox, NULL);

} else
memp_free(MEMP_API_MSG, apimsg);
}
#endif /* LWIP_TCPIP_CORE_LOCKING */

} /* end tcpip_apimsg */
Expand Down

0 comments on commit 60b7f13

Please sign in to comment.