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#199 from sp193/fixes-feb19-3
Browse files Browse the repository at this point in the history
Fixes Feb19 (III)
  • Loading branch information
ElPatas1 authored Feb 17, 2019
2 parents 60b7f13 + 74a01ca commit 5d44d4e
Show file tree
Hide file tree
Showing 13 changed files with 84 additions and 198 deletions.
2 changes: 1 addition & 1 deletion ee_core/src/iopmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ static void ResetIopSpecial(const char *args, unsigned int arglen)
#define PADEMU_ARG
#endif
if (GameMode == USB_MODE PADEMU_ARG) {
LoadOPLModule(OPL_MODULE_ID_USBD, 0, 11, "thpri=15,16");
LoadOPLModule(OPL_MODULE_ID_USBD, 0, 11, "thpri=2,3");
}
if (GameMode == ETH_MODE) {
LoadOPLModule(OPL_MODULE_ID_SMSTCPIP, 0, 0, NULL);
Expand Down
2 changes: 1 addition & 1 deletion modules/debug/udptty-ingame/imports.lst
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ loadcore_IMPORTS_end

intrman_IMPORTS_start
I_QueryIntrContext
I_intrman_14
I_CpuInvokeInKmode
intrman_IMPORTS_end

7 changes: 0 additions & 7 deletions modules/debug/udptty-ingame/intrman_add.h

This file was deleted.

1 change: 0 additions & 1 deletion modules/debug/udptty-ingame/irx_imports.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
/* Please keep these in alphabetical order! */
#include "ioman.h"
#include "intrman.h"
#include "intrman_add.h"
#include "loadcore.h"
#include "smstcpip.h"
#include "stdio.h"
Expand Down
18 changes: 8 additions & 10 deletions modules/debug/udptty-ingame/udptty.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <thsemap.h>
#include <ioman.h>
#include <intrman.h>
#include "intrman_add.h"
#include <sysclib.h>
#include <sysmem.h>
#include <thbase.h>
Expand Down Expand Up @@ -87,13 +86,13 @@ typedef struct _KprArg
int calls;
} KprArg;

KprArg g_kprarg;
static KprArg g_kprarg;

#define KPR_BUFFER_SIZE 0x1000
char kprbuffer[KPR_BUFFER_SIZE];
static char kprbuffer[KPR_BUFFER_SIZE];


void PrntFunc(void *common, int chr)
static void PrntFunc(void *common, int chr)
{
KprArg *kpa = (KprArg *)common;

Expand Down Expand Up @@ -122,12 +121,12 @@ void *Kprnt(void *common, const char *format, void *arg)
return 0;
}

void *Kprintf_Handler(void *common, const char *format, void *arg)
static void *Kprintf_Handler(void *common, const char *format, va_list ap)
{
KprArg *kpa = (KprArg *)common;
void *res;

res = intrman_14(Kprnt, kpa, (void *)format, arg);
res = (void*)CpuInvokeInKmode(Kprnt, kpa, format, ap);

if (QueryIntrContext())
iSetEventFlag(kpa->eflag, 1);
Expand All @@ -137,7 +136,7 @@ void *Kprintf_Handler(void *common, const char *format, void *arg)
return res;
}

void KPRTTY_Thread(void *args)
static void KPRTTY_Thread(void *args)
{
u32 flags;
KprArg *kpa = (KprArg *)args;
Expand All @@ -146,14 +145,13 @@ void KPRTTY_Thread(void *args)
WaitEventFlag(kpa->eflag, 1, WEF_AND | WEF_CLEAR, &flags);

if (kpa->prpos) {
if (strncmp(kpa->kpbuf, "WARNING: WaitSema KE_CAN_NOT_WAIT", kpa->prpos - 2))
write(1, kpa->kpbuf, kpa->prpos);
write(1, kpa->kpbuf, kpa->prpos);
kpa->prpos = 0;
}
}
}

void kprtty_init(void)
static void kprtty_init(void)
{
iop_event_t efp;
iop_thread_t thp;
Expand Down
12 changes: 9 additions & 3 deletions modules/iopcore/cdvdman/cdvdman.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,12 +385,18 @@ static int cdvdman_read_sectors(u32 lsn, unsigned int sectors, void *buf)
break;
}

// PS2LOGO Decryptor algorithm; based on misfire's code (https://github.com/mlafeldt/ps2logo)
/* PS2LOGO Decryptor algorithm; based on misfire's code (https://github.com/mlafeldt/ps2logo)
The PS2 logo is stored within the first 12 sectors, scrambled.
This algorithm exploits the characteristic that the value used for scrambling will be recorded,
when it is XOR'ed against a black pixel. The first pixel is black, hence the value of the first byte
was the value used for scrambling. */
if (lsn < 13) {
u32 j;
u8 *logo = (u8 *)ptr;
u8 key = logo[0];
if (logo[0] != 0) {
static u8 key = 0;
if (lsn == 0) //First sector? Copy the first byte as the value for unscrambling the logo.
key = logo[0];
if (key != 0) {
for (j = 0; j < (SectorsToRead * 2048); j++) {
logo[j] ^= key;
logo[j] = (logo[j] << 3) | (logo[j] >> 5);
Expand Down
4 changes: 4 additions & 0 deletions modules/network/SMSTCPIP/api_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,12 @@ struct
conn->type = t;
conn->pcb.tcp = NULL;

#if !LWIP_TCPIP_CORE_LOCKING
if ((conn->mbox = sys_mbox_new()) == SYS_MBOX_NULL) {
memp_free(MEMP_NETCONN, conn);
return NULL;
}
#endif
conn->recvmbox = SYS_MBOX_NULL;
conn->acceptmbox = SYS_MBOX_NULL;
conn->sem = SYS_SEM_NULL;
Expand Down Expand Up @@ -218,8 +220,10 @@ err_t netconn_delete(struct netconn *conn)
conn->acceptmbox = SYS_MBOX_NULL;
}

#if !LWIP_TCPIP_CORE_LOCKING
sys_mbox_free(conn->mbox);
conn->mbox = SYS_MBOX_NULL;
#endif
if (conn->sem != SYS_SEM_NULL) {
sys_sem_free(conn->sem);
}
Expand Down
6 changes: 3 additions & 3 deletions modules/network/SMSTCPIP/api_msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ err_tcp(void *arg, err_t err)
sys_mbox_post(conn->recvmbox, NULL);
}
if (conn->mbox != SYS_MBOX_NULL) {
sys_mbox_post(conn->mbox, NULL);
TCPIP_APIMSG_ACK(conn->mbox);
}
if (conn->acceptmbox != SYS_MBOX_NULL) {
/* Register event with callback */
Expand Down Expand Up @@ -475,7 +475,7 @@ do_connected(void *arg, struct tcp_pcb *pcb, err_t err)
if (conn->type == NETCONN_TCP && err == ERR_OK) {
setup_tcp(conn);
}
sys_mbox_post(conn->mbox, NULL);
TCPIP_APIMSG_ACK(conn->mbox);
return ERR_OK;
}
#endif
Expand Down Expand Up @@ -700,7 +700,7 @@ static void do_recv(struct api_msg_msg *msg)
if (conn->pcb.tcp && conn->type == NETCONN_TCP)
tcp_recved(conn->pcb.tcp, msg->msg.len);
#endif
sys_mbox_post(conn->mbox, NULL);
TCPIP_APIMSG_ACK(conn->mbox);

} /* end do_recv */

Expand Down
1 change: 0 additions & 1 deletion modules/network/SMSTCPIP/include/lwip/api_msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ struct api_msg_msg
u16_t len;
unsigned char copy;
} w;
sys_mbox_t mbox;
u16_t len;
} msg;
};
Expand Down
Loading

0 comments on commit 5d44d4e

Please sign in to comment.