Skip to content

Commit 8551dd2

Browse files
author
El_Patas
authored
Merge pull request ps2homebrew#199 from sp193/fixes-feb19-3
Fixes Feb19 (III)
2 parents c1039e7 + 178911e commit 8551dd2

File tree

13 files changed

+84
-198
lines changed

13 files changed

+84
-198
lines changed

ee_core/src/iopmgr.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static void ResetIopSpecial(const char *args, unsigned int arglen)
8686
#define PADEMU_ARG
8787
#endif
8888
if (GameMode == USB_MODE PADEMU_ARG) {
89-
LoadOPLModule(OPL_MODULE_ID_USBD, 0, 11, "thpri=15,16");
89+
LoadOPLModule(OPL_MODULE_ID_USBD, 0, 11, "thpri=2,3");
9090
}
9191
if (GameMode == ETH_MODE) {
9292
LoadOPLModule(OPL_MODULE_ID_SMSTCPIP, 0, 0, NULL);

modules/debug/udptty-ingame/imports.lst

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@ loadcore_IMPORTS_end
5252

5353
intrman_IMPORTS_start
5454
I_QueryIntrContext
55-
I_intrman_14
55+
I_CpuInvokeInKmode
5656
intrman_IMPORTS_end
5757

modules/debug/udptty-ingame/intrman_add.h

-7
This file was deleted.

modules/debug/udptty-ingame/irx_imports.h

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
/* Please keep these in alphabetical order! */
2020
#include "ioman.h"
2121
#include "intrman.h"
22-
#include "intrman_add.h"
2322
#include "loadcore.h"
2423
#include "smstcpip.h"
2524
#include "stdio.h"

modules/debug/udptty-ingame/udptty.c

+8-10
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include <thsemap.h>
2121
#include <ioman.h>
2222
#include <intrman.h>
23-
#include "intrman_add.h"
2423
#include <sysclib.h>
2524
#include <sysmem.h>
2625
#include <thbase.h>
@@ -87,13 +86,13 @@ typedef struct _KprArg
8786
int calls;
8887
} KprArg;
8988

90-
KprArg g_kprarg;
89+
static KprArg g_kprarg;
9190

9291
#define KPR_BUFFER_SIZE 0x1000
93-
char kprbuffer[KPR_BUFFER_SIZE];
92+
static char kprbuffer[KPR_BUFFER_SIZE];
9493

9594

96-
void PrntFunc(void *common, int chr)
95+
static void PrntFunc(void *common, int chr)
9796
{
9897
KprArg *kpa = (KprArg *)common;
9998

@@ -122,12 +121,12 @@ void *Kprnt(void *common, const char *format, void *arg)
122121
return 0;
123122
}
124123

125-
void *Kprintf_Handler(void *common, const char *format, void *arg)
124+
static void *Kprintf_Handler(void *common, const char *format, va_list ap)
126125
{
127126
KprArg *kpa = (KprArg *)common;
128127
void *res;
129128

130-
res = intrman_14(Kprnt, kpa, (void *)format, arg);
129+
res = (void*)CpuInvokeInKmode(Kprnt, kpa, format, ap);
131130

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

140-
void KPRTTY_Thread(void *args)
139+
static void KPRTTY_Thread(void *args)
141140
{
142141
u32 flags;
143142
KprArg *kpa = (KprArg *)args;
@@ -146,14 +145,13 @@ void KPRTTY_Thread(void *args)
146145
WaitEventFlag(kpa->eflag, 1, WEF_AND | WEF_CLEAR, &flags);
147146

148147
if (kpa->prpos) {
149-
if (strncmp(kpa->kpbuf, "WARNING: WaitSema KE_CAN_NOT_WAIT", kpa->prpos - 2))
150-
write(1, kpa->kpbuf, kpa->prpos);
148+
write(1, kpa->kpbuf, kpa->prpos);
151149
kpa->prpos = 0;
152150
}
153151
}
154152
}
155153

156-
void kprtty_init(void)
154+
static void kprtty_init(void)
157155
{
158156
iop_event_t efp;
159157
iop_thread_t thp;

modules/iopcore/cdvdman/cdvdman.c

+9-3
Original file line numberDiff line numberDiff line change
@@ -385,12 +385,18 @@ static int cdvdman_read_sectors(u32 lsn, unsigned int sectors, void *buf)
385385
break;
386386
}
387387

388-
// PS2LOGO Decryptor algorithm; based on misfire's code (https://github.com/mlafeldt/ps2logo)
388+
/* PS2LOGO Decryptor algorithm; based on misfire's code (https://github.com/mlafeldt/ps2logo)
389+
The PS2 logo is stored within the first 12 sectors, scrambled.
390+
This algorithm exploits the characteristic that the value used for scrambling will be recorded,
391+
when it is XOR'ed against a black pixel. The first pixel is black, hence the value of the first byte
392+
was the value used for scrambling. */
389393
if (lsn < 13) {
390394
u32 j;
391395
u8 *logo = (u8 *)ptr;
392-
u8 key = logo[0];
393-
if (logo[0] != 0) {
396+
static u8 key = 0;
397+
if (lsn == 0) //First sector? Copy the first byte as the value for unscrambling the logo.
398+
key = logo[0];
399+
if (key != 0) {
394400
for (j = 0; j < (SectorsToRead * 2048); j++) {
395401
logo[j] ^= key;
396402
logo[j] = (logo[j] << 3) | (logo[j] >> 5);

modules/network/SMSTCPIP/api_lib.c

+4
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,12 @@ struct
146146
conn->type = t;
147147
conn->pcb.tcp = NULL;
148148

149+
#if !LWIP_TCPIP_CORE_LOCKING
149150
if ((conn->mbox = sys_mbox_new()) == SYS_MBOX_NULL) {
150151
memp_free(MEMP_NETCONN, conn);
151152
return NULL;
152153
}
154+
#endif
153155
conn->recvmbox = SYS_MBOX_NULL;
154156
conn->acceptmbox = SYS_MBOX_NULL;
155157
conn->sem = SYS_SEM_NULL;
@@ -218,8 +220,10 @@ err_t netconn_delete(struct netconn *conn)
218220
conn->acceptmbox = SYS_MBOX_NULL;
219221
}
220222

223+
#if !LWIP_TCPIP_CORE_LOCKING
221224
sys_mbox_free(conn->mbox);
222225
conn->mbox = SYS_MBOX_NULL;
226+
#endif
223227
if (conn->sem != SYS_SEM_NULL) {
224228
sys_sem_free(conn->sem);
225229
}

modules/network/SMSTCPIP/api_msg.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ err_tcp(void *arg, err_t err)
196196
sys_mbox_post(conn->recvmbox, NULL);
197197
}
198198
if (conn->mbox != SYS_MBOX_NULL) {
199-
sys_mbox_post(conn->mbox, NULL);
199+
TCPIP_APIMSG_ACK(conn->mbox);
200200
}
201201
if (conn->acceptmbox != SYS_MBOX_NULL) {
202202
/* Register event with callback */
@@ -475,7 +475,7 @@ do_connected(void *arg, struct tcp_pcb *pcb, err_t err)
475475
if (conn->type == NETCONN_TCP && err == ERR_OK) {
476476
setup_tcp(conn);
477477
}
478-
sys_mbox_post(conn->mbox, NULL);
478+
TCPIP_APIMSG_ACK(conn->mbox);
479479
return ERR_OK;
480480
}
481481
#endif
@@ -700,7 +700,7 @@ static void do_recv(struct api_msg_msg *msg)
700700
if (conn->pcb.tcp && conn->type == NETCONN_TCP)
701701
tcp_recved(conn->pcb.tcp, msg->msg.len);
702702
#endif
703-
sys_mbox_post(conn->mbox, NULL);
703+
TCPIP_APIMSG_ACK(conn->mbox);
704704

705705
} /* end do_recv */
706706

modules/network/SMSTCPIP/include/lwip/api_msg.h

-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ struct api_msg_msg
8181
u16_t len;
8282
unsigned char copy;
8383
} w;
84-
sys_mbox_t mbox;
8584
u16_t len;
8685
} msg;
8786
};

0 commit comments

Comments
 (0)