@@ -49,11 +49,16 @@ int module_get_export_func(SceUID pid, const char *modname, uint32_t libnid, uin
4949 name##HookUid = taiHookFunctionExportForKernel(KERNEL_PID, &name##HookRef, (module), (lib_nid), (func_nid), \
5050 (const void *)name##HookFunc)
5151
52+ #define BIND_FUNC_OFFSET_HOOK (name , modid , segidx , offset , thumb ) \
53+ name##HookUid = taiHookFunctionOffsetForKernel(KERNEL_PID, &name##HookRef, \
54+ (modid), (segidx), (offset), thumb, (const void*)name##HookFunc)
5255
5356#define GetExport (modname , lib_nid , func_nid , func ) \
5457 module_get_export_func(KERNEL_PID, modname, lib_nid, func_nid, (uintptr_t *)func)
5558
5659
60+ CatLogConfig_t Config ;
61+
5762static int net_thread_run = 0 ;
5863static SceUID net_thread_uid = 0 ;
5964
@@ -95,6 +100,13 @@ DECL_FUNC_HOOK(sceSblQafMgrIsAllowSystemAppDebugForDriver_patched)
95100 return 1 ;
96101}
97102
103+ DECL_FUNC_HOOK (ScePower_3e10_patched , int pid , int flags , unsigned int set )
104+ {
105+ if (flags == 3 && Config .net ) // WLAN/COM
106+ set = 1 ;
107+ return TAI_CONTINUE (int , ScePower_3e10_patchedHookRef , pid , flags , set );
108+ }
109+
98110/* flags for sceNetShutdown */
99111#define SCE_NET_SHUT_RD 0
100112#define SCE_NET_SHUT_WR 1
@@ -180,7 +192,6 @@ static int net_thread(SceSize args, void *argp)
180192 return 0 ;
181193}
182194
183- CatLogConfig_t Config ;
184195
185196int SaveConfig (void )
186197{
@@ -198,6 +209,7 @@ int CreateConfig(void)
198209 Config .host = 0x0100007f ; // 127.0.0.1
199210 Config .port = DEFAULT_PORT ;
200211 Config .loglevel = 2 ;
212+ Config .net = 0 ;
201213
202214 SceUID fd = ksceIoOpen (CFG_PATH , SCE_O_WRONLY | SCE_O_CREAT | SCE_O_TRUNC , 0666 );
203215 if (fd < 0 ) return fd ;
@@ -210,8 +222,25 @@ int CreateConfig(void)
210222
211223int CheckConfig (void )
212224{
213- SceIoStat buf ;
214- return ksceIoGetstat (CFG_PATH , & buf );
225+ SceUID fd = ksceIoOpen (CFG_PATH , SCE_O_RDONLY , 0 );
226+ if (fd < 0 )
227+ {
228+ return fd ;
229+ }
230+
231+ CatLogConfig_t tmp ;
232+
233+ int res = ksceIoRead (fd , & tmp , sizeof (CatLogConfig_t ));
234+
235+ if (res != sizeof (CatLogConfig_t ))
236+ {
237+ ksceIoClose (fd );
238+ return -1 ;
239+ }
240+
241+ ksceIoClose (fd );
242+
243+ return 0 ;
215244}
216245
217246int LoadConfig (void )
@@ -252,7 +281,7 @@ int LoadConfig(void)
252281}
253282
254283
255- int CatLogUpdateConfig (uint32_t host , uint16_t port , uint16_t level )
284+ int CatLogUpdateConfig (uint32_t host , uint16_t port , uint16_t level , uint8_t net )
256285{
257286 uint32_t state ;
258287
@@ -261,6 +290,7 @@ int CatLogUpdateConfig(uint32_t host, uint16_t port, uint16_t level)
261290 Config .host = host ;
262291 Config .port = port ;
263292 Config .loglevel = level ;
293+ Config .net = net ;
264294 sceKernelSetAssertLevelForKernel (Config .loglevel );
265295
266296 server .sin_addr .s_addr = host ;
@@ -273,7 +303,7 @@ int CatLogUpdateConfig(uint32_t host, uint16_t port, uint16_t level)
273303 return 0 ;
274304}
275305
276- int CatLogReadConfig (uint32_t * host , uint16_t * port , uint16_t * level )
306+ int CatLogReadConfig (uint32_t * host , uint16_t * port , uint16_t * level , uint8_t * net )
277307{
278308 int res ;
279309 uint32_t state ;
@@ -298,6 +328,12 @@ int CatLogReadConfig(uint32_t* host, uint16_t* port, uint16_t* level)
298328 goto end ;
299329 }
300330
331+ res = ksceKernelMemcpyKernelToUser ((void * )net , & Config .net , 1 );
332+ if (res < 0 )
333+ {
334+ goto end ;
335+ }
336+
301337end :
302338 EXIT_SYSCALL (state );
303339
@@ -328,6 +364,15 @@ int CatLogInit(void)
328364 goto end ;
329365 }
330366
367+ tai_module_info_t modInfo ;
368+ modInfo .size = sizeof (tai_module_info_t );
369+
370+ if (taiGetModuleInfoForKernel (KERNEL_PID , "ScePower" , & modInfo ) < 0 )
371+ {
372+ ret = -1 ;
373+ goto end ;
374+ }
375+
331376 if (GetExport ("SceSysmem" , 0x88C17370 , 0xCE9060F1 , & sceKernelSetAssertLevelForKernel ) < 0 )
332377 if (GetExport ("SceSysmem" , 0x13D793B7 , 0xC5889385 , & sceKernelSetAssertLevelForKernel ) < 0 )
333378 {
@@ -359,6 +404,8 @@ int CatLogInit(void)
359404 BIND_FUNC_EXPORT_HOOK (sceSblQafMgrIsAllowKernelDebugForDriver_patched , "SceSysmem" , 0xFFFFFFFF , 0x382C71E8 );
360405 BIND_FUNC_EXPORT_HOOK (sceSblQafMgrIsAllowSystemAppDebugForDriver_patched , "SceSysmem" , 0xFFFFFFFF , 0xCAD47130 );
361406
407+ BIND_FUNC_OFFSET_HOOK (ScePower_3e10_patched , modInfo .modid , 0 , 0x3E10 , 1 );
408+
362409 ret = sceDebugDisableInfoDumpForKernel (0 );
363410 if (ret < 0 )
364411 {
0 commit comments