diff --git a/.gitattributes b/.gitattributes index bdb0cabc8..1dc995584 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,16 +2,16 @@ * text=auto # Custom for Visual Studio -*.cs diff=csharp +*.cs diff=csharp # Standard to msysgit -*.doc diff=astextplain -*.DOC diff=astextplain +*.doc diff=astextplain +*.DOC diff=astextplain *.docx diff=astextplain *.DOCX diff=astextplain *.dot diff=astextplain *.DOT diff=astextplain *.pdf diff=astextplain -*.PDF diff=astextplain -*.rtf diff=astextplain -*.RTF diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/CHANGELOG b/CHANGELOG index 44893adfc..188bf2855 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -109,10 +109,10 @@ GUI: COMPATIBILITY: - * Kingdom Hearts 2 Final Mix (Gummi Fix) - * Baldar's Gate Series (HDD) - * Champions of Norrath (HDD) - * New Mode 7 fixes stuttering with games such as DDR and Pop'N Music (HDD ONLY!) +* Kingdom Hearts 2 Final Mix (Gummi Fix) +* Baldar's Gate Series (HDD) +* Champions of Norrath (HDD) +* New Mode 7 fixes stuttering with games such as DDR and Pop'N Music (HDD ONLY!) ==== Version 0.9 ==== diff --git a/ee_core/include/asm.h b/ee_core/include/asm.h index ac643a7d7..a3159d138 100644 --- a/ee_core/include/asm.h +++ b/ee_core/include/asm.h @@ -3,7 +3,7 @@ Copyright 2006-2008 Polo Licenced under Academic Free License version 3.0 Review Open-Ps2-Loader README & LICENSE files for further details. - + Some parts of the code are taken from HD Project by Polo */ diff --git a/ee_core/include/ee_core.h b/ee_core/include/ee_core.h index 8f9d63441..72eb4186d 100644 --- a/ee_core/include/ee_core.h +++ b/ee_core/include/ee_core.h @@ -89,6 +89,6 @@ extern int PadEmuSettings; extern int DisableDebug; #define GS_BGCOLOUR *((volatile unsigned long int *)0x120000E0) -extern int *gCheatList; //Store hooks/codes addr+val pairs +extern int *gCheatList; // Store hooks/codes addr+val pairs #endif diff --git a/ee_core/include/gsm_defines.h b/ee_core/include/gsm_defines.h index c624a7a6a..ce6590398 100644 --- a/ee_core/include/gsm_defines.h +++ b/ee_core/include/gsm_defines.h @@ -13,9 +13,9 @@ # */ -.equ TRAP_BASE, 0x12000000 -.equ TRAP_MASK, 0x1FFFEF0F -.equ GS_BASE, 0x12000000 +.equ TRAP_BASE, 0x12000000 +.equ TRAP_MASK, 0x1FFFEF0F +.equ GS_BASE, 0x12000000 .equ GS_PMODE, 0x0000 .equ GS_SMODE1, 0x0010 .equ GS_SMODE2, 0x0020 @@ -87,5 +87,5 @@ GS_MODE_DTV_576P=0x53 #GSMAdapts .equ Adapted_DISPLAY1, 0 # DWORD .equ Adapted_DISPLAY2, 8 # DWORD -.equ Interlace_FRAME_Mode_Flag, 16 # BYTE -> Double Height for SMODE2's INT=1 (Interlace Mode) and FFMD=1 (FRAME Mode. Read every line) +.equ Interlace_FRAME_Mode_Flag, 16 # BYTE -> Double Height for SMODE2's INT=1 (Interlace Mode) and FFMD=1 (FRAME Mode. Read every line) .equ SMODE2_adaptation, 17 # BYTE -> Adapted SMODE2 patch value diff --git a/ee_core/include/igs_api.h b/ee_core/include/igs_api.h index ef86c48d9..c3417b393 100644 --- a/ee_core/include/igs_api.h +++ b/ee_core/include/igs_api.h @@ -38,13 +38,13 @@ #define GS_TRXDIR 0x53 #define GS_FINISH 0x61 -//Pixel storage format -#define GS_PSM_CT32 0x00 //32 bits = 4 bytes Example: SLUS_202.73 (Namco Museum 50th Anniversary) -#define GS_PSM_CT24 0x01 //24 bits = 3 bytes Example: SLPS_250.88 (Final Fantasy X International) -#define GS_PSM_CT16 0x02 //16 bits = 2 bytes Example: SLUS_215.56 (Konami Kids Playground: Dinosaurs Shapes & Colors) -#define GS_PSM_CT16S 0x0A //16 bits = 2 bytes Example: SLUS_215.41 (Ratatouille) +// Pixel storage format +#define GS_PSM_CT32 0x00 // 32 bits = 4 bytes Example: SLUS_202.73 (Namco Museum 50th Anniversary) +#define GS_PSM_CT24 0x01 // 24 bits = 3 bytes Example: SLPS_250.88 (Final Fantasy X International) +#define GS_PSM_CT16 0x02 // 16 bits = 2 bytes Example: SLUS_215.56 (Konami Kids Playground: Dinosaurs Shapes & Colors) +#define GS_PSM_CT16S 0x0A // 16 bits = 2 bytes Example: SLUS_215.41 (Ratatouille) -//Channel #1 (VIF1) +// Channel #1 (VIF1) #define GS_VIF1_STAT ((volatile u32 *)(0x10003c00)) // VIF Status Register #define GS_VIF1_STAT_FDR (1 << 23) // VIF1-FIFO transfer direction: VIF1 -> Main memory/SPRAM" #define GS_VIF1_MSKPATH3(mask) ((u32)(mask) | ((u32)0x06 << 24)) @@ -53,7 +53,7 @@ #define GS_VIF1_DIRECT(count) ((u32)(count) | ((u32)(0x50) << 24)) #define GS_VIF1_FIFO ((volatile u128 *)(0x10005000)) -//DMA CH1 REGISTERS (Linked to VIF1) +// DMA CH1 REGISTERS (Linked to VIF1) #define GS_D1_CHCR ((volatile u32 *)(0x10009000)) #define GS_D1_MADR ((volatile u32 *)(0x10009010)) #define GS_D1_QWC ((volatile u32 *)(0x10009020)) @@ -61,7 +61,7 @@ #define GS_D1_ASR0 ((volatile u32 *)(0x10009040)) #define GS_D1_ASR1 ((volatile u32 *)(0x10009050)) -//Channel #2 (GIF) +// Channel #2 (GIF) #define GS_GIF_AD 0x0e #define GS_GIFTAG(NLOOP, EOP, PRE, PRIM, FLG, NREG) \ @@ -72,7 +72,7 @@ ((u64)(FLG) << 58) | \ ((u64)(NREG) << 60) -//GS Registers +// GS Registers #define GS_GSBITBLTBUF_SET(sbp, sbw, spsm, dbp, dbw, dpsm) \ ((u64)(sbp) | ((u64)(sbw) << 16) | \ ((u64)(spsm) << 24) | ((u64)(dbp) << 32) | \ @@ -94,7 +94,7 @@ #define GS_GSTRXREG 0x52 #define GS_GSTRXDIR 0x53 -//GS Priviledge Registers +// GS Priviledge Registers #define GS_CSR_FINISH (1 << 1) #define GS_CSR (volatile u64 *)0x12001000 // GS CSR (GS System Status) Register #define GS_IMR (volatile u64 *)0x12001010 // GS IMR (GS Interrupt Mask) Register @@ -115,7 +115,7 @@ #define GS_WRITEBACK_DCACHE 0 -//GSM Stuff +// GSM Stuff struct GSMSourceSetGsCrt { s16 interlace; diff --git a/ee_core/include/iopmgr.h b/ee_core/include/iopmgr.h index 68c42ca94..e48fc31c0 100644 --- a/ee_core/include/iopmgr.h +++ b/ee_core/include/iopmgr.h @@ -3,7 +3,7 @@ Copyright 2006-2008 Polo Licenced under Academic Free License version 3.0 Review OpenUsbLd README & LICENSE files for further details. - + Some parts of the code are taken from HD Project by Polo */ diff --git a/ee_core/include/modmgr.h b/ee_core/include/modmgr.h index 325658244..b85def6f7 100644 --- a/ee_core/include/modmgr.h +++ b/ee_core/include/modmgr.h @@ -3,7 +3,7 @@ Copyright 2006-2008 Polo Licenced under Academic Free License version 3.0 Review OpenUsbLd README & LICENSE files for further details. - + Some parts of the code are taken from HD Project by Polo */ diff --git a/ee_core/include/modules.h b/ee_core/include/modules.h index 897216e65..fb0a0fbac 100644 --- a/ee_core/include/modules.h +++ b/ee_core/include/modules.h @@ -1,35 +1,35 @@ enum OPL_MODULE_ID { - //Basic modules + // Basic modules OPL_MODULE_ID_UDNL = 1, OPL_MODULE_ID_IOPRP, OPL_MODULE_ID_IMGDRV, OPL_MODULE_ID_RESETSPU, - //USB mode modules + // USB mode modules OPL_MODULE_ID_USBD, OPL_MODULE_ID_USBMASSBD, - //iLink mode modules + // iLink mode modules OPL_MODULE_ID_ILINK, OPL_MODULE_ID_ILINKBD, - //SMB mode modules + // SMB mode modules OPL_MODULE_ID_SMSTCPIP, OPL_MODULE_ID_SMAP, OPL_MODULE_ID_SMBINIT, - //VMC module + // VMC module OPL_MODULE_ID_MCEMU, OPL_MODULE_ID_PADEMU, - //Debugging modules + // Debugging modules OPL_MODULE_ID_UDPTTY, OPL_MODULE_ID_IOPTRAP, OPL_MODULE_ID_DRVTIF, OPL_MODULE_ID_TIFINET, - //Special patches + // Special patches OPL_MODULE_ID_IOP_PATCH, OPL_MODULE_ID_COUNT @@ -38,7 +38,7 @@ enum OPL_MODULE_ID { typedef struct { void *ptr; - unsigned int info; //Upper 8 bits = module ID + unsigned int info; // Upper 8 bits = module ID } irxptr_t; typedef struct @@ -47,7 +47,7 @@ typedef struct int count; } irxtab_t; -//Macros for working with module information. +// Macros for working with module information. #define GET_OPL_MOD_ID(x) ((x) >> 24) #define SET_OPL_MOD_ID(x) ((x) << 24) #define GET_OPL_MOD_SIZE(x) ((x)&0x00FFFFFF) diff --git a/ee_core/include/padhook.h b/ee_core/include/padhook.h index 88bb745e4..9a681c4c6 100644 --- a/ee_core/include/padhook.h +++ b/ee_core/include/padhook.h @@ -1,6 +1,6 @@ /* padhook.h Open PS2 Loader In Game Reset - + Copyright 2009-2010, Ifcaro, jimmikaelkael & Polo Copyright 2006-2008 Polo Licenced under Academic Free License version 3.0 @@ -75,11 +75,11 @@ typedef struct u32 *pattern; u32 *mask; int size; - u16 type; //Whether it's libpad or libpad2 + u16 type; // Whether it's libpad or libpad2 u16 version; } pattern_t; -#define IGR_LIBPAD_NONE 0 //libpad not found +#define IGR_LIBPAD_NONE 0 // libpad not found #define IGR_LIBPAD 1 #define IGR_LIBPAD2 2 diff --git a/ee_core/include/padpatterns.h b/ee_core/include/padpatterns.h index b69590b7c..af9a666ab 100644 --- a/ee_core/include/padpatterns.h +++ b/ee_core/include/padpatterns.h @@ -3,7 +3,7 @@ Copyright 2006-2008 Polo Licenced under Academic Free License version 3.0 Review Open-Ps2-Loader README & LICENSE files for further details. - + Some parts of the code are taken from HD Project by Polo */ @@ -31,28 +31,28 @@ * libpad 3.1.0.0 */ static u32 padPortOpenpattern0[] = { - 0x27bdff50, // addiu sp, sp, $ff50 - 0xffb40050, // sd s4, $0050(sp) - 0xffb30040, // sd s3, $0040(sp) - 0x00c0a02d, // daddu s4, a2, zero - 0xffb20030, // sd s2, $0030(sp) - 0x0080982d, // daddu s3, a0, zero - 0xffbf00a0, // sd ra, $00a0(sp) - 0x00a0902d, // daddu s2, a1, zero - 0xffbe0090, // sd fp, $0090(sp) - 0x3282003f, // andi v0, s4, $003f - 0xffb70080, // sd s7, $0080(sp) - 0xffb60070, // sd s6, $0070(sp) - 0xffb50060, // sd s5, $0060(sp) - 0xffb10020, // sd s1, $0020(sp) - 0x10400000, // beq v0, zero, $XXXXXXXX - 0xffb00010, // sd s0, $0010(sp) - 0x3c020000, // lui v0, $XXXX - 0x8c430000, // lw v1, $XXXX(v0) - 0x10600000, // beq v1, zero, $XXXXXXXX - 0x3c040000, // lui a0, $XXXX - 0x0280282d, // daddu a1, s4, zero - 0x0c000000 // jal scePrintf + 0x27bdff50, // addiu sp, sp, $ff50 + 0xffb40050, // sd s4, $0050(sp) + 0xffb30040, // sd s3, $0040(sp) + 0x00c0a02d, // daddu s4, a2, zero + 0xffb20030, // sd s2, $0030(sp) + 0x0080982d, // daddu s3, a0, zero + 0xffbf00a0, // sd ra, $00a0(sp) + 0x00a0902d, // daddu s2, a1, zero + 0xffbe0090, // sd fp, $0090(sp) + 0x3282003f, // andi v0, s4, $003f + 0xffb70080, // sd s7, $0080(sp) + 0xffb60070, // sd s6, $0070(sp) + 0xffb50060, // sd s5, $0060(sp) + 0xffb10020, // sd s1, $0020(sp) + 0x10400000, // beq v0, zero, $XXXXXXXX + 0xffb00010, // sd s0, $0010(sp) + 0x3c020000, // lui v0, $XXXX + 0x8c430000, // lw v1, $XXXX(v0) + 0x10600000, // beq v1, zero, $XXXXXXXX + 0x3c040000, // lui a0, $XXXX + 0x0280282d, // daddu a1, s4, zero + 0x0c000000 // jal scePrintf }; static u32 padPortOpenpattern0_mask[] = { 0xffffffff, @@ -84,25 +84,25 @@ static u32 padPortOpenpattern0_mask[] = { * libpad 2.1.0.0 */ static u32 padPortOpenpattern1[] = { - 0x27bdff50, // addiu sp, sp, $ff50 - 0xffb20030, // sd s2, $0030(sp) - 0xffb40050, // sd s4, $0050(sp) - 0x00c0902d, // daddu s2, a2, zero - 0xffb30040, // sd s3, $0040(sp) - 0x00a0a02d, // daddu s4, a1, zero - 0xffbf00a0, // sd ra, $00a0(sp) - 0x0080982d, // daddu s3, a0, zero - 0xffbe0090, // sd fp, $0090(sp) - 0x3242003f, // andi v0, s2, $003f - 0xffb70080, // sd s7, $0080(sp) - 0xffb60070, // sd s6, $0070(sp) - 0xffb50060, // sd s5, $0060(sp) - 0xffb10020, // sd s1, $0020(sp) - 0x10400000, // beq v0, zero, $XXXXXXXX - 0xffb00010, // sd s0, $0010(sp) - 0x3c040000, // lui a0, $XXXX - 0x0240282d, // daddu a1, s2, zero - 0x0c000000 // jal kprintf + 0x27bdff50, // addiu sp, sp, $ff50 + 0xffb20030, // sd s2, $0030(sp) + 0xffb40050, // sd s4, $0050(sp) + 0x00c0902d, // daddu s2, a2, zero + 0xffb30040, // sd s3, $0040(sp) + 0x00a0a02d, // daddu s4, a1, zero + 0xffbf00a0, // sd ra, $00a0(sp) + 0x0080982d, // daddu s3, a0, zero + 0xffbe0090, // sd fp, $0090(sp) + 0x3242003f, // andi v0, s2, $003f + 0xffb70080, // sd s7, $0080(sp) + 0xffb60070, // sd s6, $0070(sp) + 0xffb50060, // sd s5, $0060(sp) + 0xffb10020, // sd s1, $0020(sp) + 0x10400000, // beq v0, zero, $XXXXXXXX + 0xffb00010, // sd s0, $0010(sp) + 0x3c040000, // lui a0, $XXXX + 0x0240282d, // daddu a1, s2, zero + 0x0c000000 // jal kprintf }; static u32 padPortOpenpattern1_mask[] = { 0xffffffff, @@ -132,24 +132,24 @@ static u32 padPortOpenpattern1_mask[] = { * libpad 2.0.0.0 */ static u32 padPortOpenpattern2[] = { - 0x27bdff60, // addiu sp, sp, $ff60 - 0xffb20030, // sd s2, $0030(sp) - 0xffb70080, // sd s7, $0080(sp) - 0x00c0902d, // daddu s2, a2, zero - 0xffb60070, // sd s6, $0070(sp) - 0x0080b82d, // daddu s7, a0, zero - 0xffbf0090, // sd ra, $0090(sp) - 0x00a0b02d, // daddu s6, a1, zero - 0xffb50060, // sd s5, $0060(sp) - 0x3242003f, // andi v0, s2, $003f - 0xffb40050, // sd s4, $0050(sp) - 0xffb30040, // sd s3, $0040(sp) - 0xffb10020, // sd s1, $0020(sp) - 0x10400000, // beq v0, zero, $XXXXXXXX - 0xffb00010, // sd s0, $0010(sp) - 0x3c040000, // lui a0, $XXXX - 0x0240282d, // daddu a1, s2, zero - 0x0c000000 // jal printf + 0x27bdff60, // addiu sp, sp, $ff60 + 0xffb20030, // sd s2, $0030(sp) + 0xffb70080, // sd s7, $0080(sp) + 0x00c0902d, // daddu s2, a2, zero + 0xffb60070, // sd s6, $0070(sp) + 0x0080b82d, // daddu s7, a0, zero + 0xffbf0090, // sd ra, $0090(sp) + 0x00a0b02d, // daddu s6, a1, zero + 0xffb50060, // sd s5, $0060(sp) + 0x3242003f, // andi v0, s2, $003f + 0xffb40050, // sd s4, $0050(sp) + 0xffb30040, // sd s3, $0040(sp) + 0xffb10020, // sd s1, $0020(sp) + 0x10400000, // beq v0, zero, $XXXXXXXX + 0xffb00010, // sd s0, $0010(sp) + 0x3c040000, // lui a0, $XXXX + 0x0240282d, // daddu a1, s2, zero + 0x0c000000 // jal printf }; static u32 padPortOpenpattern2_mask[] = { 0xffffffff, @@ -177,22 +177,22 @@ static u32 padPortOpenpattern2_mask[] = { * libpad 1.5.0.0 */ static u32 padPortOpenpattern3[] = { - 0x27bdff70, // addiu sp, sp, $ff70 - 0xffb20030, // sd s2, $0030(sp) - 0xffb50060, // sd s5, $0060(sp) - 0x00c0902d, // daddu s2, a2, zero - 0xffb40050, // sd s4, $0050(sp) - 0x0080a82d, // daddu s5, a0, zero - 0xffbf0080, // sd ra, $0080(sp) - 0x00a0a02d, // daddu s4, a1, zero - 0xffb60070, // sd s6, $0070(sp) - 0x3242000f, // andi v0, s2, $000f - 0xffb30040, // sd s3, $0040(sp) - 0xffb10020, // sd s1, $0020(sp) - 0x10400000, // beq v0, zero, $XXXXXXXX - 0xffb00010, // sd s0, $0010(sp) - 0x3c040000, // lui a0, $XXXX - 0x0c000000 // jal printf + 0x27bdff70, // addiu sp, sp, $ff70 + 0xffb20030, // sd s2, $0030(sp) + 0xffb50060, // sd s5, $0060(sp) + 0x00c0902d, // daddu s2, a2, zero + 0xffb40050, // sd s4, $0050(sp) + 0x0080a82d, // daddu s5, a0, zero + 0xffbf0080, // sd ra, $0080(sp) + 0x00a0a02d, // daddu s4, a1, zero + 0xffb60070, // sd s6, $0070(sp) + 0x3242000f, // andi v0, s2, $000f + 0xffb30040, // sd s3, $0040(sp) + 0xffb10020, // sd s1, $0020(sp) + 0x10400000, // beq v0, zero, $XXXXXXXX + 0xffb00010, // sd s0, $0010(sp) + 0x3c040000, // lui a0, $XXXX + 0x0c000000 // jal printf }; static u32 padPortOpenpattern3_mask[] = { 0xffffffff, @@ -221,30 +221,30 @@ static u32 padPortOpenpattern3_mask[] = { * libpad2 3.1.0.0 */ static u32 pad2CreateSocketpattern0[] = { - 0x27bdff90, // addiu sp, sp, $ff90 - 0x0080302d, // daddu a2, a0, zero - 0xffb10040, // sd s1, $0040(sp) - 0x00a0882d, // daddu s1, a1, zero - 0xffbf0060, // sd ra, $0060(sp) - 0xffb20050, // sd s2, $0050(sp) - 0x3222003f, // andi v0, s1, $003f - 0x10400000, // beq v0, zero, $XXXXXXXX - 0xffb00030, // sd s0, $0030(sp) - 0x3c040000, // lui a0, $XXXX - 0x0c000000, // jal scePrintf - 0x24840000, // addiu a0, a0, $XXXX - 0x10000000, // beq zero, zero, $XXXXXXXX - 0x2402ffff, // addiu v0, zero, $ffff - 0x50c00000, // beql a2, zero, $XXXXXXXX - 0xafa00000, // sw zero, $0000(sp) - 0x8cc20000, // lw v0, $0000(a2) - 0x8cc30004, // lw v1, $0004(a2) - 0x8cc40008, // lw a0, $0008(a2) - 0x8cc5000c, // lw a1, $000c(a2) - 0xafa20000, // sw v0, $0000(sp) - 0xafa30008, // sw v1, $0008(sp) - 0xafa4000c, // sw a0, $000c(sp) - 0xafa50010 // sw a1, $0010(sp) + 0x27bdff90, // addiu sp, sp, $ff90 + 0x0080302d, // daddu a2, a0, zero + 0xffb10040, // sd s1, $0040(sp) + 0x00a0882d, // daddu s1, a1, zero + 0xffbf0060, // sd ra, $0060(sp) + 0xffb20050, // sd s2, $0050(sp) + 0x3222003f, // andi v0, s1, $003f + 0x10400000, // beq v0, zero, $XXXXXXXX + 0xffb00030, // sd s0, $0030(sp) + 0x3c040000, // lui a0, $XXXX + 0x0c000000, // jal scePrintf + 0x24840000, // addiu a0, a0, $XXXX + 0x10000000, // beq zero, zero, $XXXXXXXX + 0x2402ffff, // addiu v0, zero, $ffff + 0x50c00000, // beql a2, zero, $XXXXXXXX + 0xafa00000, // sw zero, $0000(sp) + 0x8cc20000, // lw v0, $0000(a2) + 0x8cc30004, // lw v1, $0004(a2) + 0x8cc40008, // lw a0, $0008(a2) + 0x8cc5000c, // lw a1, $000c(a2) + 0xafa20000, // sw v0, $0000(sp) + 0xafa30008, // sw v1, $0008(sp) + 0xafa4000c, // sw a0, $000c(sp) + 0xafa50010 // sw a1, $0010(sp) }; static u32 pad2CreateSocketpattern0_mask[] = { 0xffffffff, @@ -275,34 +275,34 @@ static u32 pad2CreateSocketpattern0_mask[] = { /************************************************************************** * For libpad2 support * - * libpad2 2.7.0.0 + * libpad2 2.7.0.0 */ static u32 pad2CreateSocketpattern1[] = { - 0x27bdff70, // addiu sp, sp, $ff70 - 0x0080302d, // daddu a2, a0, zero - 0xffb30060, // sd s3, $0060(sp) - 0x00a0982d, // daddu s3, a1, zero - 0xffbf0080, // sd ra, $0080(sp) - 0xffb40070, // sd s4, $0070(sp) - 0x3262003f, // andi v0, s3, $003f - 0xffb20050, // sd s2, $0050(sp) - 0xffb10040, // sd s1, $0040(sp) - 0x10400000, // beq v0, zero, $XXXXXXXX - 0xffb00030, // sd s0, $0030(sp) - 0x3c040000, // lui a0, $XXXX - 0x0c000000, // jal scePrintf - 0x24840000, // addiu a0, a0, $XXXX - 0x10000000, // beq zero, zero, $XXXXXXXX - 0x2402ffff, // addiu v0, zero, $ffff - 0x50c00000, // beql a2, zero, $XXXXXXXX - 0xafa00000, // sw zero, $0000(sp) - 0x8cc20000, // lw v0, $0000(a2) - 0x8cc30004, // lw v1, $0004(a2) - 0x8cc40008, // lw a0, $0008(a2) - 0x8cc5000c, // lw a1, $000c(a2) - 0xafa20000, // sw v0, $0000(sp) - 0xafa30008, // sw v1, $0008(sp) - 0xafa4000c // sw a0, $000c(sp) + 0x27bdff70, // addiu sp, sp, $ff70 + 0x0080302d, // daddu a2, a0, zero + 0xffb30060, // sd s3, $0060(sp) + 0x00a0982d, // daddu s3, a1, zero + 0xffbf0080, // sd ra, $0080(sp) + 0xffb40070, // sd s4, $0070(sp) + 0x3262003f, // andi v0, s3, $003f + 0xffb20050, // sd s2, $0050(sp) + 0xffb10040, // sd s1, $0040(sp) + 0x10400000, // beq v0, zero, $XXXXXXXX + 0xffb00030, // sd s0, $0030(sp) + 0x3c040000, // lui a0, $XXXX + 0x0c000000, // jal scePrintf + 0x24840000, // addiu a0, a0, $XXXX + 0x10000000, // beq zero, zero, $XXXXXXXX + 0x2402ffff, // addiu v0, zero, $ffff + 0x50c00000, // beql a2, zero, $XXXXXXXX + 0xafa00000, // sw zero, $0000(sp) + 0x8cc20000, // lw v0, $0000(a2) + 0x8cc30004, // lw v1, $0004(a2) + 0x8cc40008, // lw a0, $0008(a2) + 0x8cc5000c, // lw a1, $000c(a2) + 0xafa20000, // sw v0, $0000(sp) + 0xafa30008, // sw v1, $0008(sp) + 0xafa4000c // sw a0, $000c(sp) }; static u32 pad2CreateSocketpattern1_mask[] = { 0xffffffff, @@ -334,32 +334,32 @@ static u32 pad2CreateSocketpattern1_mask[] = { /************************************************************************** * For libpad2 support * - * libpad2 2.5.0.0 + * libpad2 2.5.0.0 */ static u32 pad2CreateSocketpattern2[] = { - 0x27bdff70, // addiu sp, sp, $ff70 - 0x0080302d, // daddu a2, a0, zero - 0xffb30060, // sd s3, $0060(sp) - 0x00a0982d, // daddu s3, a1, zero - 0xffbf0080, // sd ra, $0080(sp) - 0xffb40070, // sd s4, $0070(sp) - 0x3262003f, // andi v0, s3, $003f - 0xffb20050, // sd s2, $0050(sp) - 0xffb10040, // sd s1, $0040(sp) - 0x10400000, // beq v0, zero, $XXXXXXXX - 0xffb00030, // sd s0, $0030(sp) - 0x10000000, // beq zero, zero, $XXXXXXXX - 0x2402ffff, // addiu v0, zero, $ffff - 0x50c00000, // beql a2, zero, $XXXXXXXX - 0xafa00000, // sw zero, $0000(sp) - 0x8cc20000, // lw v0, $0000(a2) - 0x8cc30004, // lw v1, $0004(a2) - 0x8cc40008, // lw a0, $0008(a2) - 0x8cc5000c, // lw a1, $000c(a2) - 0xafa20000, // sw v0, $0000(sp) - 0xafa30008, // sw v1, $0008(sp) - 0xafa4000c, // sw a0, $000c(sp) - 0xafa50010 // sw a1, $0010(sp) + 0x27bdff70, // addiu sp, sp, $ff70 + 0x0080302d, // daddu a2, a0, zero + 0xffb30060, // sd s3, $0060(sp) + 0x00a0982d, // daddu s3, a1, zero + 0xffbf0080, // sd ra, $0080(sp) + 0xffb40070, // sd s4, $0070(sp) + 0x3262003f, // andi v0, s3, $003f + 0xffb20050, // sd s2, $0050(sp) + 0xffb10040, // sd s1, $0040(sp) + 0x10400000, // beq v0, zero, $XXXXXXXX + 0xffb00030, // sd s0, $0030(sp) + 0x10000000, // beq zero, zero, $XXXXXXXX + 0x2402ffff, // addiu v0, zero, $ffff + 0x50c00000, // beql a2, zero, $XXXXXXXX + 0xafa00000, // sw zero, $0000(sp) + 0x8cc20000, // lw v0, $0000(a2) + 0x8cc30004, // lw v1, $0004(a2) + 0x8cc40008, // lw a0, $0008(a2) + 0x8cc5000c, // lw a1, $000c(a2) + 0xafa20000, // sw v0, $0000(sp) + 0xafa30008, // sw v1, $0008(sp) + 0xafa4000c, // sw a0, $000c(sp) + 0xafa50010 // sw a1, $0010(sp) }; static u32 pad2CreateSocketpattern2_mask[] = { 0xffffffff, diff --git a/ee_core/include/patches.h b/ee_core/include/patches.h index 0827ce711..5ee867143 100644 --- a/ee_core/include/patches.h +++ b/ee_core/include/patches.h @@ -4,7 +4,7 @@ Copyright 2016 doctorxyz Licenced under Academic Free License version 3.0 Review Open-Ps2-Loader README & LICENSE files for further details. - + Some parts of the code have been taken from Polo's HD Project and doctorxyz's GSM */ diff --git a/ee_core/include/syshook.h b/ee_core/include/syshook.h index 4500f666b..999830586 100644 --- a/ee_core/include/syshook.h +++ b/ee_core/include/syshook.h @@ -3,7 +3,7 @@ Copyright 2006-2008 Polo Licenced under Academic Free License version 3.0 Review Open-Ps2-Loader README & LICENSE files for further details. - + Some parts of the code are taken from HD Project by Polo */ diff --git a/ee_core/include/util.h b/ee_core/include/util.h index 39467a5b0..3c1b089b8 100644 --- a/ee_core/include/util.h +++ b/ee_core/include/util.h @@ -3,7 +3,7 @@ Copyright 2006-2008 Polo Licenced under Academic Free License version 3.0 Review Open-Ps2-Loader README & LICENSE files for further details. - + Some parts of the code are taken from HD Project by Polo */ diff --git a/ee_core/src/gsm_api.c b/ee_core/src/gsm_api.c index 2052ca115..606a5cf72 100644 --- a/ee_core/src/gsm_api.c +++ b/ee_core/src/gsm_api.c @@ -75,7 +75,7 @@ extern struct GSMFlags GSMFlags; extern void Hook_SetGsCrt(); extern void GSHandler(); -static unsigned int KSEG_backup[2]; //Copies of the original words at 0x80000100 and 0x80000104. +static unsigned int KSEG_backup[2]; // Copies of the original words at 0x80000100 and 0x80000104. /* Update GSM params */ /*-------------------*/ @@ -168,7 +168,7 @@ static void Remove_GSHandler(void) Disable_GSBreakpoint(); - //Restore the original stuff at the level 2 exception handler. + // Restore the original stuff at the level 2 exception handler. ee_kmode_enter(); *(volatile u32 *)0x80000100 = KSEG_backup[0]; *(volatile u32 *)0x80000104 = KSEG_backup[1]; @@ -205,7 +205,7 @@ void DisableGSM(void) /* Set up the DVE for 576P mode */ /*--------------------------------------------*/ void setdve_576P(void) -{ //The parameters are exactly the same as the 480P mode's. Regardless of the model, GS revision or region. +{ // The parameters are exactly the same as the 480P mode's. Regardless of the model, GS revision or region. dve_prepare_bus(); dve_set_reg(0x77, 0x11); diff --git a/ee_core/src/igs_api.c b/ee_core/src/igs_api.c index 683fd47b0..dff5bc0ac 100644 --- a/ee_core/src/igs_api.c +++ b/ee_core/src/igs_api.c @@ -42,12 +42,12 @@ static void BlinkColour(u8 x, u32 colour, u8 forever) u8 i; do { delay(2); - GS_BGCOLOUR = 0x000000; //Black + GS_BGCOLOUR = 0x000000; // Black for (i = 1; i <= x; i++) { delay(1); - GS_BGCOLOUR = colour; //Chosen colour + GS_BGCOLOUR = colour; // Chosen colour delay(1); - GS_BGCOLOUR = 0x000000; //Black + GS_BGCOLOUR = 0x000000; // Black } } while (forever); } @@ -72,11 +72,11 @@ static u32 FindEmptyArea(u32 start, u32 end, u32 emptysize) if (counter == emptysize) { result = (u32)addr - emptysize; result = (((result) >> 4) << 4); // It must be 16-bytes aligned - BlinkColour(2, 0x00FF00, 0); //FOUND => Double Green :-) + BlinkColour(2, 0x00FF00, 0); // FOUND => Double Green :-) } else { - //result = 0x00100000; //1st. possible workaround: Use the ingame area (Typically starts on "0x00100000"). It must be 16-bytes aligned - result = ((0x01F32568 - emptysize - 16) >> 4) << 4; //2nd. possible workaround: Himem area ("0x01F32568" taken from PS2LINK hi-mem). It must be 16-bytes aligned - BlinkColour(2, 0x0066FF, 0); //Double Orange :-( + // result = 0x00100000; // 1st. possible workaround: Use the ingame area (Typically starts on "0x00100000"). It must be 16-bytes aligned + result = ((0x01F32568 - emptysize - 16) >> 4) << 4; // 2nd. possible workaround: Himem area ("0x01F32568" taken from PS2LINK hi-mem). It must be 16-bytes aligned + BlinkColour(2, 0x0066FF, 0); // Double Orange :-( } return result; @@ -92,7 +92,7 @@ static void ClearBuffer(u8 *buffer, u32 size) static void u8todecstr(u8 input, char *output, u8 digits) { - u8 i = digits; //Number of digits (output) + u8 i = digits; // Number of digits (output) do { i--; output[i] = "0123456789"[input % 10]; @@ -107,7 +107,7 @@ static void u8todecstr(u8 input, char *output, u8 digits) static void u16todecstr(u16 input, char *output, u8 digits) { - u8 i = digits; //Number of digits (output) + u8 i = digits; // Number of digits (output) do { i--; output[i] = "0123456789"[input % 10]; @@ -122,7 +122,7 @@ static void u16todecstr(u16 input, char *output, u8 digits) static void u32todecstr(u32 input, char *output, u8 digits) { - u8 i = digits; //Number of digits (output) + u8 i = digits; // Number of digits (output) do { i--; output[i] = "0123456789"[input % 10]; @@ -137,7 +137,7 @@ static void u32todecstr(u32 input, char *output, u8 digits) static void u32tohexstr(u32 input, char *output, u8 digits) { - u8 i = digits; //Number of digits (output) + u8 i = digits; // Number of digits (output) do { i--; output[i] = "0123456789ABCDEF"[input % 16]; @@ -152,7 +152,7 @@ static void u32tohexstr(u32 input, char *output, u8 digits) static void u64tohexstr(u64 input, char *output, u8 digits) { - u8 i = digits; //Number of digits (output) + u8 i = digits; // Number of digits (output) do { i--; output[i] = "0123456789ABCDEF"[input % 16]; @@ -175,7 +175,7 @@ static u8 PixelSize(u8 spsm) else if ((spsm == GS_PSM_CT16) || (spsm == GS_PSM_CT16S)) result = 2; else - BlinkColour(1, 0x0000FF, 1); //Red + BlinkColour(1, 0x0000FF, 1); // Red return result; } @@ -183,7 +183,7 @@ static void Screenshot(u16 sbp, u8 sbw, u8 spsm, u16 width, u16 height, u32 dime { delay(1); - GS_BGCOLOUR = 0xCCFFFF; //Light Yellow + GS_BGCOLOUR = 0xCCFFFF; // Light Yellow static u128 EnableGIFPATH3; @@ -205,10 +205,10 @@ static void Screenshot(u16 sbp, u8 sbw, u8 spsm, u16 width, u16 height, u32 dime u8 i; if ((sbw < 1) || (sbw > 32)) - BlinkColour(2, 0x0000FF, 1); //Red + BlinkColour(2, 0x0000FF, 1); // Red if ((height < 64) || (height > 1080)) - BlinkColour(3, 0x0000FF, 1); //Red + BlinkColour(3, 0x0000FF, 1); // Red // Number of qwords (each qword = 2^4 bytes = 16 bytes = 128 bits) qwords = image_size >> 4; @@ -299,7 +299,7 @@ static void Screenshot(u16 sbp, u8 sbw, u8 spsm, u16 width, u16 height, u32 dime // Ensure that all the data has indeed been written back to main memory FlushCache(GS_WRITEBACK_DCACHE); - //Transfer image to host + // Transfer image to host *GS_D1_QWC = (8192 + ((i + 1 == slices) ? remainder : 0)); *GS_D1_MADR = addr; *GS_D1_CHCR = 0x0100; @@ -315,7 +315,7 @@ static void Screenshot(u16 sbp, u8 sbw, u8 spsm, u16 width, u16 height, u32 dime ; delay(1); - GS_BGCOLOUR = (0x00FFFF - (255 * i / slices) * 0x000101); //Yellow Fade Out Effect + GS_BGCOLOUR = (0x00FFFF - (255 * i / slices) * 0x000101); // Yellow Fade Out Effect } while (i < slices); @@ -352,7 +352,7 @@ static void ConvertColors32(u32 *buffer, u32 dimensions) buffer[i] = ((x32 >> 16) & 0xFF) | ((x32 << 16) & 0xFF0000) | (x32 & 0xFF00FF00); FastDelay(1); - GS_BGCOLOUR = (0x0000FF - (255 * (i + 1) / dimensions) * 0x000001); //Red Fade Out Effect + GS_BGCOLOUR = (0x0000FF - (255 * (i + 1) / dimensions) * 0x000001); // Red Fade Out Effect } } @@ -368,7 +368,7 @@ static void ConvertColors24(u8 *buffer, u32 image_size) buffer[i + 2] = (u8)((x32 >> 16) & 0xFF); FastDelay(1); - GS_BGCOLOUR = (0x00FF00 - (255 * (i + 1) / image_size) * 0x000100); //Green Fade Out Effect + GS_BGCOLOUR = (0x00FF00 - (255 * (i + 1) / image_size) * 0x000100); // Green Fade Out Effect } } @@ -382,7 +382,7 @@ static void ConvertColors16(u16 *buffer, u32 dimensions) buffer[i] = (x16 & 0x8000) | ((x16 << 10) & 0x7C00) | (x16 & 0x3E0) | ((x16 >> 10) & 0x1F); FastDelay(1); - GS_BGCOLOUR = (0xFF0000 - (255 * (i + 1) / dimensions) * 0x010000); //Blue Fade Out Effect + GS_BGCOLOUR = (0xFF0000 - (255 * (i + 1) / dimensions) * 0x010000); // Blue Fade Out Effect } } @@ -390,7 +390,7 @@ static void SaveTextFile(u32 buffer, u16 width, u16 height, u8 pixel_size, u32 i { delay(1); - GS_BGCOLOUR = 0x0099FF; //Orange + GS_BGCOLOUR = 0x0099FF; // Orange // 0000000001111111111222222222 // 1234567890123456789012345678 @@ -423,7 +423,7 @@ static void SaveTextFile(u32 buffer, u16 width, u16 height, u8 pixel_size, u32 i // Create file file_handle = fioOpen(PathFilenameExtension, O_CREAT | O_WRONLY); if (file_handle < 0) - BlinkColour(4, 0x0000FF, 1); //Red + BlinkColour(4, 0x0000FF, 1); // Red _strcpy(text, "PS2 IGS (InGame Screenshot)\n---------------------------\n"); _strcat(text, "\n\nGame ID="); @@ -567,14 +567,14 @@ static void SaveTextFile(u32 buffer, u16 width, u16 height, u8 pixel_size, u32 i fioClose(file_handle); delay(1); - GS_BGCOLOUR = 0x000000; //Black + GS_BGCOLOUR = 0x000000; // Black } static u8 SaveBitmapFile(u16 width, u16 height, u8 pixel_size, void *buffer, u8 intffmd) { delay(1); - GS_BGCOLOUR = 0x990066; //Purple Violet + GS_BGCOLOUR = 0x990066; // Purple Violet // 00000000011111111112222222222 // 12345678901234567890123456789 @@ -597,7 +597,7 @@ static u8 SaveBitmapFile(u16 width, u16 height, u8 pixel_size, void *buffer, u8 BmpHeader *bh; - u8 Number = 0; //255 screenshots per-game should be enough? lol + u8 Number = 0; // 255 screenshots per-game should be enough? lol bpp = (pixel_size << 3); @@ -608,8 +608,8 @@ static u8 SaveBitmapFile(u16 width, u16 height, u8 pixel_size, void *buffer, u8 // Sequential numbering feature while (1) { - if (Number == 255) //255 screenshots per-game should be enough? lol - BlinkColour(6, 0x0000FF, 1); //Red + if (Number == 255) // 255 screenshots per-game should be enough? lol + BlinkColour(6, 0x0000FF, 1); // Red Number++; _strcpy(PathFilenameExtension, "mc1:/"); _strcat(PathFilenameExtension, GameID); @@ -618,9 +618,9 @@ static u8 SaveBitmapFile(u16 width, u16 height, u8 pixel_size, void *buffer, u8 _strcat(PathFilenameExtension, u8text); _strcat(PathFilenameExtension, ").bmp"); file_handle = fioOpen(PathFilenameExtension, O_RDONLY); - if (file_handle < 0) //There is no file with this Sequential Number; that's time for creating a new one. + if (file_handle < 0) // There is no file with this Sequential Number; that's time for creating a new one. break; - if (fioLseek(file_handle, 0, SEEK_END) == 0) { //There is a file with this Sequential Number but it's empty, so let's overwrite it. + if (fioLseek(file_handle, 0, SEEK_END) == 0) { // There is a file with this Sequential Number but it's empty, so let's overwrite it. fioClose(file_handle); break; } @@ -629,13 +629,13 @@ static u8 SaveBitmapFile(u16 width, u16 height, u8 pixel_size, void *buffer, u8 // Create file file_handle = fioOpen(PathFilenameExtension, O_CREAT | O_WRONLY); if (file_handle < 0) - BlinkColour(4, 0x0000FF, 1); //Red + BlinkColour(4, 0x0000FF, 1); // Red // Write Bitmap Header //(first, write the BMP Header ID ouside of struct, due to alignment issues...) ret = fioWrite(file_handle, id, 2); if (ret != 2) - BlinkColour(5, 0x0000FF, 1); //Red + BlinkColour(5, 0x0000FF, 1); // Red //(...then, write the remaining info!) bh = buffer + image_size; bh->filesize = (u32)file_size; @@ -657,10 +657,10 @@ static u8 SaveBitmapFile(u16 width, u16 height, u8 pixel_size, void *buffer, u8 ret = fioWrite(file_handle, bh, 52); if (ret != 52) - BlinkColour(5, 0x0000FF, 1); //Red + BlinkColour(5, 0x0000FF, 1); // Red - //Write image in reverse order (since BMP is written Left to Right, Bottom to Top) - if (intffmd == 3) //Interlace Mode, FRAME Mode (Read every line) + // Write image in reverse order (since BMP is written Left to Right, Bottom to Top) + if (intffmd == 3) // Interlace Mode, FRAME Mode (Read every line) height >>= 1; for (i = 1; i <= height; i++) { addr = buffer + ((height - i) * lenght); @@ -670,20 +670,20 @@ static u8 SaveBitmapFile(u16 width, u16 height, u8 pixel_size, void *buffer, u8 ret = fioWrite(file_handle, addr, lenght); if (ret != lenght) - BlinkColour(5, 0x0000FF, 1); //Red - if (intffmd == 3) { //Interlace Mode, FRAME Mode (Read every line) + BlinkColour(5, 0x0000FF, 1); // Red + if (intffmd == 3) { // Interlace Mode, FRAME Mode (Read every line) ret = fioWrite(file_handle, addr, lenght); if (ret != lenght) - BlinkColour(5, 0x0000FF, 1); //Red + BlinkColour(5, 0x0000FF, 1); // Red } - GS_BGCOLOUR = (0xFFFFFF - (255 * i / height) * 0x010101); //Gray Fade Out Effect + GS_BGCOLOUR = (0xFFFFFF - (255 * i / height) * 0x010101); // Gray Fade Out Effect } // Close file fioClose(file_handle); delay(1); - GS_BGCOLOUR = 0x000000; //Black + GS_BGCOLOUR = 0x000000; // Black // Return the Sequential Number to the related Text File return Number; @@ -743,10 +743,10 @@ int InGameScreenshot(void) pixel_size = PixelSize(spsm); image_size = dimensions * pixel_size; - //Try to find a empty (zeroed) area in EE RAM - buffer = (void *)FindEmptyArea(0x00100000, 0x02000000, image_size + 52); //image size + Bitmap Header (52 bytes) + // Try to find a empty (zeroed) area in EE RAM + buffer = (void *)FindEmptyArea(0x00100000, 0x02000000, image_size + 52); // image size + Bitmap Header (52 bytes) - //Take IGS + // Take IGS Screenshot(sbp, sbw, spsm, width, height, dimensions, pixel_size, image_size, buffer); // Color Space conversion from BGR to RGB (i.e. little endian => big endian) @@ -754,39 +754,39 @@ int InGameScreenshot(void) case GS_PSM_CT32: buffer32 = (u32 *)UNCACHED_SEG(buffer); ConvertColors32(buffer32, dimensions); - break; //32-bit PS2 BGR (PSMCT32 = 0, pixel_size=4) to BMP RGB conversion + break; // 32-bit PS2 BGR (PSMCT32 = 0, pixel_size=4) to BMP RGB conversion case GS_PSM_CT24: buffer8 = (u8 *)UNCACHED_SEG(buffer); ConvertColors24(buffer8, image_size); - break; //24-bit PS2 BGR (PSMCT24 = 1, pixel_size=3) to BMP RGB conversion + break; // 24-bit PS2 BGR (PSMCT24 = 1, pixel_size=3) to BMP RGB conversion case GS_PSM_CT16: buffer16 = (u16 *)UNCACHED_SEG(buffer); ConvertColors16(buffer16, dimensions); - break; //16-bit PS2 BGR (PSMCT16 = 2, pixel_size=2) to BMP RGB conversion + break; // 16-bit PS2 BGR (PSMCT16 = 2, pixel_size=2) to BMP RGB conversion case GS_PSM_CT16S: buffer16 = (u16 *)UNCACHED_SEG(buffer); ConvertColors16(buffer16, dimensions); - break; //16-bit PS2 BGRA (PSMCT16S = 10, pixel_size=2) to BMP RGB conversion + break; // 16-bit PS2 BGRA (PSMCT16S = 10, pixel_size=2) to BMP RGB conversion } EI(); delay(1); - GS_BGCOLOUR = 0x660033; //Midnight Blue + GS_BGCOLOUR = 0x660033; // Midnight Blue - //Load modules. + // Load modules. LoadFileInit(); LoadModule("rom0:SIO2MAN", 0, NULL); LoadModule("rom0:MCMAN", 0, NULL); - //Save IGS Bitmap File first, since it's the bigger file) + // Save IGS Bitmap File first, since it's the bigger file) intffmd = GET_SMODE2_INTFFMD(smode2); Number = SaveBitmapFile(width, height, pixel_size, buffer, intffmd); - //The Number used on Bitmap File is returned to the related Text File, in order their both Sequential Numbers match + // The Number used on Bitmap File is returned to the related Text File, in order their both Sequential Numbers match SaveTextFile((u32)buffer, width, height, pixel_size, image_size, Number); - //Clear buffer + // Clear buffer ClearBuffer(buffer, image_size + 52); // Exit services @@ -796,7 +796,7 @@ int InGameScreenshot(void) FlushCache(0); FlushCache(2); - BlinkColour(1, 0xFF0000, 0); //Double Blue :-) + BlinkColour(1, 0xFF0000, 0); // Double Blue :-) return 0; } diff --git a/ee_core/src/iopmgr.c b/ee_core/src/iopmgr.c index 6c40f03b9..36fbb1911 100644 --- a/ee_core/src/iopmgr.c +++ b/ee_core/src/iopmgr.c @@ -30,8 +30,8 @@ static void ResetIopSpecial(const char *args, unsigned int arglen) if (arglen > 0) { strncpy(command, args, arglen); command[arglen] = '\0'; /* In a normal IOP reset process, the IOP reset command line will be NULL-terminated properly somewhere. - Since we're now taking things into our own hands, NULL terminate it here. - Some games like SOCOM3 will use a command line that isn't NULL terminated, resulting in things like "cdrom0:\RUN\IRX\DNAS300.IMGG;1" */ + Since we're now taking things into our own hands, NULL terminate it here. + Some games like SOCOM3 will use a command line that isn't NULL terminated, resulting in things like "cdrom0:\RUN\IRX\DNAS300.IMGG;1" */ _strcpy(&command[arglen + 1], "img0:"); CommandLen = arglen + 6; } else { @@ -80,7 +80,7 @@ static void ResetIopSpecial(const char *args, unsigned int arglen) ee_kmode_exit(); EIntr(); - LoadFileExit(); //OPL's integrated LOADFILE RPC does not automatically unbind itself after IOP resets. + LoadFileExit(); // OPL's integrated LOADFILE RPC does not automatically unbind itself after IOP resets. _iop_reboot_count++; // increment reboot counter to allow RPC clients to detect unbinding! @@ -136,14 +136,14 @@ static void ResetIopSpecial(const char *args, unsigned int arglen) }; } -/*----------------------------------------------------------------------------------------*/ -/* Reset IOP to include our modules. */ -/*----------------------------------------------------------------------------------------*/ +/*----------------------------------------------------------------*/ +/* Reset IOP to include our modules. */ +/*----------------------------------------------------------------*/ int New_Reset_Iop(const char *arg, int arglen) { DPRINTF("New_Reset_Iop start!\n"); if (!DisableDebug) - GS_BGCOLOUR = 0xFF00FF; //Purple + GS_BGCOLOUR = 0xFF00FF; // Purple SifInitRpc(0); @@ -164,12 +164,12 @@ int New_Reset_Iop(const char *arg, int arglen) ResetIopSpecial(NULL, 0); if (!DisableDebug) - GS_BGCOLOUR = 0x00A5FF; //Orange + GS_BGCOLOUR = 0x00A5FF; // Orange if (arglen > 0) { ResetIopSpecial(&arg[10], arglen - 10); if (!DisableDebug) - GS_BGCOLOUR = 0x00FFFF; //Yellow + GS_BGCOLOUR = 0x00FFFF; // Yellow } if (iop_reboot_count >= 2) { @@ -197,7 +197,7 @@ int New_Reset_Iop(const char *arg, int arglen) set_reg_hook = 4; if (!DisableDebug) - GS_BGCOLOUR = 0x000000; //Black + GS_BGCOLOUR = 0x000000; // Black return 1; } @@ -213,22 +213,22 @@ int Reset_Iop(const char *arg, int mode) _iop_reboot_count++; // increment reboot counter to allow RPC clients to detect unbinding! - /* SifStopDma(); For the sake of IGR (Which uses this function), don't disable SIF0 (IOP -> EE) - because some games will be still spamming DMA transfers across SIF0 when IGR is invoked. - SCE documents that DMA transfers should be stopped before IOP resets, but has neglected - to explain the effects of not doing so. - So far, it seems like the SIF (at least SIF0) will stop functioning properly. + /* SifStopDma(); For the sake of IGR (Which uses this function), don't disable SIF0 (IOP -> EE) + because some games will be still spamming DMA transfers across SIF0 when IGR is invoked. + SCE documents that DMA transfers should be stopped before IOP resets, but has neglected + to explain the effects of not doing so. + So far, it seems like the SIF (at least SIF0) will stop functioning properly. - 2 commits before this one, OPL appears to have worked around this problem by preventing - the SIF BOOTEND flag from being set, - which allowed SifInitCmd() to run ASAP (Even before the IOP finishes rebooting. - That caused SifSetDChain() to be run ASAP, which re-enables SIF0. - I don't find that a good workaround because it may result in a timing problem. */ + 2 commits before this one, OPL appears to have worked around this problem by preventing + the SIF BOOTEND flag from being set, + which allowed SifInitCmd() to run ASAP (Even before the IOP finishes rebooting. + That caused SifSetDChain() to be run ASAP, which re-enables SIF0. + I don't find that a good workaround because it may result in a timing problem. */ for (arglen = 0; arg[arglen] != '\0'; arglen++) reset_pkt.arg[arglen] = arg[arglen]; - reset_pkt.header.psize = sizeof reset_pkt; //dsize is not initialized (and not processed, even on the IOP). + reset_pkt.header.psize = sizeof reset_pkt; // dsize is not initialized (and not processed, even on the IOP). reset_pkt.header.cid = SIF_CMD_RESET_CMD; reset_pkt.arglen = arglen; reset_pkt.mode = mode; diff --git a/ee_core/src/main.c b/ee_core/src/main.c index b61fd05de..bfa670024 100644 --- a/ee_core/src/main.c +++ b/ee_core/src/main.c @@ -3,7 +3,7 @@ Copyright 2006-2008 Polo Licenced under Academic Free License version 3.0 Review OpenUsbLd README & LICENSE files for further details. - + Some parts of the code are taken from HD Project by Polo */ @@ -38,7 +38,7 @@ int EnablePadEmuOp; int PadEmuSettings; #endif int DisableDebug; -int *gCheatList; //Store hooks/codes addr+val pairs +int *gCheatList; // Store hooks/codes addr+val pairs static int eecoreInit(int argc, char **argv) { @@ -152,7 +152,7 @@ static int eecoreInit(int argc, char **argv) Install_Kernel_Hooks(); if (!DisableDebug) - GS_BGCOLOUR = 0xff0000; //Blue + GS_BGCOLOUR = 0xff0000; // Blue SifExitRpc(); @@ -163,7 +163,7 @@ int main(int argc, char **argv) { int argOffset; - if (isInit) { //Ignore argv[0], as it contains the name of this module ("EELOAD"), as passed by the LoadExecPS2 syscall itself (2nd invocation and later will be from LoadExecPS2). + if (isInit) { // Ignore argv[0], as it contains the name of this module ("EELOAD"), as passed by the LoadExecPS2 syscall itself (2nd invocation and later will be from LoadExecPS2). argv++; argc--; diff --git a/ee_core/src/modmgr.c b/ee_core/src/modmgr.c index 851d7c79b..8cc560297 100644 --- a/ee_core/src/modmgr.c +++ b/ee_core/src/modmgr.c @@ -98,8 +98,8 @@ int LoadMemModule(int mode, void *modptr, unsigned int modsize, int arg_len, con sifdma.size = modsize; sifdma.attr = 0; - //All IOP modules should have already been written back to RAM by the FlushCache() calls within the GUI and the CRT. - //SifWriteBackDCache(modptr, modsize); + // All IOP modules should have already been written back to RAM by the FlushCache() calls within the GUI and the CRT. + // SifWriteBackDCache(modptr, modsize); do { dma_id = SifSetDma(&sifdma, 1); diff --git a/ee_core/src/padhook.c b/ee_core/src/padhook.c index a89f65719..6874539df 100644 --- a/ee_core/src/padhook.c +++ b/ee_core/src/padhook.c @@ -98,7 +98,7 @@ static void t_loadElf(void) argv[0] = ExitPath; argv[1] = NULL; - //Wipe everything, even the module storage. + // Wipe everything, even the module storage. WipeUserMemory((void *)&_end, (void *)GetMemorySize()); FlushCache(0); @@ -184,11 +184,11 @@ static void IGR_Thread(void *arg) // Stop Performance Counter if (Cop0_Perf & 0x80000000) { __asm__ __volatile__( - " mfc0 $3, $25;" - " lui $2, 0x8000;" - " or $3, $3, $2;" - " xor $3, $3, $2;" - " mtc0 $3, $25;" + " mfc0 $3, $25;" + " lui $2, 0x8000;" + " or $3, $3, $2;" + " xor $3, $3, $2;" + " mtc0 $3, $25;" " sync.p;"); } @@ -334,14 +334,14 @@ static int IGR_Intc_Handler(int cause) // Suspend and Change priority of all threads other then our IGR thread // Wakeup and Change priority of our IGR thread if (Pad_Data.combo_type != 0x00) { - //While ExecPS2() would also do some of these (also calls ResetEE), - //initialization seems to sometimes get stuck at "Initializing GS", perhaps when waiting for the V-Sync start interrupt. - //That happens before ResetEE is called, so ResetEE has to be called earlier. + // While ExecPS2() would also do some of these (also calls ResetEE), + // initialization seems to sometimes get stuck at "Initializing GS", perhaps when waiting for the V-Sync start interrupt. + // That happens before ResetEE is called, so ResetEE has to be called earlier. - //Wait for preceding loads & stores to complete. + // Wait for preceding loads & stores to complete. asm volatile("sync.l\n"); - //Stop all ongoing transfers (except for SIF0, SIF1 & SIF2 - DMA CH 5, 6 & 7). + // Stop all ongoing transfers (except for SIF0, SIF1 & SIF2 - DMA CH 5, 6 & 7). u32 dmaEnableR = *R_EE_D_ENABLER; *R_EE_D_ENABLEW = dmaEnableR | 0x10000; *R_EE_D_CTRL; @@ -355,16 +355,16 @@ static int IGR_Intc_Handler(int cause) *R_EE_D9_CHCR = 0; *R_EE_D_ENABLEW = dmaEnableR; - //Wait for preceding loads & stores to complete. + // Wait for preceding loads & stores to complete. asm volatile("sync.l\n"); - *R_EE_GS_CSR = 0x100; //Reset GS + *R_EE_GS_CSR = 0x100; // Reset GS asm volatile("sync.l\n"); while (*R_EE_GS_CSR & 0x100) { }; - //Disable interrupts & reset some peripherals, back to a standard state. - //Call ResetEE(0x7F) from an interrupt handler. + // Disable interrupts & reset some peripherals, back to a standard state. + // Call ResetEE(0x7F) from an interrupt handler. iResetEE(0x7F); // Loop for each threads, skipping the idle & IGR threads. @@ -386,7 +386,7 @@ static int IGR_Intc_Handler(int cause) return 0; } -//Install_IGR() must be run first. +// Install_IGR() must be run first. static void Set_libpad_Params(void *addr) { DI(); @@ -529,7 +529,7 @@ int Install_PadOpen_Hook(u32 mem_start, u32 mem_end, int mode) while (ptr) { // Purple while PadOpen pattern search if (!DisableDebug) - GS_BGCOLOUR = 0x800080; //Purple + GS_BGCOLOUR = 0x800080; // Purple mem_size = mem_end - (u32)ptr; @@ -541,7 +541,7 @@ int Install_PadOpen_Hook(u32 mem_start, u32 mem_end, int mode) // Green while PadOpen patches if (!DisableDebug) - GS_BGCOLOUR = 0x008000; //Dark green + GS_BGCOLOUR = 0x008000; // Dark green // Save original PadOpen function if (padopen_patterns[i].type == IGR_LIBPAD) @@ -594,7 +594,7 @@ int Install_PadOpen_Hook(u32 mem_start, u32 mem_end, int mode) } } - //Locate pointers to scePadOpen(), likely used for JALR. + // Locate pointers to scePadOpen(), likely used for JALR. if (!patched) { DPRINTF("IGR: 2nd padOpen patch attempt...\n"); @@ -642,7 +642,7 @@ int Install_PadOpen_Hook(u32 mem_start, u32 mem_end, int mode) } // Increment search pointer - //ptr += padopen_patterns[i].size; + // ptr += padopen_patterns[i].size; ptr += (padopen_patterns[i].size >> 2); } } @@ -656,7 +656,7 @@ int Install_PadOpen_Hook(u32 mem_start, u32 mem_end, int mode) // Done if (!DisableDebug) - GS_BGCOLOUR = 0x000000; //Black + GS_BGCOLOUR = 0x000000; // Black return patched; } diff --git a/ee_core/src/patches.c b/ee_core/src/patches.c index 290e14826..6071d8aa5 100644 --- a/ee_core/src/patches.c +++ b/ee_core/src/patches.c @@ -4,7 +4,7 @@ Copyright 2016 doctorxyz Licenced under Academic Free License version 3.0 Review Open-Ps2-Loader README & LICENSE files for further details. - + Some parts of the code have been taken from Polo's HD Project and doctorxyz's GSM */ @@ -30,7 +30,7 @@ typedef struct game_patch_t patch; } patchlist_t; -//Keep patch codes unique! +// Keep patch codes unique! #define PATCH_GENERIC_NIS 0xDEADBEE0 #define PATCH_GENERIC_CAPCOM 0xBABECAFE #define PATCH_GENERIC_AC9B 0xDEADBEE1 @@ -142,7 +142,7 @@ static const patchlist_t patch_list[] = { static int (*cdRead)(u32 lsn, u32 nsectors, void *buf, int *mode); static unsigned int g_delay_cycles; -static int g_mode; //Patch may use this for anything. +static int g_mode; // Patch may use this for anything. // Nippon Ichi Software games generic patch to disable cdvd timeout static void NIS_generic_patches(void) @@ -262,12 +262,12 @@ static void Invoke_CRSGUI_Start(void) static void SDF_Macross_patch(void) { - /* Choujikuu Yousai Macross appears to have a rather large problem with it: it appears to use its GUI before initialization is completed. - I did not attempt to figure out whether it's really a timing problem (whereby this happens before initialization is completed by another thread... if there is one), - or if its normal functionality was the result of pure luck that SEGA had. + /* Choujikuu Yousai Macross appears to have a rather large problem with it: it appears to use its GUI before initialization is completed. + I did not attempt to figure out whether it's really a timing problem (whereby this happens before initialization is completed by another thread... if there is one), + or if its normal functionality was the result of pure luck that SEGA had. - The problems that it has are quite evident when this game is run within PCSX2. I still do not know why DECI2 does not detect the TLB exception when it - dereferences NULL pointers, but it might have something to do with the game accessing the debug registers (PCSX2's logs indicate that). */ + The problems that it has are quite evident when this game is run within PCSX2. I still do not know why DECI2 does not detect the TLB exception when it + dereferences NULL pointers, but it might have something to do with the game accessing the debug registers (PCSX2's logs indicate that). */ _sw(JMP((unsigned int)&Invoke_CRSGUI_Start), 0x001f8520); } @@ -276,12 +276,12 @@ extern void SRWI_IncrementCntrlFlag(void); static void SRWI_IMPACT_patches(void) { - //Phase 1 - Replace all segments of code that increment cntrl_flag with a multithread-safe implementation. - //In cdvCallBack() + // Phase 1 - Replace all segments of code that increment cntrl_flag with a multithread-safe implementation. + // In cdvCallBack() _sw(JAL((unsigned int)&SRWI_IncrementCntrlFlag), 0x0021e840); _sw(0x00000000, 0x0021e84c); _sw(0x00000000, 0x0021e854); - //In cdvMain() + // In cdvMain() _sw(0x00000000, 0x00220ac8); _sw(JAL((unsigned int)&SRWI_IncrementCntrlFlag), 0x00220ad0); _sw(0x00000000, 0x00220ad8); @@ -292,15 +292,15 @@ static void SRWI_IMPACT_patches(void) _sw(0x00000000, 0x00220ba8); /* Phase 2 - sceCdError() will be polled continuously until it succeeds in retrieving the CD/DVD drive status. - However, the callback thread has a higher priority than the main thread - and this might result in a freeze because the main thread wouldn't ever release the libcdvd semaphore, and so calls to sceCdError() by the callback thread wouldn't succeed. - This problem occurs more frequently than the one addressed above. - - Since the PlayStation 2 EE uses non-preemptive multitasking, we can solve this problem by lowering the callback thread's priority th below the main thread. - The problem is solved because the main thread can then interrupt the callback thread until it has completed its tasks. */ - //In cdvCallBack() - _sw(0x24040060, 0x0021e944); //addiu $a0, $zero, 0x60 (Set the CD/DVD callback thread's priority to 0x60) + sceCdError() will be polled continuously until it succeeds in retrieving the CD/DVD drive status. + However, the callback thread has a higher priority than the main thread + and this might result in a freeze because the main thread wouldn't ever release the libcdvd semaphore, and so calls to sceCdError() by the callback thread wouldn't succeed. + This problem occurs more frequently than the one addressed above. + + Since the PlayStation 2 EE uses non-preemptive multitasking, we can solve this problem by lowering the callback thread's priority th below the main thread. + The problem is solved because the main thread can then interrupt the callback thread until it has completed its tasks. */ + // In cdvCallBack() + _sw(0x24040060, 0x0021e944); // addiu $a0, $zero, 0x60 (Set the CD/DVD callback thread's priority to 0x60) } void RnC3_AlwaysAllocMem(void); @@ -309,44 +309,44 @@ static void RnC3_UYA_patches(void *address) { unsigned int word1, word2; - /* Preserve the pointer to the allocated IOP RAM. - This game's main executable is obfuscated and/or compressed in some way, - but thankfully the segment that needs to be patched is just offset by 1 byte. + /* Preserve the pointer to the allocated IOP RAM. + This game's main executable is obfuscated and/or compressed in some way, + but thankfully the segment that needs to be patched is just offset by 1 byte. - It contains an IOP module that seems to load other modules (iop_stash_daemon), - which unfortunately seems to be the heart of its anti-emulator protection system. - It (and the EE-side code) appears to be playing around with a pointer to IOP RAM, - based on the modules that are loaded. + It contains an IOP module that seems to load other modules (iop_stash_daemon), + which unfortunately seems to be the heart of its anti-emulator protection system. + It (and the EE-side code) appears to be playing around with a pointer to IOP RAM, + based on the modules that are loaded. - Right before this IOP module is loaded with a custom LoadModuleBuffer function, the game will allocate a large buffer on the IOP. - This buffer is then used for loading iop_stash_daemon, which also uses it to load other modules before freeing it. - Unfortunately, the developers appear to have hardcoded the pointer, rather than using the return value of sceAllocSysMemory(). + Right before this IOP module is loaded with a custom LoadModuleBuffer function, the game will allocate a large buffer on the IOP. + This buffer is then used for loading iop_stash_daemon, which also uses it to load other modules before freeing it. + Unfortunately, the developers appear to have hardcoded the pointer, rather than using the return value of sceAllocSysMemory(). - This module will also check for the presence of bit 29 in the pointer. If it's absent, then the code will not allocate memory and the game will freeze after the first cutscene in Veldin. - Like with crazyc's original patch, this branch here will have to be adjusted: - beqz $s7, 0x13 - ... to be: - beqz $s7, 0x01 + This module will also check for the presence of bit 29 in the pointer. If it's absent, then the code will not allocate memory and the game will freeze after the first cutscene in Veldin. + Like with crazyc's original patch, this branch here will have to be adjusted: + beqz $s7, 0x13 + ... to be: + beqz $s7, 0x01 - iop_stash_daemon will play with the pointer in the following ways, based on each module it finds: - 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. + iop_stash_daemon will play with the pointer in the following ways, based on each module it finds: + 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. + 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. */ + 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) { default: #ifdef _DTL_T10000 - word2 = 0x00021903; //sra $v1, $v0, 4 For DTL-T10000. + word2 = 0x00021903; // sra $v1, $v0, 4 For DTL-T10000. #else - word2 = 0x00021880; //sll $v1, $v0, 2 For retail sets. + word2 = 0x00021880; // sll $v1, $v0, 2 For retail sets. #endif } @@ -366,10 +366,10 @@ static void ZombieZone_preIOPInit(void) static void ZombieZone_patches(unsigned int address) { static const unsigned int ZZpattern[] = { - 0x2403000f, //addiu v1, zero, $000f - 0x24500000, //addiu s0, v0, xxxx - 0x3c040000, //lui a0, xxxx - 0xffbf0020, //sd ra, $0020(sp) + 0x2403000f, // addiu v1, zero, $000f + 0x24500000, // addiu s0, v0, xxxx + 0x3c040000, // lui a0, xxxx + 0xffbf0020, // sd ra, $0020(sp) }; static const unsigned int ZZpattern_mask[] = { 0xffffffff, @@ -378,7 +378,7 @@ static void ZombieZone_patches(unsigned int address) 0xffffffff}; u32 *ptr; - //Locate scePadEnd(). + // Locate scePadEnd(). ptr = find_pattern_with_mask((u32 *)0x001c0000, 0x01f00000, ZZpattern, ZZpattern_mask, sizeof(ZZpattern)); if (ptr) { pZZInitIOP = (void *)FNADDR(_lw(address)); @@ -390,14 +390,14 @@ static void ZombieZone_patches(unsigned int address) static void DotHack_patches(const char *path) { //.hack (PAL) has a multi-language selector that boots the main ELF. However, it does not call scePadEnd() before LoadExecPS2() - //We only want to patch the language selector and nothing else! + // We only want to patch the language selector and nothing else! static u32 patch[] = { - 0x00000000, //jal scePadEnd() - 0x00000000, //nop - 0x27a40020, //addiu $a0, $sp, $0020 (Contains boot path) - 0x0000282d, //move $a1, $zero - 0x00000000, //j LoadExecPS2() - 0x0000302d, //move $a2, $zero + 0x00000000, // jal scePadEnd() + 0x00000000, // nop + 0x27a40020, // addiu $a0, $sp, $0020 (Contains boot path) + 0x0000282d, // move $a1, $zero + 0x00000000, // j LoadExecPS2() + 0x0000302d, // move $a2, $zero }; u32 *ptr, *pPadEnd, *pLoadExecPS2; @@ -461,9 +461,9 @@ int Skip_BIK_Videos(void) int Skip_Videos_sceMpegIsEnd(void) { static const unsigned int sceMpegIsEndPattern[] = { - 0x8c830040, // lw $v1, $0040($a0) - 0x03e00008, // jr $ra - 0x8c620000, // lw $v0, 0($v1) + 0x8c830040, // lw $v1, $0040($a0) + 0x03e00008, // jr $ra + 0x8c620000, // lw $v0, 0($v1) }; static const unsigned int sceMpegIsEndPattern_mask[] = { 0xffffffff, @@ -474,7 +474,7 @@ int Skip_Videos_sceMpegIsEnd(void) u32 *ptr; ptr = find_pattern_with_mask((u32 *)0x00100000, 0x01ec0000, sceMpegIsEndPattern, sceMpegIsEndPattern_mask, sizeof(sceMpegIsEndPattern)); if (ptr) { - _sw(0x24020001, (u32)ptr + 8); // addiu $v0, $zero, 1 <- HERE!!! + _sw(0x24020001, (u32)ptr + 8); // addiu $v0, $zero, 1 <- HERE!!! return 1; } else return 0; @@ -494,19 +494,19 @@ static int SOS_SifLoadModuleHook(const char *path, int arg_len, const char *args char modIdStr[3]; switch (g_mode) { - case 0: //NTSC-J + case 0: // NTSC-J _pSifLoadModule = (void *)0x001d0680; pSifAllocIopHeap = (void *)0x001cfc30; pSifFreeIopHeap = (void *)0x001cfd20; pSifLoadModuleBuffer = (void *)0x001d0640; break; - case 1: //NTSC-U/C + case 1: // NTSC-U/C _pSifLoadModule = (void *)0x001d0580; pSifAllocIopHeap = (void *)0x001cfb30; pSifFreeIopHeap = (void *)0x001cfc20; pSifLoadModuleBuffer = (void *)0x001d0540; break; - case 2: //PAL + case 2: // PAL _pSifLoadModule = (void *)0x001d11c0; pSifAllocIopHeap = (void *)0x001d0770; pSifFreeIopHeap = (void *)0x001d0860; @@ -517,7 +517,7 @@ static int SOS_SifLoadModuleHook(const char *path, int arg_len, const char *args pSifAllocIopHeap = NULL; pSifFreeIopHeap = NULL; pSifLoadModuleBuffer = NULL; - //Should not happen. + // Should not happen. asm volatile("break\n"); } @@ -557,14 +557,14 @@ static void SOSPatch(int region) g_mode = region; switch (region) { // JAL SOS_SifLoadModuleHook - replace call to _SifLoadModule. - case 0: //NTSC-J + case 0: // NTSC-J _sw(JAL((u32)&SOS_SifLoadModuleHook), 0x001d08b4); break; - case 1: //NTSC-U/C + case 1: // NTSC-U/C _sw(JAL((u32)&SOS_SifLoadModuleHook), 0x001d07b4); break; - case 2: //PAL - //_sw(JAL((u32)&SOS_SifLoadModuleHook), 0x001d13f4); + case 2: // PAL + // _sw(JAL((u32)&SOS_SifLoadModuleHook), 0x001d13f4); break; } } @@ -578,15 +578,15 @@ static void VirtuaQuest_patches(void) Note: this means that the stack will overwrite the module storage and hence further IOP reboots are not possible. However, carving out memory for the modules results in a NULL pointer being passed to memset(). */ - //Fix the stack base pointer for SetupThread(), so that the EE kernel will not reserve 4KB. - //0x02000000 - 0x18000 = 0x01FE8000 - _sw(0x3c0501fe, 0x000a019c); //lui $a1, $01fe - _sw(0x34a58000, 0x000a01b0); //ori a1, a1, $8000 + // Fix the stack base pointer for SetupThread(), so that the EE kernel will not reserve 4KB. + // 0x02000000 - 0x18000 = 0x01FE8000 + _sw(0x3c0501fe, 0x000a019c); // lui $a1, $01fe + _sw(0x34a58000, 0x000a01b0); // ori a1, a1, $8000 - //Change end of memory pointer (game will subtract 0x18000 from it). - //0x02000000 - (0x39000 - 0x18000) = 0x1FDF000 - _sw(0x3c0301fd, 0x000c565c); //lui $v1, 0x01fd - _sw(0x3463f000, 0x000c566c); //ori $v1, $v1, 0xf000 + // Change end of memory pointer (game will subtract 0x18000 from it). + // 0x02000000 - (0x39000 - 0x18000) = 0x1FDF000 + _sw(0x3c0301fd, 0x000c565c); // lui $v1, 0x01fd + _sw(0x3463f000, 0x000c566c); // ori $v1, $v1, 0xf000 } enum ULTPROPINBALL_ELF { @@ -638,7 +638,7 @@ static int UltProPinball_SifLoadModuleHook(const char *path, int arg_len, const pSifAllocIopHeap = NULL; pSifFreeIopHeap = NULL; pSifLoadModuleBuffer = NULL; - //Should not happen. + // Should not happen. asm volatile("break\n"); } @@ -689,20 +689,20 @@ static void UltProPinballPatch(const char *path) } static void EutechnyxWakeupTIDPatch(u32 addr) -{ //Eutechnyx games have the main thread ID hardcoded for a call to WakeupThread(). +{ // Eutechnyx games have the main thread ID hardcoded for a call to WakeupThread(). // addiu $a0, $zero, 1 - //This breaks when the thread IDs change after IGR is used. + // This breaks when the thread IDs change after IGR is used. *(vu16 *)addr = (u16)GetThreadId(); } static void ProSnowboarderPatch(void) -{ //Shaun Palmer's Pro Snowboarder incorrectly uses the main thread ID as the priority, causing a deadlock when the main thread ID changes (ID != priority) - //Replace all jal GetThreadId() with a li $v0, 1, whereby 1 is the main thread's priority (never changed by game). +{ // Shaun Palmer's Pro Snowboarder incorrectly uses the main thread ID as the priority, causing a deadlock when the main thread ID changes (ID != priority) + // Replace all jal GetThreadId() with a li $v0, 1, whereby 1 is the main thread's priority (never changed by game). static const unsigned int pattern[] = { - 0x240300ff, //addiu $v1, $zero, 0xff - 0x3c038080, //li $v0, 0x8080 - 0x34638081, //ori $v1, $v1, 0x8181 - 0x00650018, //mult $v1, $a1 + 0x240300ff, // addiu $v1, $zero, 0xff + 0x3c038080, // li $v0, 0x8080 + 0x34638081, // ori $v1, $v1, 0x8181 + 0x00650018, // mult $v1, $a1 }; static const unsigned int pattern_mask[] = { 0xffffffff, @@ -711,7 +711,7 @@ static void ProSnowboarderPatch(void) 0xffffffff}; u32 *ptr, *ptr2, *ptr3; - //Locate the calls to GetThreadId(). + // Locate the calls to GetThreadId(). ptr = find_pattern_with_mask((u32 *)0x00180000, 0x00280000, pattern, pattern_mask, sizeof(pattern)); if (ptr) { ptr2 = find_pattern_with_mask(ptr + 4, 0x00280000, pattern, pattern_mask, sizeof(pattern)); @@ -720,9 +720,9 @@ static void ProSnowboarderPatch(void) ptr3 = find_pattern_with_mask(ptr2 + 4, 0x00280000, pattern, pattern_mask, sizeof(pattern)); if (ptr3) { - *(vu32 *)&ptr[-12] = 0x24020001; //addiu $v0, $zero, 1 - *(vu32 *)&ptr2[-9] = 0x24020001; //addiu $v0, $zero, 1 - *(vu32 *)&ptr3[-9] = 0x24020001; //addiu $v0, $zero, 1 + *(vu32 *)&ptr[-12] = 0x24020001; // addiu $v0, $zero, 1 + *(vu32 *)&ptr2[-9] = 0x24020001; // addiu $v0, $zero, 1 + *(vu32 *)&ptr3[-9] = 0x24020001; // addiu $v0, $zero, 1 } } } @@ -730,7 +730,7 @@ static void ProSnowboarderPatch(void) static int ShadowMan2_SifLoadModuleHook(const char *path, int arg_len, const char *args) { - //int (*pSifLoadModule)(const char *path, int arg_len, const char *args); + // int (*pSifLoadModule)(const char *path, int arg_len, const char *args); void *(*pSifAllocIopHeap)(int size); int (*pSifFreeIopHeap)(void *addr); int (*pSifLoadModuleBuffer)(void *ptr, int arg_len, const char *args); @@ -741,30 +741,30 @@ static int ShadowMan2_SifLoadModuleHook(const char *path, int arg_len, const cha unsigned int f2techioppatch_irx_size; switch (g_mode) { - case 1: //NTSC-U/C - //pSifLoadModule = (void *)0x00234188; + case 1: // NTSC-U/C + // pSifLoadModule = (void *)0x00234188; pSifAllocIopHeap = (void *)0x239df0; pSifFreeIopHeap = (void *)0x239f58; pSifLoadModuleBuffer = (void *)0x00233f20; break; - case 2: //PAL - //pSifLoadModule = (void *)0x002336c8; + case 2: // PAL + // pSifLoadModule = (void *)0x002336c8; pSifAllocIopHeap = (void *)0x00239330; pSifFreeIopHeap = (void *)0x00239498; pSifLoadModuleBuffer = (void *)0x00233460; break; - case 3: //PAL German - //pSifLoadModule = (void *)0x00233588; + case 3: // PAL German + // pSifLoadModule = (void *)0x00233588; pSifAllocIopHeap = (void *)0x002391f0; pSifFreeIopHeap = (void *)0x00239358; pSifLoadModuleBuffer = (void *)0x00233320; break; default: - //pSifLoadModule = NULL; + // pSifLoadModule = NULL; pSifAllocIopHeap = NULL; pSifFreeIopHeap = NULL; pSifLoadModuleBuffer = NULL; - //Should not happen. + // Should not happen. asm volatile("break\n"); } @@ -798,13 +798,13 @@ static void ShadowMan2Patch(int region) g_mode = region; switch (region) { // JAL ShadowMan2_SifLoadModuleHook. - case 1: //NTSC-U/C + case 1: // NTSC-U/C _sw(JAL((u32)&ShadowMan2_SifLoadModuleHook), 0x001d2838); break; - case 2: //PAL + case 2: // PAL _sw(JAL((u32)&ShadowMan2_SifLoadModuleHook), 0x001d2768); break; - case 3: //PAL German + case 3: // PAL German _sw(JAL((u32)&ShadowMan2_SifLoadModuleHook), 0x001d2650); break; } @@ -829,13 +829,13 @@ static void HarvestMoonAWLPatch(int region) The mistake may be made in various places, but seems to only affect the game's initial loading screen. */ switch (region) { - case 1: //NTSC-U/C - case 2: //PAL + case 1: // NTSC-U/C + case 2: // PAL _sw(0x00000000, 0x0011b694); _sw(0x00000000, 0x0011b6c0); _sw(0x00000000, 0x0011b6c4); break; - case 0: //NTSC-J + case 0: // NTSC-J _sw(0x00000000, 0x0011b634); _sw(0x00000000, 0x0011b660); _sw(0x00000000, 0x0011b664); diff --git a/ee_core/src/syshook.c b/ee_core/src/syshook.c index c35ec3955..8f52a4251 100644 --- a/ee_core/src/syshook.c +++ b/ee_core/src/syshook.c @@ -85,14 +85,14 @@ void sysLoadElf(char *filename, int argc, char **argv) DPRINTF("t_loadElf: elf path = '%s'\n", filename); if (!DisableDebug) - GS_BGCOLOUR = 0x00ff00; //Green + GS_BGCOLOUR = 0x00ff00; // Green DPRINTF("t_loadElf: cleaning user memory..."); // wipe user memory WipeUserMemory((void *)&_end, (void *)ModStorageStart); - //The upper half (from ModStorageEnd to GetMemorySize()) is taken care of by LoadExecPS2(). - //WipeUserMemory((void *)ModStorageEnd, (void *)GetMemorySize()); + // The upper half (from ModStorageEnd to GetMemorySize()) is taken care of by LoadExecPS2(). + // WipeUserMemory((void *)ModStorageEnd, (void *)GetMemorySize()); FlushCache(0); @@ -125,8 +125,8 @@ void sysLoadElf(char *filename, int argc, char **argv) DPRINTF(" failed\n"); - //Error - GS_BGCOLOUR = 0xffffff; //White - shouldn't happen. + // Error + GS_BGCOLOUR = 0xffffff; // White - shouldn't happen. SleepThread(); } diff --git a/ee_core/src/tlb.c b/ee_core/src/tlb.c index 5c5027e87..0b8fc9941 100644 --- a/ee_core/src/tlb.c +++ b/ee_core/src/tlb.c @@ -2,7 +2,7 @@ #include #include "tlb.h" -#define kprintf(args...) //sio_printf(args) +#define kprintf(args...) // sio_printf(args) static int InitTLB32MB(void); @@ -60,7 +60,7 @@ struct TLBInfo #define TLB_NUM_DEFAULT_ENTRIES 0x12 #define TLB_NUM_EXTENDED_ENTRIES 0x08 -//Compile-time sanity checks. +// Compile-time sanity checks. #if (TLB_NUM_KERNEL_ENTRIES + TLB_NUM_DEFAULT_ENTRIES + TLB_NUM_EXTENDED_ENTRIES >= 0x31) #error TLB over flow #endif diff --git a/ee_core/src/util.c b/ee_core/src/util.c index 7431d9c57..fa3780cb1 100644 --- a/ee_core/src/util.c +++ b/ee_core/src/util.c @@ -3,7 +3,7 @@ Copyright 2006-2008 Polo Licenced under Academic Free License version 3.0 Review Open PS2 Loader README & LICENSE files for further details. - + Some parts of the code are taken from HD Project by Polo */ @@ -88,7 +88,7 @@ char *_strrchr(const char *string, int c) /* if char is never found then this will return 0 */ /* if char is found then this will return the last matched location - before strchr returned 0 */ + before strchr returned 0 */ lastmatch = 0; result = _strchr(string, c); @@ -308,7 +308,7 @@ void set_ipconfig(void) strncpy(&g_ipconfig[g_ipconfig_len], g_ps2_gateway, 16); g_ipconfig_len += strlen(g_ps2_gateway) + 1; - //Add Ethernet operation mode to g_ipconfig buf + // Add Ethernet operation mode to g_ipconfig buf if (g_ps2_ETHOpMode != ETH_OP_MODE_AUTO) { strncpy(&g_ipconfig[g_ipconfig_len], "-no_auto", 9); g_ipconfig_len += 9; diff --git a/elfldr/elfldr.c b/elfldr/elfldr.c index a663071e7..6ea1a732f 100644 --- a/elfldr/elfldr.c +++ b/elfldr/elfldr.c @@ -14,7 +14,7 @@ #include #include -/*static inline void _strcpy(char *dst, const char *src) +/* static inline void _strcpy(char *dst, const char *src) { memcpy(dst, src, strlen(src) + 1); } @@ -38,7 +38,7 @@ static int _strncmp(const char *s1, const char *s2, int length) } return 0; -}*/ +} */ static inline void BootError(char *filename) { @@ -71,7 +71,7 @@ int main(int argc, char *argv[]) exd.epc = 0; - //clear memory. + // clear memory. InitializeUserMemory(0x00100000, GetMemorySize()); FlushCache(0); @@ -82,7 +82,7 @@ int main(int argc, char *argv[]) SifLoadFileExit(); if (result == 0 && exd.epc != 0) { - //Final IOP reset, to fill the IOP with the default modules. + // Final IOP reset, to fill the IOP with the default modules. while (!SifIopReset("", 0)) { }; @@ -93,7 +93,7 @@ int main(int argc, char *argv[]) }; SifInitRpc(0); - //Load modules. + // Load modules. SifLoadFileInit(); SifLoadModule("rom0:SIO2MAN", 0, NULL); SifLoadModule("rom0:MCMAN", 0, NULL); diff --git a/include/OSDHistory.h b/include/OSDHistory.h index b8c69882c..f56d0354b 100644 --- a/include/OSDHistory.h +++ b/include/OSDHistory.h @@ -1,84 +1,83 @@ #define MAX_HISTORY_ENTRIES 21 /* - If the record is valid, the launch count will be >0. + If the record is valid, the launch count will be >0. - Starts with: - SLPM_550.52, data: 01 01 00 00 75 1a - After 2 launches: - SLPM_550.52, data: 02 01 00 00 75 1a - After 15 launches: - SLPM_550.52, data: 0e 11 04 00 75 1a - Clock advanced 1 day: - SLPM_550.52, data: 01 01 00 00 76 1a - Clock advanced 1 year: - SLPM_550.52, data: 01 01 00 00 75 1c - Clock set to Jan 1 2013: - SLPM_550.52, data: 01 01 00 00 21 1a + Starts with: + SLPM_550.52, data: 01 01 00 00 75 1a + After 2 launches: + SLPM_550.52, data: 02 01 00 00 75 1a + After 15 launches: + SLPM_550.52, data: 0e 11 04 00 75 1a + Clock advanced 1 day: + SLPM_550.52, data: 01 01 00 00 76 1a + Clock advanced 1 year: + SLPM_550.52, data: 01 01 00 00 75 1c + Clock set to Jan 1 2013: + SLPM_550.52, data: 01 01 00 00 21 1a - //0x002187e8 - Not sure what this is. rand? - static unsigned int var_0028b020=1; //0x0028b020 - static int func_002187e8(void){ - var_0028b020=(var_0028b020*0x41c64e6d+0x3039); - return(var_0028b020&0x7FFFFFFF); - } + // 0x002187e8 - Not sure what this is. rand? + static unsigned int var_0028b020 = 1; // 0x0028b020 + static int func_002187e8(void) + { + var_0028b020 = (var_0028b020 * 0x41c64e6d + 0x3039); + return (var_0028b020 & 0x7FFFFFFF); + } - //0x002021a0, OSDSYS 1.00, ROM 1.01 - int value, LeastUsedRecord, LeastUsedRecordLaunchCount, LeastUsedRecordTimestamp; + // 0x002021a0, OSDSYS 1.00, ROM 1.01 + int value, LeastUsedRecord, LeastUsedRecordLaunchCount, LeastUsedRecordTimestamp; - for(i=0,LeastUsedRecord=0,LeastUsedRecordTimestamp=LeastUsedRecordLaunchCount=0x7FFFFFFF; i<21; i++){ - if(entry.LaunchCount=0x80){ - entry.LaunchCount=0x7F; - } + // 0x0020220c + if (!strcmp(entry.filename, filename)) { + if (entry.data[1] & 0x3F != 0x3F) { + entry.LaunchCount++; + if (entry.LaunchCount >= 0x80) { + entry.LaunchCount = 0x7F; + } - if(entry.LaunchCount>=0xE){ - if((entry.LaunchCount-14)%10){ - while((entry.data[1]>>(value=func_002187e8()%6)&1){}; - entry.data[2]=value; - entry.data[1]|=1<= 0xE) { + if ((entry.LaunchCount - 14) % 10) { + while((entry.data[1]>>(value=func_002187e8()%6)&1){}; + entry.data[2]=value; + entry.data[1]|=1<> 9 & 0x7F) @@ -96,7 +95,7 @@ struct HistoryEntry unsigned short int DateStamp; }; -//Functions +// Functions int LoadHistoryFile(const char *path, struct HistoryEntry *HistoryEntries); int SaveHistoryFile(const char *path, const struct HistoryEntry *HistoryEntries); int AddOldHistoryFileRecord(const char *path, const struct HistoryEntry *OldHistoryEntry); diff --git a/include/atlas.h b/include/atlas.h index fd2ea5c60..de7048b85 100644 --- a/include/atlas.h +++ b/include/atlas.h @@ -20,7 +20,7 @@ typedef struct /** allocates a new atlas. Further settings should be set manually * on the atlas_t::surface. - */ + */ atlas_t *atlasNew(size_t width, size_t height, u8 psm); /// Frees the atlas diff --git a/include/config.h b/include/config.h index c717be235..827bd9499 100644 --- a/include/config.h +++ b/include/config.h @@ -1,7 +1,7 @@ #ifndef __CONFIG_H #define __CONFIG_H -//Enum for the different types of config files. Game-specific config files (.cfg) will always have an ID of 0. +// Enum for the different types of config files. Game-specific config files (.cfg) will always have an ID of 0. enum CONFIG_INDEX { CONFIG_INDEX_OPL = 0, CONFIG_INDEX_LAST, @@ -12,7 +12,7 @@ enum CONFIG_INDEX { CONFIG_INDEX_COUNT }; -//Config type bits +// Config type bits #define CONFIG_OPL (1 << CONFIG_INDEX_OPL) #define CONFIG_LAST (1 << CONFIG_INDEX_LAST) #define CONFIG_APPS (1 << CONFIG_INDEX_APPS) @@ -22,9 +22,9 @@ enum CONFIG_INDEX { #define CONFIG_SOURCE_DEFAULT 0 #define CONFIG_SOURCE_USER 1 -#define CONFIG_SOURCE_DLOAD 2 //Downloaded from the network +#define CONFIG_SOURCE_DLOAD 2 // Downloaded from the network -//Items for per-game config files. +// Items for per-game config files. #define CONFIG_ITEM_NAME "#Name" #define CONFIG_ITEM_LONGNAME "#LongName" #define CONFIG_ITEM_SIZE "#Size" @@ -38,7 +38,7 @@ enum CONFIG_INDEX { #define CONFIG_ITEM_DNAS "$DNAS" #define CONFIG_ITEM_CONFIGSOURCE "$ConfigSource" -//Per-Game GSM keys. -Bat- +// Per-Game GSM keys. -Bat- #define CONFIG_ITEM_GSMSOURCE "$GSMSource" #define CONFIG_ITEM_ENABLEGSM "$EnableGSM" #define CONFIG_ITEM_GSMVMODE "$GSMVMode" @@ -46,7 +46,7 @@ enum CONFIG_INDEX { #define CONFIG_ITEM_GSMYOFFSET "$GSMYOffset" #define CONFIG_ITEM_GSMFIELDFIX "$GSMFIELDFix" -//Per-Game CHEAT keys. -Bat- +// Per-Game CHEAT keys. -Bat- #define CONFIG_ITEM_CHEATSSOURCE "$CheatsSource" #define CONFIG_ITEM_ENABLECHEAT "$EnableCheat" #define CONFIG_ITEM_CHEATMODE "$CheatMode" @@ -55,7 +55,7 @@ enum CONFIG_INDEX { #define CONFIG_ITEM_ENABLEPADEMU "$EnablePadEmu" #define CONFIG_ITEM_PADEMUSETTINGS "$PadEmuSettings" -//OPL config keys +// OPL config keys #define CONFIG_OPL_THEME "theme" #define CONFIG_OPL_LANGUAGE "language_text" #define CONFIG_OPL_SCROLLING "scrolling" @@ -95,7 +95,7 @@ enum CONFIG_INDEX { #define CONFIG_OPL_SFX_VOLUME "sfx_volume" #define CONFIG_OPL_BOOT_SND_VOLUME "boot_snd_volume" -//Network config keys +// Network config keys #define CONFIG_NET_ETH_LINKM "eth_linkmode" #define CONFIG_NET_PS2_DHCP "ps2_ip_use_dhcp" #define CONFIG_NET_PS2_IP "ps2_ip_addr" @@ -115,7 +115,7 @@ enum CONFIG_INDEX { struct config_value_t { - //Including the NULL terminator + // Including the NULL terminator char key[CONFIG_KEY_NAME_LEN]; char val[CONFIG_KEY_VALUE_LEN]; diff --git a/include/ethsupport.h b/include/ethsupport.h index 1d2e76e8b..4cab9e5fb 100644 --- a/include/ethsupport.h +++ b/include/ethsupport.h @@ -15,10 +15,10 @@ typedef struct vmc_spec_t specs; /* Card specifications */ } smb_vmc_infos_t; -void ethInit(void); //Full initialization (Start ETH + SMB and apply configuration). GUI must be already initialized, used by GUI to start SMB mode. -void ethDeinitModules(void); //Module-only deinitialization, without the GUI's knowledge (for specific reasons, otherwise unused). -int ethLoadInitModules(void); //Initializes Ethernet and applies configuration. -void ethDisplayErrorStatus(void); //Displays the current error status (if any). GUI must be already initialized. +void ethInit(void); // Full initialization (Start ETH + SMB and apply configuration). GUI must be already initialized, used by GUI to start SMB mode. +void ethDeinitModules(void); // Module-only deinitialization, without the GUI's knowledge (for specific reasons, otherwise unused). +int ethLoadInitModules(void); // Initializes Ethernet and applies configuration. +void ethDisplayErrorStatus(void); // Displays the current error status (if any). GUI must be already initialized. int ethGetNetConfig(u8 *ip_address, u8 *netmask, u8 *gateway); int ethApplyConfig(void); int ethGetDHCPStatus(void); diff --git a/include/fntsys.h b/include/fntsys.h index 2eaf2c9a6..5aae50f4b 100644 --- a/include/fntsys.h +++ b/include/fntsys.h @@ -15,8 +15,8 @@ void fntInit(); void fntEnd(); /** Loads a font from a file path - * @param path The path to the font file - * @return font slot id (negative value means error happened) */ + * @param path The path to the font file + * @return font slot id (negative value means error happened) */ int fntLoadFile(char *path); /** Reloads the default font */ @@ -26,19 +26,19 @@ int fntLoadDefault(char *path); void fntRelease(int id); /** Updates to the native display resolution and aspect ratio -* @note Invalidates the whole glyph cache for all fonts! */ + * @note Invalidates the whole glyph cache for all fonts! */ void fntUpdateAspectRatio(); /** Renders a text with specified window dimensions */ int fntRenderString(int id, int x, int y, short aligned, size_t width, size_t height, const char *string, u64 colour); /** replaces spaces with newlines so that the text fits into the specified width. - * @note A destrutive operation - modifies the given string! - */ + * @note A destrutive operation - modifies the given string! + */ void fntFitString(int id, char *string, size_t width); /** Calculates the width of the given text string -* We can't use the height for alignment, as the horizontal center would depends of the contained text itself */ + * We can't use the height for alignment, as the horizontal center would depends of the contained text itself */ int fntCalcDimensions(int id, const char *str); #endif diff --git a/include/gui.h b/include/gui.h index 71fc30114..e906f6bc7 100644 --- a/include/gui.h +++ b/include/gui.h @@ -92,14 +92,14 @@ updates of the menu from another thread without stalls. */ /** Detects if a given deffered operation is already complete -* @param opid The operation id, as returned from guiDeferUpdate -* @return 1 if the operation was already completed, 0 otherwise */ + * @param opid The operation id, as returned from guiDeferUpdate + * @return 1 if the operation was already completed, 0 otherwise */ int guiGetOpCompleted(int opid); /** Defers the given update to an appropriate time. -* @param op The operation to defer -* @return int The operation serial id -*/ + * @param op The operation to defer + * @return int The operation serial id + */ int guiDeferUpdate(struct gui_update_t *op); void guiExecDeferredOps(void); @@ -134,19 +134,19 @@ void guiShowParentalLockConfig(); void guiCheckNotifications(int checkTheme, int checkLang); -/** Renders the given string on screen for the given function until it's io finishes -* @note The ptr pointer is watched for it's value. The IO is considered finished when the value becomes zero. -* @param ptr The finished state pointer (1 unfinished, 0 finished) -* @param message The message to display while working -* @param type the io operation type -* @param data the data for the operation -*/ +/** Renders the given string on screen for the given function until it's io finishes + * @note The ptr pointer is watched for it's value. The IO is considered finished when the value becomes zero. + * @param ptr The finished state pointer (1 unfinished, 0 finished) + * @param message The message to display while working + * @param type the io operation type + * @param data the data for the operation + */ void guiHandleDeferedIO(int *ptr, const char *message, int type, void *data); void guiGameHandleDeferedIO(int *ptr, struct UIItem *ui, int type, void *data); /** Renders a single frame with a specified message on the screen -*/ + */ void guiRenderTextScreen(const char *message); void guiWarning(const char *text, int count); diff --git a/include/hdd.h b/include/hdd.h index 8b3b2f52b..ef571e931 100644 --- a/include/hdd.h +++ b/include/hdd.h @@ -86,10 +86,10 @@ typedef struct int hddReadSectors(u32 lba, u32 nsectors, void *buf); -//Array should be APA_MAXSUB+1 entries. +// Array should be APA_MAXSUB+1 entries. int hddGetPartitionInfo(const char *name, apa_sub_t *parts); -//Array should be max entries. +// Array should be max entries. int hddGetFileBlockInfo(const char *name, const apa_sub_t *subs, pfs_blockinfo_t *blocks, int max); #endif diff --git a/include/ioman.h b/include/ioman.h index 15a9d4f01..55a7af7f5 100644 --- a/include/ioman.h +++ b/include/ioman.h @@ -25,12 +25,12 @@ void ioEnd(void); int ioRegisterHandler(int type, io_request_handler_t handler); /** schedules a new request into the pending request list -* @note The data are not freed! */ + * @note The data are not freed! */ int ioPutRequest(int type, void *data); /** removes all requests of a given type from the queue -* @param type the type of the requests to remove -* @return the count of the requests removed */ + * @param type the type of the requests to remove + * @return the count of the requests removed */ int ioRemoveRequests(int type); /** returns the count of pending requests */ diff --git a/include/iosupport.h b/include/iosupport.h index 658bf9819..5c72fcbaf 100644 --- a/include/iosupport.h +++ b/include/iosupport.h @@ -22,29 +22,29 @@ enum START_MODE { }; enum ERROR_CODE { - //Generic error codes + // Generic error codes ERROR_ETH_NOT_STARTED = 100, - //Ethernet (module startup) error codes + // Ethernet (module startup) error codes ERROR_ETH_MODULE_NETIF_FAILURE = 200, ERROR_ETH_MODULE_SMBMAN_FAILURE, - //HDD (module startup) error codes + // HDD (module startup) error codes ERROR_HDD_MODULE_ATAD_FAILURE = 220, ERROR_HDD_MODULE_HDD_FAILURE, ERROR_HDD_MODULE_PFS_FAILURE, - //Ethernet (software) error codes + // Ethernet (software) error codes ERROR_ETH_SMB_CONN = 300, ERROR_ETH_SMB_LOGON, ERROR_ETH_SMB_ECHO, ERROR_ETH_SMB_OPENSHARE, ERROR_ETH_SMB_LISTSHARES, ERROR_ETH_SMB_LISTGAMES, - //Ethernet (hardware) error codes + // Ethernet (hardware) error codes ERROR_ETH_LINK_FAIL = 310, ERROR_ETH_DHCP_FAIL, - //HDD error codes + // HDD error codes ERROR_HDD_IF_NOT_DETECTED = 400, ERROR_HDD_NOT_DETECTED, }; @@ -72,8 +72,8 @@ enum ERROR_CODE { // minimal inactive frames for cover display, can be pretty low since it means no button is pressed :) #define MENU_MIN_INACTIVE_FRAMES 8 -#define MENU_UPD_DELAY_NOUPDATE -1 //Auto refresh is disabled for the item. The refresh button may be used to manually refresh the item. -#define MENU_UPD_DELAY_GENREFRESH 0 //The item will be refreshed every MENU_GENERAL_UPDATE_DELAY frames, regardless of whether automatic refresh is enabled or not. +#define MENU_UPD_DELAY_NOUPDATE -1 // Auto refresh is disabled for the item. The refresh button may be used to manually refresh the item. +#define MENU_UPD_DELAY_GENREFRESH 0 // The item will be refreshed every MENU_GENERAL_UPDATE_DELAY frames, regardless of whether automatic refresh is enabled or not. typedef struct { diff --git a/include/lang.h b/include/lang.h index 06ca084d7..e4b76a738 100644 --- a/include/lang.h +++ b/include/lang.h @@ -26,7 +26,7 @@ enum _STR_IDS { _STR_CONFIRMATION_CANCEL_UPDATE, _STR_HDD_NOT_CONNECTED_ERROR, _STR_HDD_NOT_FORMATTED_ERROR, - _STR_NETWORK_STARTUP_ERROR, //Generic network error message. + _STR_NETWORK_STARTUP_ERROR, // Generic network error message. _STR_NETWORK_STARTUP_ERROR_NETIF, _STR_NETWORK_STARTUP_ERROR_CONN, _STR_NETWORK_STARTUP_ERROR_LOGON, diff --git a/include/nbns.h b/include/nbns.h index 07cbb6d9c..f6802aecc 100644 --- a/include/nbns.h +++ b/include/nbns.h @@ -1,18 +1,18 @@ -//RPC IDs +// RPC IDs enum NBNS_RPC_ID { NBNS_RPC_ID_FIND_NAME = 0, NBNS_RPC_ID_COUNT }; -//RPC structures +// RPC structures struct nbnsFindNameResult { int result; u8 address[4]; }; -//Function prototypes +// Function prototypes int nbnsInit(void); void nbnsDeinit(void); int nbnsFindName(const char *name, unsigned char *ip_address); diff --git a/include/opl.h b/include/opl.h index d3e203cc5..5101b1ae6 100644 --- a/include/opl.h +++ b/include/opl.h @@ -41,16 +41,16 @@ // Last Played Auto Start #include -//Master password for disabling the parental lock. +// Master password for disabling the parental lock. #define OPL_PARENTAL_LOCK_MASTER_PASS "989765" -//IO type IDs +// IO type IDs #define IO_CUSTOM_SIMPLEACTION 1 // handler for parameter-less actions #define IO_MENU_UPDATE_DEFFERED 2 #define IO_CACHE_LOAD_ART 3 // io call to handle the loading of covers #define IO_COMPAT_UPDATE_DEFFERED 4 -//Codes have been planned to fit the design of the GUI functions within gui.c. +// Codes have been planned to fit the design of the GUI functions within gui.c. #define OPL_COMPAT_UPDATE_STAT_WIP 0 #define OPL_COMPAT_UPDATE_STAT_DONE 1 #define OPL_COMPAT_UPDATE_STAT_ERROR -1 @@ -93,11 +93,11 @@ extern int ps2_ip[4]; extern int ps2_netmask[4]; extern int ps2_gateway[4]; extern int ps2_dns[4]; -extern int gETHOpMode; //See ETH_OP_MODES. +extern int gETHOpMode; // See ETH_OP_MODES. extern int gPCShareAddressIsNetBIOS; extern int pc_ip[4]; extern int gPCPort; -//Please keep these string lengths in-sync with the limits within CDVDMAN. +// Please keep these string lengths in-sync with the limits within CDVDMAN. extern char gPCShareNBAddress[17]; extern char gPCShareName[32]; extern char gPCUserName[32]; @@ -167,7 +167,7 @@ extern int gDefaultDevice; extern int gEnableWrite; extern char *gHDDPrefix; -//These prefixes are relative to the device's name (meaning that they do not include the device name). +// These prefixes are relative to the device's name (meaning that they do not include the device name). extern char gBDMPrefix[32]; extern char gETHPrefix[32]; @@ -188,8 +188,11 @@ void setDefaultColors(void); #define MENU_ITEM_HEIGHT 19 -// BLURT output -//char blurttext[128]; -//#define BLURT snprintf(blurttext, sizeof(blurttext), "%s\\%s(%d)", __FILE__ , __func__ , __LINE__ );delay(10); -//#define BLURT snprintf(blurttext, sizeof(blurttext), "%s(%d)", blurttext, __LINE__); +/* +BLURT output char blurttext[128]; +#define BLURT \ + snprintf(blurttext, sizeof(blurttext), "%s\\%s(%d)", __FILE__, __func__, __LINE__); \ + delay(10); +#define BLURT snprintf(blurttext, sizeof(blurttext), "%s(%d)", blurttext, __LINE__); +*/ #endif diff --git a/include/pad.h b/include/pad.h index 9f35da8e2..452f01b0f 100644 --- a/include/pad.h +++ b/include/pad.h @@ -1,7 +1,7 @@ #ifndef __PAD_H #define __PAD_H -//PAD handling +// PAD handling #define KEY_LEFT 1 #define KEY_DOWN 2 @@ -31,8 +31,8 @@ int getKeyOff(int num); int getKeyPressed(int num); /** Sets the repetition delay for the specified button -* @param button id (KEY_XXX values) -* @param btndelay the delay in miliseconds per repeat (clamped by framerate!) */ + * @param button id (KEY_XXX values) + * @param btndelay the delay in miliseconds per repeat (clamped by framerate!) */ void setButtonDelay(int button, int btndelay); /** Gets the repetition delay for the specified button */ diff --git a/include/renderman.h b/include/renderman.h index a745c15a6..1ec2ae3a0 100644 --- a/include/renderman.h +++ b/include/renderman.h @@ -84,7 +84,7 @@ void rmGetScreenExtentsNative(int *w, int *h); void rmGetScreenExtents(int *w, int *h); /** Invalidate a texture so it will be re-transferred to VRAM the next time. -* @param txt The texture to invalidate */ + * @param txt The texture to invalidate */ void rmInvalidateTexture(GSTEXTURE *txt); /** Unload texture from texture manager, performance optimization */ @@ -117,7 +117,7 @@ void rmSetDisplayOffset(int x, int y); void rmSetOverscan(int overscan); /** Sets the aspect ratio correction for the upcoming operations. -* When set, it will treat all pixmap widths/heights (not positions) as scaled with the ratios provided */ + * When set, it will treat all pixmap widths/heights (not positions) as scaled with the ratios provided */ void rmSetAspectRatio(enum rm_aratio dar); /** Widescreen scaling */ @@ -141,7 +141,7 @@ int rmUnScaleX(int x); /** Scale y from native to 480 resolution */ int rmUnScaleY(int y); -//Returns H-sync frequency in KHz +// Returns H-sync frequency in KHz unsigned char rmGetHsync(void); #endif diff --git a/include/supportbase.h b/include/supportbase.h index 95aef169c..b507554e1 100644 --- a/include/supportbase.h +++ b/include/supportbase.h @@ -30,9 +30,9 @@ typedef struct char name[UL_GAME_NAME_MAX]; char startup[15]; u8 parts; - u8 media; //Disc type + u8 media; // Disc type u8 unknown[4]; - u8 Byte08; //Always 0x08 + u8 Byte08; // Always 0x08 u8 unknown2[10]; } USBExtreme_game_entry_t; @@ -48,7 +48,7 @@ void sbRename(base_game_info_t **list, const char *prefix, const char *sep, int config_set_t *sbPopulateConfig(base_game_info_t *game, const char *prefix, const char *sep); void sbCreateFolders(const char *path, int createDiscImgFolders); -//ISO9660 filesystem management functions. +// ISO9660 filesystem management functions. u32 sbGetISO9660MaxLBA(const char *path); int sbProbeISO9660(const char *path, base_game_info_t *game, u32 layer1_offset); int sbProbeISO9660_64(const char *path, base_game_info_t *game, u32 layer1_offset); diff --git a/include/texcache.h b/include/texcache.h index 81f46b045..8900e5d2f 100644 --- a/include/texcache.h +++ b/include/texcache.h @@ -41,19 +41,19 @@ typedef struct } image_cache_t; /** Initializes the cache subsystem. -*/ + */ void cacheInit(); /** Terminates the cache. Does nothing currently. Users of this code have to destroy caches via cacheDestroyCache -*/ + */ void cacheEnd(); -/** Initializes a single cache -*/ +/** Initializes a single cache + */ image_cache_t *cacheInitCache(int userId, const char *prefix, int isPrefixRelative, const char *suffix, int count); /** Destroys a given cache (unallocates all memory stored there, disconnects the pixmaps from the usage points). -*/ + */ void cacheDestroyCache(image_cache_t *cache); GSTEXTURE *cacheGetTexture(image_cache_t *cache, item_list_t *list, int *cacheId, int *UID, char *value); diff --git a/include/util.h b/include/util.h index c6b7033c4..66baeed46 100644 --- a/include/util.h +++ b/include/util.h @@ -36,7 +36,7 @@ char toHex(int digit); enum CONSOLE_REGIONS { CONSOLE_REGION_INVALID = -1, CONSOLE_REGION_JAPAN = 0, - CONSOLE_REGION_USA, //USA and HK/SG. + CONSOLE_REGION_USA, // USA and HK/SG. CONSOLE_REGION_EUROPE, CONSOLE_REGION_CHINA, diff --git a/labs/genvmclab/genvmclab.c b/labs/genvmclab/genvmclab.c index 6d0bcd011..72458f540 100644 --- a/labs/genvmclab/genvmclab.c +++ b/labs/genvmclab/genvmclab.c @@ -121,7 +121,7 @@ int main(int argc, char *argv[2]) sbv_patch_disable_prefix_check(); SifLoadModule("rom0:SIO2MAN", 0, 0); - //SifLoadModule("rom0:MCMAN", 0, 0); + // SifLoadModule("rom0:MCMAN", 0, 0); DPRINTF("OK\n"); diff --git a/labs/smblab/smblab.c b/labs/smblab/smblab.c index c039cb506..37b35fb91 100644 --- a/labs/smblab/smblab.c +++ b/labs/smblab/smblab.c @@ -252,15 +252,17 @@ int main(int argc, char *argv[2]) strcpy(logon.serverIP, "192.168.0.2"); logon.serverPort = 445; strcpy(logon.User, "GUEST"); - //strcpy(logon.User, "jimmikaelkael"); + /* + strcpy(logon.User, "jimmikaelkael"); // we could reuse the generated hash - //memcpy((void *)logon.Password, (void *)&passwdhashes, sizeof(passwdhashes)); - //logon.PasswordType = HASHED_PASSWORD; + memcpy((void *)logon.Password, (void *)&passwdhashes, sizeof(passwdhashes)); + logon.PasswordType = HASHED_PASSWORD; // or log sending the plaintext password - //strcpy(logon.Password, "mypassw"); - //logon.PasswordType = PLAINTEXT_PASSWORD; + strcpy(logon.Password, "mypassw"); + logon.PasswordType = PLAINTEXT_PASSWORD; // or simply tell we're not sending password - //logon.PasswordType = NO_PASSWORD; + logon.PasswordType = NO_PASSWORD; + */ DPRINTF("LOGON... "); ret = fileXioDevctl("smb:", SMB_DEVCTL_LOGON, (void *)&logon, sizeof(logon), NULL, 0); @@ -317,13 +319,13 @@ int main(int argc, char *argv[2]) strcpy(openshare.ShareName, "PS2SMB"); // we could reuse the generated hash - //memcpy((void *)logon.Password, (void *)&passwdhashes, sizeof(passwdhashes)); - //logon.PasswordType = HASHED_PASSWORD; + // memcpy((void *)logon.Password, (void *)&passwdhashes, sizeof(passwdhashes)); + // logon.PasswordType = HASHED_PASSWORD; // or log sending the plaintext password - //strcpy(logon.Password, "mypassw"); - //logon.PasswordType = PLAINTEXT_PASSWORD; + // strcpy(logon.Password, "mypassw"); + // logon.PasswordType = PLAINTEXT_PASSWORD; // or simply tell we're not sending password - //logon.PasswordType = NO_PASSWORD; + // logon.PasswordType = NO_PASSWORD; DPRINTF("OPENSHARE... "); ret = fileXioDevctl("smb:", SMB_DEVCTL_OPENSHARE, (void *)&openshare, sizeof(openshare), NULL, 0); @@ -408,15 +410,14 @@ int main(int argc, char *argv[2]) // rename file test: // ---------------------------------------------------------------- /* - DPRINTF("IO rename... "); - ret = fileXioRename("smb:\\rename_me\\rename_me.txt", "smb:\\rename_me\\renamed.txt"); - if (ret == 0) { - DPRINTF("OK\n"); - } - else { - DPRINTF("Error %d\n", ret); - } - */ + DPRINTF("IO rename... "); + ret = fileXioRename("smb:\\rename_me\\rename_me.txt", "smb:\\rename_me\\renamed.txt"); + if (ret == 0) { + DPRINTF("OK\n"); + } else { + DPRINTF("Error %d\n", ret); + } + */ // ---------------------------------------------------------------- @@ -435,15 +436,14 @@ int main(int argc, char *argv[2]) // delete file test: // ---------------------------------------------------------------- /* - DPRINTF("IO remove... "); - ret = remove("smb:\\delete_me\\delete_me.txt"); - if (ret == 0) { - DPRINTF("OK\n"); - } - else { - DPRINTF("Error %d\n", ret); - } - */ + DPRINTF("IO remove... "); + ret = remove("smb:\\delete_me\\delete_me.txt"); + if (ret == 0) { + DPRINTF("OK\n"); + } else { + DPRINTF("Error %d\n", ret); + } + */ // ---------------------------------------------------------------- @@ -485,16 +485,18 @@ int main(int argc, char *argv[2]) DPRINTF("\n"); // 64bit write test - //fileXioLseek64(fd, filesize - 16, SEEK_SET); - //fileXioWrite(fd, "\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC", 16); - //fileXioLseek64(fd, filesize - 16, SEEK_SET); - //fileXioRead(fd, buf, 16); - //p = (u8 *)buf; - //DPRINTF("read = "); - //for (i=0; i<16; i++) { - // DPRINTF("%02X", p[i]); - //} - //DPRINTF("\n"); + /* + fileXioLseek64(fd, filesize - 16, SEEK_SET); + fileXioWrite(fd, "\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC", 16); + fileXioLseek64(fd, filesize - 16, SEEK_SET); + fileXioRead(fd, buf, 16); + p = (u8 *)buf; + DPRINTF("read = "); + for (i = 0; i < 16; i++) { + DPRINTF("%02X", p[i]); + } + DPRINTF("\n"); + */ fileXioClose(fd); } @@ -510,7 +512,7 @@ int main(int argc, char *argv[2]) close(fd); } - //while(1); + // while(1); // ---------------------------------------------------------------- @@ -549,77 +551,73 @@ int main(int argc, char *argv[2]) } /* - // ---------------------------------------------------------------- - // chdir test - // ---------------------------------------------------------------- - - DPRINTF("IO chdir... "); - ret = fileXioChdir("smb:\\dossier2"); - if (ret == 0) { - DPRINTF("OK\n"); - } - else { - DPRINTF("Error %d\n", ret); - } - - - // ---------------------------------------------------------------- - // dopen/dread/dclose test - // ---------------------------------------------------------------- - - DPRINTF("IO dopen... "); - fd = fileXioDopen("smb:\\"); - if (fd >= 0) { - DPRINTF("OK\n\t "); - ret = 1; - while (ret == 1) { - ret = fileXioDread(fd, &dirent); - if (ret == 1) - DPRINTF("%s ", dirent.name); - } - fileXioDclose(fd); - DPRINTF("\n"); - } - else { - DPRINTF("Error %d\n", ret); - } - - - // ---------------------------------------------------------------- - // chdir test - // ---------------------------------------------------------------- - - DPRINTF("IO chdir... "); - ret = fileXioChdir("smb:\\.."); - if (ret == 0) { - DPRINTF("OK\n"); - } - else { - DPRINTF("Error %d\n", ret); - } - - - // ---------------------------------------------------------------- - // dopen/dread/dclose test - // ---------------------------------------------------------------- - - DPRINTF("IO dopen... "); - fd = fileXioDopen("smb:\\"); - if (fd >= 0) { - DPRINTF("OK\n\t "); - ret = 1; - while (ret == 1) { - ret = fileXioDread(fd, &dirent); - if (ret == 1) - DPRINTF("%s ", dirent.name); - } - fileXioDclose(fd); - DPRINTF("\n"); - } - else { - DPRINTF("Error %d\n", ret); - } - */ + // ---------------------------------------------------------------- + // chdir test + // ---------------------------------------------------------------- + + DPRINTF("IO chdir... "); + ret = fileXioChdir("smb:\\dossier2"); + if (ret == 0) { + DPRINTF("OK\n"); + } else { + DPRINTF("Error %d\n", ret); + } + + + // ---------------------------------------------------------------- + // dopen/dread/dclose test + // ---------------------------------------------------------------- + + DPRINTF("IO dopen... "); + fd = fileXioDopen("smb:\\"); + if (fd >= 0) { + DPRINTF("OK\n\t "); + ret = 1; + while (ret == 1) { + ret = fileXioDread(fd, &dirent); + if (ret == 1) + DPRINTF("%s ", dirent.name); + } + fileXioDclose(fd); + DPRINTF("\n"); + } else { + DPRINTF("Error %d\n", ret); + } + + + // ---------------------------------------------------------------- + // chdir test + // ---------------------------------------------------------------- + + DPRINTF("IO chdir... "); + ret = fileXioChdir("smb:\\.."); + if (ret == 0) { + DPRINTF("OK\n"); + } else { + DPRINTF("Error %d\n", ret); + } + + + // ---------------------------------------------------------------- + // dopen/dread/dclose test + // ---------------------------------------------------------------- + + DPRINTF("IO dopen... "); + fd = fileXioDopen("smb:\\"); + if (fd >= 0) { + DPRINTF("OK\n\t "); + ret = 1; + while (ret == 1) { + ret = fileXioDread(fd, &dirent); + if (ret == 1) + DPRINTF("%s ", dirent.name); + } + fileXioDclose(fd); + DPRINTF("\n"); + } else { + DPRINTF("Error %d\n", ret); + } + */ // ---------------------------------------------------------------- // how to close a share: diff --git a/lng/lang_Bulgarian.lng b/lng/lang_Bulgarian.lng index 2aafc6c0a..e1bb13dbf 100644 --- a/lng/lang_Bulgarian.lng +++ b/lng/lang_Bulgarian.lng @@ -164,7 +164,7 @@ Game ID | 4 5 6 -Режими за съвместимост | 7 +Режими за съвместимост | 7 8 GSM видеорежим Скорост на мрежата и режим diff --git a/lng/lang_Czech.lng b/lng/lang_Czech.lng index 13a6fd37c..6f183444f 100644 --- a/lng/lang_Czech.lng +++ b/lng/lang_Czech.lng @@ -76,7 +76,7 @@ Vypínání HDL Serveru... Cesta k IGR Barva pozadí Barva textu -- PS2 - +- PS2 - - SMB Server - Typ IP adresy Statická diff --git a/lng/lang_French.lng b/lng/lang_French.lng index ea7ec0b5f..970a67f14 100644 --- a/lng/lang_French.lng +++ b/lng/lang_French.lng @@ -76,7 +76,7 @@ Fermeture du serveur HDL… Sortie via IGR vers : Arrière-plan Texte principal -- PS2 - +- PS2 - - Serveur SMB - Type d'adresse IP Statique @@ -127,7 +127,7 @@ Nom Taille État Progression -La VMC existe déjà +La VMC existe déjà Fichier VMC non valide, taille incorrecte La VMC doit d'abord être créée Erreur sur VMC %s. Continuer sur la carte mém. physique %d ? @@ -211,7 +211,7 @@ Logo PS2 Affiche le logo de disque valide correspondant à la région de la console. PADEMU Configuration émulateur manette -Émulateur manette +Émulateur manette Activer/Désactiver émulateur manette pour ce jeu Mode USB/Bluetooth @@ -226,7 +226,7 @@ Activer/Désactiver support vibration pour le port sélectionné Adresse MAC du récepteur Bluetooth DualShock3 connectée à l'adresse MAC Appairer -Appairer manette DS3 +Appairer manette DS3 Appairer manette DS3 avec l'adresse MAC du récepteur Bluetooth Non connecté Informations sur l'adaptateur Bluetooth diff --git a/lng/lang_Indonesian.lng b/lng/lang_Indonesian.lng index 94984d38c..ae4b57847 100644 --- a/lng/lang_Indonesian.lng +++ b/lng/lang_Indonesian.lng @@ -76,7 +76,7 @@ Mengembalikan Server HDL... Pintasan IGR Warna latar belakang Warna teks -- PS2 - +- PS2 - - SMB Server - Jenis alamat IP Statis diff --git a/lng/lang_Italian.lng b/lng/lang_Italian.lng index 4916907e9..4675702ca 100644 --- a/lng/lang_Italian.lng +++ b/lng/lang_Italian.lng @@ -40,7 +40,7 @@ Annulla Cerchio X Lista Giochi -Impostazioni Gioco +Impostazioni Gioco Rimuovi Impostazioni Rimosse tutte le chiavi per il gioco. Scorrimento @@ -76,7 +76,7 @@ Server HDL in scaricamento dalla memoria... Percorso IGR Colore dello Sfondo Colore Testo -- PS2 - +- PS2 - - Server SMB - Tipo di Indirizzo IP Statico @@ -152,7 +152,7 @@ Percorso ETH Prefisso Backspace Spazio Invio -Modalità +Modalità Slot VMC 1 Slot VMC 2 ID gioco diff --git a/lng/lang_Japanese.lng b/lng/lang_Japanese.lng index 392d2454a..497280bae 100644 --- a/lng/lang_Japanese.lng +++ b/lng/lang_Japanese.lng @@ -158,7 +158,7 @@ VMCスロット2 ゲームID DMAモード V-Sync -モード 1 +モード 1 モード 2 モード 3 モード 4 diff --git a/lng/lang_Laotian.lng b/lng/lang_Laotian.lng index af98feb1a..542edb074 100644 --- a/lng/lang_Laotian.lng +++ b/lng/lang_Laotian.lng @@ -63,7 +63,7 @@ Remove Settings ເປີດໃຊ້ອຸປະກອນເຊື່ອມຕໍ່ ເອີ້ນຄືນໃໝ່ ໂໝດ ເຊື່ອມຕໍ່ອຸປະກອນ USB -ໂໝດ ເຊື່ອມຕໍ່ອຸປະກອນ Hard Disk +ໂໝດ ເຊື່ອມຕໍ່ອຸປະກອນ Hard Disk ໂໝດ ເຊື່ອມຕໍ່ອຸປະກອນ Network ໂໝດ ຕ່າງໆສຳລັບໂປຣແກຣມ ອັດຕະໂນມັດ @@ -111,7 +111,7 @@ Test Changes ວິທີການອ່ານຂໍ້ມູນທີ່ມີທາງເລືອກ Unhook Syscalls ຂ້າມການຫຼິ້ນວິດິໂອ -ປະມວນຜົນ DVD-DL +ປະມວນຜົນ DVD-DL Disable IGR Unused Unused diff --git a/lng/lang_Polish.lng b/lng/lang_Polish.lng index 16a3fc03f..19777471b 100644 --- a/lng/lang_Polish.lng +++ b/lng/lang_Polish.lng @@ -149,7 +149,7 @@ Wybór Koloru Połącz Ponownie Pozostaw puste aby wyświetlić listę udziałów. Prefix Ścieżki ETH -Cofnij +Cofnij Odstęp Enter Tryb diff --git a/lng/lang_Portuguese.lng b/lng/lang_Portuguese.lng index 3a5ecf7bb..c521c445a 100644 --- a/lng/lang_Portuguese.lng +++ b/lng/lang_Portuguese.lng @@ -26,8 +26,8 @@ Cancelar atualização? %d: Erro ao iniciar rede %d: Adaptador de Rede não detetado %d: Não foi possível ligar ao servidor SMB -%d: Não foi possível efetuar login no servidor SMB -%d: Não foi possível abrir a partilha SMB +%d: Não foi possível efetuar login no servidor SMB +%d: Não foi possível abrir a partilha SMB %d: Impossivel listar partilhas SMB %d: Impossivel listar jogos %d: Servidor DHCP indisponivel diff --git a/lng/lang_Portuguese_BR.lng b/lng/lang_Portuguese_BR.lng index 9d2a2b59d..98ef1c861 100644 --- a/lng/lang_Portuguese_BR.lng +++ b/lng/lang_Portuguese_BR.lng @@ -32,7 +32,7 @@ Cancelar as atualizações? %d: Não foi possível listar os jogos %d: O servidor DHCP está indisponível %d: Nenhuma conexão de rede -ON +ON OFF Ok Ok diff --git a/lng/lang_Spanish.lng b/lng/lang_Spanish.lng index e2ed03e9f..435fc4af5 100644 --- a/lng/lang_Spanish.lng +++ b/lng/lang_Spanish.lng @@ -71,7 +71,7 @@ Manual Iniciar servidor HDLDump Iniciando servidor HDLDump... Servidor HDLDump conectado... -Error al iniciar el servidor HDLDump. +Error al iniciar el servidor HDLDump. Cerrando servidor HDLDump... Ruta del IGR Color de fondo diff --git a/lng/lang_Swedish.lng b/lng/lang_Swedish.lng index 931fd6485..391bdf925 100644 --- a/lng/lang_Swedish.lng +++ b/lng/lang_Swedish.lng @@ -205,7 +205,7 @@ Hämta inställningar från nätverket? Modifierade inställningar Hämtade standard Autostart om %i s... -Autostart +Autostart Värde i sekund(er), 0 inaktiverar Autostart PS2 Logo Visas bara när skivavbilden matchar konsolens region diff --git a/lng/lang_Turkish.lng b/lng/lang_Turkish.lng index 325b20b10..09648993b 100644 --- a/lng/lang_Turkish.lng +++ b/lng/lang_Turkish.lng @@ -76,7 +76,7 @@ HDL Sunucu Durduruluyor... IGR yeri Arkaplan rengi Metin rengi -- PS2 - +- PS2 - - SMB Sunucusu - IP adres türü Sabit diff --git a/lng/lang_Vietnamese.lng b/lng/lang_Vietnamese.lng index 3370524d1..7972d726f 100644 --- a/lng/lang_Vietnamese.lng +++ b/lng/lang_Vietnamese.lng @@ -14,7 +14,7 @@ Cài đặt Menu Trò chơi trên USB Trò chơi trên HDD -Trò chơi qua ETH +Trò chơi qua ETH Ứng dụng Chủ đề Ngôn ngữ @@ -24,7 +24,7 @@ Hủy bỏ các cập nhật? %d: Không phát hiện ổ cứng %d: Ổ cứng chưa định dạng %d: Lỗi khởi chạy mạng -%d: Không có adaptor mạng +%d: Không có adaptor mạng %d: Không thể kết nối đến SMB server %d: Không thể đăng nhập vào SMB server %d: Không mở được SMB share @@ -53,7 +53,7 @@ Vui lòng chờ Lỗi khi nạp Game ID Tự động phân loại Lỗi nạp tập tin ngôn ngữ -Ngắt màu Debug +Ngắt màu Debug Không có cần điều khiển, đợi chút... Bật Cover Art Màn hình rộng @@ -62,13 +62,13 @@ Nạp cấu hình Lưu cấu hình Chọn thiết bị lưu trò chơi Làm mới -Chọn USB -Chọn HDD -Chọn ETH +Chọn USB +Chọn HDD +Chọn ETH Hiển thị menu ứng dụng Tự động Thủ công -Khởi chạy máy chủ HDL +Khởi chạy máy chủ HDL Máy chủ HDL khởi chạy... Máy chủ HDL đang chạy... khởi chạy máy chủ HDL thất bại. @@ -96,8 +96,8 @@ IP NetBIOS Truy cập Mục này sẽ bị xóa vĩnh viễn, tiếp tục? -Đổi tên -Xóa +Đổi tên +Xóa Chạy Cài đặt hiển thị Kích hoạt thao tác ghi @@ -143,7 +143,7 @@ Chế độ Video Màu hộp thoại Chọn màu Reset Colors -Thông tin +Thông tin Tùy chỉnh ELF Màu sắc lựa chọn Kết nối lại @@ -156,23 +156,23 @@ Chế độ VMC ở Khe 1 VMC ở Khe 2 Game ID -Chế độ DMA +Chế độ DMA V-Sync -Mode 1 -Mode 2 -Mode 3 -Mode 4 -Mode 5 -Mode 6 -Mode 7 -Mode 8 +Mode 1 +Mode 2 +Mode 3 +Mode 4 +Mode 5 +Mode 6 +Mode 7 +Mode 8 Cấu hình GSM Ethernet Link Mode 100Mbit Full-duplex 100Mbit Half-duplex 10Mbit Full-duplex 10Mbit Half-duplex -Cài đặt GSM +Cài đặt GSM Bật GSM Bật hoặc tắt GSM VMODE @@ -185,10 +185,10 @@ Overscan Overscan Adjustment Bỏ qua FMV Bỏ qua Full Motion Videos -Cài đặt Cheat +Cài đặt Cheat Bật PS2RD Cheat Engine Hãy để PS2RD Cheat Engine vá vào trò chơi -Chế độ PS2RD Cheat Engine +Chế độ PS2RD Cheat Engine Tự động chọn hoặc chọn trò chơi ăn gian Tự động chọn cheats Chọn cheats trò chơi @@ -207,7 +207,7 @@ Tải về mặc định Tự khởi động trong %i s... Tự khởi động đơn vị bằng giây(s), 0 để ngắt tự khởi động -Logo PS2 +Logo PS2 Displayed for a valid disc logo matching the console's region. Cấu hình PADEMU Cài đặt giả lập tay cầm @@ -239,7 +239,7 @@ Yes No Bluetooth adapter phải tương thích với tay cầm DS3/DS4. Bluetooth adapter có thể không hoạt động chính xác với tay cầm DS3/DS4. -Bật giả lập Multitap +Bật giả lập Multitap Bật/tắt giả lập Multitap cho trò chơi đã chọn. Giả lập Multitap tại cổng Chọn cổng giả lập Multitap. diff --git a/modules/debug/ps2link/cmdHandler.c b/modules/debug/ps2link/cmdHandler.c index e450a9a56..7e9dfc1b0 100644 --- a/modules/debug/ps2link/cmdHandler.c +++ b/modules/debug/ps2link/cmdHandler.c @@ -43,7 +43,7 @@ static unsigned int rpc_data[1024 / 4] __attribute__((aligned(16))); int excepscrdump = 1; #define PKO_DMA_DEST ((void *)0x200ff800) -//unsigned int *dma_ptr =(unsigned int*)(0x20100000-2048); +// unsigned int *dma_ptr =(unsigned int*)(0x20100000-2048); ////////////////////////////////////////////////////////////////////////// static void @@ -383,7 +383,7 @@ int cmdHandlerInit(void) thread.option = 0; thread.thread = (void *)cmdThread; thread.stacksize = 0x800; - thread.priority = 60; //0x1e; + thread.priority = 60; // 0x1e; pid = CreateThread(&thread); if (pid >= 0) { diff --git a/modules/debug/ps2link/net_fsys.c b/modules/debug/ps2link/net_fsys.c index f0c6723c6..4fcc6c15b 100644 --- a/modules/debug/ps2link/net_fsys.c +++ b/modules/debug/ps2link/net_fsys.c @@ -28,7 +28,7 @@ static char fsname[] = "host"; //////////////////////////////////////////////////////////////////////// -//static iop_device_t fsys_driver; +// static iop_device_t fsys_driver; /* File desc struct is probably larger than this, but we only * need to access the word @ offset 0x0C (in which we put our identifier) @@ -47,7 +47,7 @@ struct filedesc_info */ static int fsys_sema; static int fsys_pid = 0; -//static iop_device_t fsys_driver; +// static iop_device_t fsys_driver; //////////////////////////////////////////////////////////////////////// static int dummy5() diff --git a/modules/ds34bt/ee/libds34bt.h b/modules/ds34bt/ee/libds34bt.h index 4338769c9..ffd9b9ce2 100644 --- a/modules/ds34bt/ee/libds34bt.h +++ b/modules/ds34bt/ee/libds34bt.h @@ -9,11 +9,11 @@ enum eDS34BTStatus { typedef struct { - u8 hci_ver; //Version of the Current HCI in the BR/EDR Controller - u16 hci_rev; //Revision of the Current HCI in the BR/EDR Controller - u8 lmp_ver; //Version of the Current LMP or PAL in the Controller - u16 mf_name; //Manufacturer Name of the BR/EDR Controller - u16 lmp_subver; //Subversion of the Current LMP or PAL in the Controller + u8 hci_ver; // Version of the Current HCI in the BR/EDR Controller + u16 hci_rev; // Revision of the Current HCI in the BR/EDR Controller + u8 lmp_ver; // Version of the Current LMP or PAL in the Controller + u16 mf_name; // Manufacturer Name of the BR/EDR Controller + u16 lmp_subver; // Subversion of the Current LMP or PAL in the Controller u16 vid; u16 pid; u16 rev; @@ -26,7 +26,7 @@ int ds34bt_init_charging(); int ds34bt_get_status(int port); int ds34bt_get_bdaddr(u8 *bdaddr); int ds34bt_set_rumble(int port, u8 lrum, u8 rrum); -int ds34bt_set_led(int port, u8 *led); //rgb for ds4 +int ds34bt_set_led(int port, u8 *led); // rgb for ds4 int ds34bt_get_data(int port, u8 *data); int ds34bt_reset(); int ds34bt_get_version(hci_information_t *info); diff --git a/modules/ds34bt/iop/ds34bt.c b/modules/ds34bt/iop/ds34bt.c index 5ae19361f..b0ba71d46 100644 --- a/modules/ds34bt/iop/ds34bt.c +++ b/modules/ds34bt/iop/ds34bt.c @@ -270,7 +270,7 @@ static u8 rgbled_patterns[][2][3] = {{0x00, 0x10, 0x10}, {0x00, 0x7F, 0x7F}}, // light cyan/cyan }; -static u8 link_key[] = //for ds4 authorisation +static u8 link_key[] = // for ds4 authorisation { 0x56, 0xE8, 0x81, 0x38, 0x08, 0x06, 0x51, 0x41, 0xC0, 0x7F, 0x12, 0xAA, 0xD9, 0x66, 0x3C, 0xCE}; @@ -337,7 +337,7 @@ static u8 GenuineMacAddress[][3] = {0x00, 0x24, 0x23}, {0x00, 0x22, 0x43}, {0x00, 0x15, 0xAF}, - //fake with AirohaTechnologyCorp's Chip + // fake with AirohaTechnologyCorp's Chip {0x0C, 0xFC, 0x83}}; #define REQ_HCI_OUT (USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_DEVICE) @@ -345,9 +345,9 @@ static u8 GenuineMacAddress[][3] = #define MAX_PADS 2 -static u8 bt_bdaddr[6]; //usb bt adapter mac address -static hci_information_t bt_version; //bt adapter version information -static u8 bt_features[8]; //bt adapter supported features +static u8 bt_bdaddr[6]; // usb bt adapter mac address +static hci_information_t bt_version; // bt adapter version information +static u8 bt_features[8]; // bt adapter supported features static u8 hci_buf[MAX_BUFFER_SIZE] __attribute((aligned(4))) = {0}; static u8 l2cap_buf[MAX_BUFFER_SIZE + 32] __attribute((aligned(4))) = {0}; @@ -424,7 +424,7 @@ static int hci_accept_connection(u8 *bdaddr) hci_cmd_buf[6] = *(bdaddr + 3); hci_cmd_buf[7] = *(bdaddr + 4); hci_cmd_buf[8] = *(bdaddr + 5); - hci_cmd_buf[9] = 0x01; //switch role to (slave = 1 / master = 0) + hci_cmd_buf[9] = 0x01; // switch role to (slave = 1 / master = 0) return HCI_Command(10, hci_cmd_buf); } @@ -459,7 +459,7 @@ static int hci_reject_connection(u8 *bdaddr) hci_cmd_buf[6] = *(bdaddr + 3); hci_cmd_buf[7] = *(bdaddr + 4); hci_cmd_buf[8] = *(bdaddr + 5); - hci_cmd_buf[9] = 0x09; //reason max connection + hci_cmd_buf[9] = 0x09; // reason max connection return HCI_Command(10, hci_cmd_buf); } @@ -642,7 +642,7 @@ static void HCI_event_task(int result) DPRINTF("\t Status = 0x%02X \n", hci_buf[2]); DPRINTF("\t Connection_Handle = 0x%04X \n", (hci_buf[3] | ((hci_buf[4] & 0x0F) << 8))); DPRINTF("\t Reason = 0x%02X \n", hci_buf[5]); - for (i = 0; i < MAX_PADS; i++) { //detect pad + for (i = 0; i < MAX_PADS; i++) { // detect pad if (ds34pad[i].hci_handle == (hci_buf[3] | ((hci_buf[4] & 0x0F) << 8))) { break; } @@ -705,19 +705,19 @@ static void HCI_event_task(int result) } DPRINTF("\n\t Link = 0x%02X \n", hci_buf[11]); DPRINTF("\t Class = 0x%02X 0x%02X 0x%02X \n", hci_buf[8], hci_buf[9], hci_buf[10]); - for (i = 0; i < MAX_PADS; i++) //find free slot + for (i = 0; i < MAX_PADS; i++) // find free slot { if (!pad_status_check(DS34BT_STATE_RUNNING, i) && ds34pad[i].enabled) { if (pad_status_check(DS34BT_STATE_CONNECTED, i)) { - if (pad_status_check(DS34BT_STATE_DISCONNECTING, i)) //if we're waiting for hci disconnect event + if (pad_status_check(DS34BT_STATE_DISCONNECTING, i)) // if we're waiting for hci disconnect event continue; else - hci_disconnect(ds34pad[i].hci_handle); //try to disconnect + hci_disconnect(ds34pad[i].hci_handle); // try to disconnect } break; } } - if (i >= MAX_PADS) //no free slot + if (i >= MAX_PADS) // no free slot { hci_reject_connection(hci_buf + 2); break; @@ -726,8 +726,8 @@ static void HCI_event_task(int result) mips_memcpy(ds34pad[pad].bdaddr, hci_buf + 2, 6); ds34pad[pad].isfake = 0; if (!disable_fake) { - ds34pad[pad].isfake = 1; //fake ds3 - for (i = 0; i < sizeof(GenuineMacAddress) / 3; i++) //check if ds3 is genuine + ds34pad[pad].isfake = 1; // fake ds3 + for (i = 0; i < sizeof(GenuineMacAddress) / 3; i++) // check if ds3 is genuine { if (ds34pad[pad].bdaddr[5] == GenuineMacAddress[i][0] && ds34pad[pad].bdaddr[4] == GenuineMacAddress[i][1] && @@ -903,10 +903,10 @@ static int l2cap_config_request(u16 handle, u8 rxid, u16 dcid) cmd_buf[7] = 0x00; cmd_buf[8] = 0x01; // Config Opt: type = MTU (Maximum Transmission Unit) cmd_buf[9] = 0x02; // Config Opt: length - //cmd_buf[10] = 0x96; // Config Opt: data - //cmd_buf[11] = 0x00; + // cmd_buf[10] = 0x96; // Config Opt: data + // cmd_buf[11] = 0x00; - //this setting disable hid cmd reports from ds3 + // this setting disable hid cmd reports from ds3 cmd_buf[10] = 0xFF; // Config Opt: data cmd_buf[11] = 0xFF; @@ -1153,7 +1153,7 @@ static void l2cap_event_cb(int resultCode, int bytes, void *arg) } } else { if (!ds34pad[ret].isfake && ds34pad[ret].type == DS3) - DelayThread(42000); //fix for some bt adapters + DelayThread(42000); // fix for some bt adapters } } @@ -1223,14 +1223,14 @@ static int hid_LEDRumble(u8 *led, u8 lrum, u8 rrum, int pad) rrum = 0; } - led_buf[3] = 0xFE; //rt - led_buf[4] = rrum; //rp - led_buf[5] = 0xFE; //lt - led_buf[6] = lrum; //lp + led_buf[3] = 0xFE; // rt + led_buf[4] = rrum; // rp + led_buf[5] = 0xFE; // lt + led_buf[6] = lrum; // lp - led_buf[11] = led[0] & 0x7F; //LED Conf + led_buf[11] = led[0] & 0x7F; // LED Conf - if (led[3]) //means charging, so blink + if (led[3]) // means charging, so blink { led_buf[15] = 0x32; led_buf[20] = 0x32; @@ -1244,17 +1244,17 @@ static int hid_LEDRumble(u8 *led, u8 lrum, u8 rrum, int pad) led_buf[0] = HID_THDR_SET_REPORT_OUTPUT; // THdr led_buf[1] = PS4_11_REPORT_ID; // Report ID - led_buf[2] = 0x80; //update rate 1000Hz + led_buf[2] = 0x80; // update rate 1000Hz led_buf[4] = 0xFF; led_buf[7] = rrum; led_buf[8] = lrum; - led_buf[9] = led[0]; //r - led_buf[10] = led[1]; //g - led_buf[11] = led[2]; //b + led_buf[9] = led[0]; // r + led_buf[10] = led[1]; // g + led_buf[11] = led[2]; // b - if (led[3]) //means charging, so blink + if (led[3]) // means charging, so blink { led_buf[12] = 0x80; // Time to flash bright (255 = 2.5 seconds) led_buf[13] = 0x80; // Time to flash dark (255 = 2.5 seconds) @@ -1287,54 +1287,54 @@ static void hid_readReport(u8 *data, int bytes, int pad) ds34pad[pad].data[0] = ~report->ButtonStateL; ds34pad[pad].data[1] = ~report->ButtonStateH; - ds34pad[pad].data[2] = report->RightStickX; //rx - ds34pad[pad].data[3] = report->RightStickY; //ry - ds34pad[pad].data[4] = report->LeftStickX; //lx - ds34pad[pad].data[5] = report->LeftStickY; //ly + ds34pad[pad].data[2] = report->RightStickX; // rx + ds34pad[pad].data[3] = report->RightStickY; // ry + ds34pad[pad].data[4] = report->LeftStickX; // lx + ds34pad[pad].data[5] = report->LeftStickY; // ly if (bytes == 21 && !press_emu) press_emu = 1; - if (press_emu) { //needs emulating pressure buttons - ds34pad[pad].data[6] = report->Right * 255; //right - ds34pad[pad].data[7] = report->Left * 255; //left - ds34pad[pad].data[8] = report->Up * 255; //up - ds34pad[pad].data[9] = report->Down * 255; //down + if (press_emu) { // needs emulating pressure buttons + ds34pad[pad].data[6] = report->Right * 255; // right + ds34pad[pad].data[7] = report->Left * 255; // left + ds34pad[pad].data[8] = report->Up * 255; // up + ds34pad[pad].data[9] = report->Down * 255; // down - ds34pad[pad].data[10] = report->Triangle * 255; //triangle - ds34pad[pad].data[11] = report->Circle * 255; //circle - ds34pad[pad].data[12] = report->Cross * 255; //cross - ds34pad[pad].data[13] = report->Square * 255; //square + ds34pad[pad].data[10] = report->Triangle * 255; // triangle + ds34pad[pad].data[11] = report->Circle * 255; // circle + ds34pad[pad].data[12] = report->Cross * 255; // cross + ds34pad[pad].data[13] = report->Square * 255; // square - ds34pad[pad].data[14] = report->L1 * 255; //L1 - ds34pad[pad].data[15] = report->R1 * 255; //R1 - ds34pad[pad].data[16] = report->L2 * 255; //L2 - ds34pad[pad].data[17] = report->R2 * 255; //R2 + ds34pad[pad].data[14] = report->L1 * 255; // L1 + ds34pad[pad].data[15] = report->R1 * 255; // R1 + ds34pad[pad].data[16] = report->L2 * 255; // L2 + ds34pad[pad].data[17] = report->R2 * 255; // R2 report->Power = 0x05; } else { - ds34pad[pad].data[6] = report->PressureRight; //right - ds34pad[pad].data[7] = report->PressureLeft; //left - ds34pad[pad].data[8] = report->PressureUp; //up - ds34pad[pad].data[9] = report->PressureDown; //down - - ds34pad[pad].data[10] = report->PressureTriangle; //triangle - ds34pad[pad].data[11] = report->PressureCircle; //circle - ds34pad[pad].data[12] = report->PressureCross; //cross - ds34pad[pad].data[13] = report->PressureSquare; //square - - ds34pad[pad].data[14] = report->PressureL1; //L1 - ds34pad[pad].data[15] = report->PressureR1; //R1 - ds34pad[pad].data[16] = report->PressureL2; //L2 - ds34pad[pad].data[17] = report->PressureR2; //R2 + ds34pad[pad].data[6] = report->PressureRight; // right + ds34pad[pad].data[7] = report->PressureLeft; // left + ds34pad[pad].data[8] = report->PressureUp; // up + ds34pad[pad].data[9] = report->PressureDown; // down + + ds34pad[pad].data[10] = report->PressureTriangle; // triangle + ds34pad[pad].data[11] = report->PressureCircle; // circle + ds34pad[pad].data[12] = report->PressureCross; // cross + ds34pad[pad].data[13] = report->PressureSquare; // square + + ds34pad[pad].data[14] = report->PressureL1; // L1 + ds34pad[pad].data[15] = report->PressureR1; // R1 + ds34pad[pad].data[16] = report->PressureL2; // L2 + ds34pad[pad].data[17] = report->PressureR2; // R2 } - if (report->PSButtonState && report->Power != 0xEE) //display battery level + if (report->PSButtonState && report->Power != 0xEE) // display battery level ds34pad[pad].oldled[0] = power_level[report->Power]; else ds34pad[pad].oldled[0] = led_patterns[pad][1]; - if (report->Power == 0xEE) //charging + if (report->Power == 0xEE) // charging ds34pad[pad].oldled[3] = 1; else ds34pad[pad].oldled[3] = 0; @@ -1401,27 +1401,27 @@ static void hid_readReport(u8 *data, int bytes, int pad) ds34pad[pad].data[0] = ~(report->Share | report->L3 << 1 | report->R3 << 2 | report->Option << 3 | up << 4 | right << 5 | down << 6 | left << 7); ds34pad[pad].data[1] = ~(report->L2 | report->R2 << 1 | report->L1 << 2 | report->R1 << 3 | report->Triangle << 4 | report->Circle << 5 | report->Cross << 6 | report->Square << 7); - ds34pad[pad].data[2] = report->RightStickX; //rx - ds34pad[pad].data[3] = report->RightStickY; //ry - ds34pad[pad].data[4] = report->LeftStickX; //lx - ds34pad[pad].data[5] = report->LeftStickY; //ly + ds34pad[pad].data[2] = report->RightStickX; // rx + ds34pad[pad].data[3] = report->RightStickY; // ry + ds34pad[pad].data[4] = report->LeftStickX; // lx + ds34pad[pad].data[5] = report->LeftStickY; // ly - ds34pad[pad].data[6] = right * 255; //right - ds34pad[pad].data[7] = left * 255; //left - ds34pad[pad].data[8] = up * 255; //up - ds34pad[pad].data[9] = down * 255; //down + ds34pad[pad].data[6] = right * 255; // right + ds34pad[pad].data[7] = left * 255; // left + ds34pad[pad].data[8] = up * 255; // up + ds34pad[pad].data[9] = down * 255; // down - ds34pad[pad].data[10] = report->Triangle * 255; //triangle - ds34pad[pad].data[11] = report->Circle * 255; //circle - ds34pad[pad].data[12] = report->Cross * 255; //cross - ds34pad[pad].data[13] = report->Square * 255; //square + ds34pad[pad].data[10] = report->Triangle * 255; // triangle + ds34pad[pad].data[11] = report->Circle * 255; // circle + ds34pad[pad].data[12] = report->Cross * 255; // cross + ds34pad[pad].data[13] = report->Square * 255; // square - ds34pad[pad].data[14] = report->L1 * 255; //L1 - ds34pad[pad].data[15] = report->R1 * 255; //R1 - ds34pad[pad].data[16] = report->PressureL2; //L2 - ds34pad[pad].data[17] = report->PressureR2; //R2 + ds34pad[pad].data[14] = report->L1 * 255; // L1 + ds34pad[pad].data[15] = report->R1 * 255; // R1 + ds34pad[pad].data[16] = report->PressureL2; // L2 + ds34pad[pad].data[17] = report->PressureR2; // R2 - if (report->PSButton) { //display battery level + if (report->PSButton) { // display battery level ds34pad[pad].oldled[0] = report->Battery; ds34pad[pad].oldled[1] = 0; ds34pad[pad].oldled[2] = 0; @@ -1431,7 +1431,7 @@ static void hid_readReport(u8 *data, int bytes, int pad) ds34pad[pad].oldled[2] = rgbled_patterns[pad][1][2]; } - if (report->Power != 0xB && report->Usb_plugged) //charging + if (report->Power != 0xB && report->Usb_plugged) // charging ds34pad[pad].oldled[3] = 1; else ds34pad[pad].oldled[3] = 0; diff --git a/modules/ds34bt/iop/ds34bt.h b/modules/ds34bt/iop/ds34bt.h index 80eb9de96..91a4a149a 100644 --- a/modules/ds34bt/iop/ds34bt.h +++ b/modules/ds34bt/iop/ds34bt.h @@ -36,7 +36,7 @@ typedef struct typedef struct { - u16 hci_handle; //hci connection handle + u16 hci_handle; // hci connection handle u16 control_scid; // Channel endpoint on command destination u16 interrupt_scid; // Channel endpoint on interrupt destination u8 hci_state; // current state of bluetooth HCI connection @@ -44,8 +44,8 @@ typedef struct u8 enabled; u8 status; u8 isfake; - u8 type; //0 - ds3, 1 - ds4 - u8 oldled[4]; //rgb for ds4 and blink + u8 type; // 0 - ds3, 1 - ds4 + u8 oldled[4]; // rgb for ds4 and blink u8 lrum; u8 rrum; u8 update_rum; @@ -54,11 +54,11 @@ typedef struct typedef struct { - u8 hci_ver; //Version of the Current HCI in the BR/EDR Controller - u16 hci_rev; //Revision of the Current HCI in the BR/EDR Controller - u8 lmp_ver; //Version of the Current LMP or PAL in the Controller - u16 mf_name; //Manufacturer Name of the BR/EDR Controller - u16 lmp_subver; //Subversion of the Current LMP or PAL in the Controller + u8 hci_ver; // Version of the Current HCI in the BR/EDR Controller + u16 hci_rev; // Revision of the Current HCI in the BR/EDR Controller + u8 lmp_ver; // Version of the Current LMP or PAL in the Controller + u16 mf_name; // Manufacturer Name of the BR/EDR Controller + u16 lmp_subver; // Subversion of the Current LMP or PAL in the Controller u16 vid; u16 pid; u16 rev; @@ -135,7 +135,7 @@ enum eHCI { HCI_EVENT_LINK_KEY_REQUEST = 0x17, HCI_EVENT_CHANGED_CONNECTION_TYPE = 0x1D, HCI_EVENT_PAGE_SR_CHANGED = 0x20, - HCI_EVENT_MAX_SLOT_CHANGE = 0x1B, //Max Slots Change event + HCI_EVENT_MAX_SLOT_CHANGE = 0x1B, // Max Slots Change event /* HCI event flags for hci_event_flag */ HCI_FLAG_COMMAND_COMPLETE = 0x0001, @@ -198,25 +198,25 @@ enum eL2CAP { L2CAP_CMD_DISCONNECT_RESPONSE = 0x07, /* HCI ACL Data Packet - * - * buf[0] buf[1] buf[2] buf[3] - * 0 4 8 11 12 16 24 31 MSB - * .-+-+-+-+-+-+-+-|-+-+-+-|-+-|-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-. - * | HCI Handle |PB |BC | Data Total Length | HCI ACL Data Packet - * .-+-+-+-+-+-+-+-|-+-+-+-|-+-|-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-. - * - * buf[4] buf[5] buf[6] buf[7] - * 0 8 16 31 MSB - * .-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-. - * | Length | Channel ID | Basic L2CAP header - * .-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-. - * - * buf[8] buf[9] buf[10] buf[11] - * 0 8 16 31 MSB - * .-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-. - * | Code | Identifier | Length | Control frame (C-frame) - * .-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-. (signaling packet format) - */ + * + * buf[0] buf[1] buf[2] buf[3] + * 0 4 8 11 12 16 24 31 MSB + * .-+-+-+-+-+-+-+-|-+-+-+-|-+-|-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-. + * | HCI Handle |PB |BC | Data Total Length | HCI ACL Data Packet + * .-+-+-+-+-+-+-+-|-+-+-+-|-+-|-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-. + * + * buf[4] buf[5] buf[6] buf[7] + * 0 8 16 31 MSB + * .-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-. + * | Length | Channel ID | Basic L2CAP header + * .-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-. + * + * buf[8] buf[9] buf[10] buf[11] + * 0 8 16 31 MSB + * .-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-. + * | Code | Identifier | Length | Control frame (C-frame) + * .-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-. (signaling packet format) + */ // }}} }; diff --git a/modules/ds34usb/iop/ds34usb.c b/modules/ds34usb/iop/ds34usb.c index e9f4e4110..bf8faaef2 100644 --- a/modules/ds34usb/iop/ds34usb.c +++ b/modules/ds34usb/iop/ds34usb.c @@ -54,7 +54,7 @@ static u8 rgbled_patterns[][2][3] = {{0x00, 0x10, 0x10}, {0x00, 0x7F, 0x7F}}, // light cyan/cyan }; -static u8 link_key[] = //for ds4 authorisation +static u8 link_key[] = // for ds4 authorisation { 0x56, 0xE8, 0x81, 0x38, 0x08, 0x06, 0x51, 0x41, 0xC0, 0x7F, 0x12, 0xAA, 0xD9, 0x66, 0x3C, 0xCE}; @@ -208,7 +208,7 @@ static void usb_data_cb(int resultCode, int bytes, void *arg) { int pad = (int)arg; - //DPRINTF("DS34USB: usb_data_cb: res %d, bytes %d, arg %p \n", resultCode, bytes, arg); + // DPRINTF("DS34USB: usb_data_cb: res %d, bytes %d, arg %p \n", resultCode, bytes, arg); usb_resulCode = resultCode; @@ -219,7 +219,7 @@ static void usb_cmd_cb(int resultCode, int bytes, void *arg) { int pad = (int)arg; - //DPRINTF("DS34USB: usb_cmd_cb: res %d, bytes %d, arg %p \n", resultCode, bytes, arg); + // DPRINTF("DS34USB: usb_cmd_cb: res %d, bytes %d, arg %p \n", resultCode, bytes, arg); SignalSema(ds34pad[pad].cmd_sema); } @@ -275,32 +275,32 @@ static void readReport(u8 *data, int pad) ds34pad[pad].data[0] = ~report->ButtonStateL; ds34pad[pad].data[1] = ~report->ButtonStateH; - ds34pad[pad].data[2] = report->RightStickX; //rx - ds34pad[pad].data[3] = report->RightStickY; //ry - ds34pad[pad].data[4] = report->LeftStickX; //lx - ds34pad[pad].data[5] = report->LeftStickY; //ly + ds34pad[pad].data[2] = report->RightStickX; // rx + ds34pad[pad].data[3] = report->RightStickY; // ry + ds34pad[pad].data[4] = report->LeftStickX; // lx + ds34pad[pad].data[5] = report->LeftStickY; // ly - ds34pad[pad].data[6] = report->PressureRight; //right - ds34pad[pad].data[7] = report->PressureLeft; //left - ds34pad[pad].data[8] = report->PressureUp; //up - ds34pad[pad].data[9] = report->PressureDown; //down + ds34pad[pad].data[6] = report->PressureRight; // right + ds34pad[pad].data[7] = report->PressureLeft; // left + ds34pad[pad].data[8] = report->PressureUp; // up + ds34pad[pad].data[9] = report->PressureDown; // down - ds34pad[pad].data[10] = report->PressureTriangle; //triangle - ds34pad[pad].data[11] = report->PressureCircle; //circle - ds34pad[pad].data[12] = report->PressureCross; //cross - ds34pad[pad].data[13] = report->PressureSquare; //square + ds34pad[pad].data[10] = report->PressureTriangle; // triangle + ds34pad[pad].data[11] = report->PressureCircle; // circle + ds34pad[pad].data[12] = report->PressureCross; // cross + ds34pad[pad].data[13] = report->PressureSquare; // square - ds34pad[pad].data[14] = report->PressureL1; //L1 - ds34pad[pad].data[15] = report->PressureR1; //R1 - ds34pad[pad].data[16] = report->PressureL2; //L2 - ds34pad[pad].data[17] = report->PressureR2; //R2 + ds34pad[pad].data[14] = report->PressureL1; // L1 + ds34pad[pad].data[15] = report->PressureR1; // R1 + ds34pad[pad].data[16] = report->PressureL2; // L2 + ds34pad[pad].data[17] = report->PressureR2; // R2 - if (report->PSButtonState && report->Power != 0xEE) //display battery level + if (report->PSButtonState && report->Power != 0xEE) // display battery level ds34pad[pad].oldled[0] = power_level[report->Power]; else ds34pad[pad].oldled[0] = led_patterns[pad][1]; - if (report->Power == 0xEE) //charging + if (report->Power == 0xEE) // charging ds34pad[pad].oldled[3] = 1; else ds34pad[pad].oldled[3] = 0; @@ -367,27 +367,27 @@ static void readReport(u8 *data, int pad) ds34pad[pad].data[0] = ~(report->Share | report->L3 << 1 | report->R3 << 2 | report->Option << 3 | up << 4 | right << 5 | down << 6 | left << 7); ds34pad[pad].data[1] = ~(report->L2 | report->R2 << 1 | report->L1 << 2 | report->R1 << 3 | report->Triangle << 4 | report->Circle << 5 | report->Cross << 6 | report->Square << 7); - ds34pad[pad].data[2] = report->RightStickX; //rx - ds34pad[pad].data[3] = report->RightStickY; //ry - ds34pad[pad].data[4] = report->LeftStickX; //lx - ds34pad[pad].data[5] = report->LeftStickY; //ly + ds34pad[pad].data[2] = report->RightStickX; // rx + ds34pad[pad].data[3] = report->RightStickY; // ry + ds34pad[pad].data[4] = report->LeftStickX; // lx + ds34pad[pad].data[5] = report->LeftStickY; // ly - ds34pad[pad].data[6] = right * 255; //right - ds34pad[pad].data[7] = left * 255; //left - ds34pad[pad].data[8] = up * 255; //up - ds34pad[pad].data[9] = down * 255; //down + ds34pad[pad].data[6] = right * 255; // right + ds34pad[pad].data[7] = left * 255; // left + ds34pad[pad].data[8] = up * 255; // up + ds34pad[pad].data[9] = down * 255; // down - ds34pad[pad].data[10] = report->Triangle * 255; //triangle - ds34pad[pad].data[11] = report->Circle * 255; //circle - ds34pad[pad].data[12] = report->Cross * 255; //cross - ds34pad[pad].data[13] = report->Square * 255; //square + ds34pad[pad].data[10] = report->Triangle * 255; // triangle + ds34pad[pad].data[11] = report->Circle * 255; // circle + ds34pad[pad].data[12] = report->Cross * 255; // cross + ds34pad[pad].data[13] = report->Square * 255; // square - ds34pad[pad].data[14] = report->L1 * 255; //L1 - ds34pad[pad].data[15] = report->R1 * 255; //R1 - ds34pad[pad].data[16] = report->PressureL2; //L2 - ds34pad[pad].data[17] = report->PressureR2; //R2 + ds34pad[pad].data[14] = report->L1 * 255; // L1 + ds34pad[pad].data[15] = report->R1 * 255; // R1 + ds34pad[pad].data[16] = report->PressureL2; // L2 + ds34pad[pad].data[17] = report->PressureR2; // R2 - if (report->PSButton) { //display battery level + if (report->PSButton) { // display battery level ds34pad[pad].oldled[0] = report->Battery; ds34pad[pad].oldled[1] = 0; ds34pad[pad].oldled[2] = 0; @@ -397,7 +397,7 @@ static void readReport(u8 *data, int pad) ds34pad[pad].oldled[2] = rgbled_patterns[pad][1][2]; } - if (report->Power != 0xB && report->Usb_plugged) //charging + if (report->Power != 0xB && report->Usb_plugged) // charging ds34pad[pad].oldled[3] = 1; else ds34pad[pad].oldled[3] = 0; @@ -416,14 +416,14 @@ static int LEDRumble(u8 *led, u8 lrum, u8 rrum, int pad) if (ds34pad[pad].type == DS3) { mips_memcpy(usb_buf, output_01_report, sizeof(output_01_report)); - usb_buf[1] = 0xFE; //rt - usb_buf[2] = rrum; //rp - usb_buf[3] = 0xFE; //lt - usb_buf[4] = lrum; //lp + usb_buf[1] = 0xFE; // rt + usb_buf[2] = rrum; // rp + usb_buf[3] = 0xFE; // lt + usb_buf[4] = lrum; // lp - usb_buf[9] = led[0] & 0x7F; //LED Conf + usb_buf[9] = led[0] & 0x7F; // LED Conf - if (led[3]) { //means charging, so blink + if (led[3]) { // means charging, so blink usb_buf[13] = 0x32; usb_buf[18] = 0x32; usb_buf[23] = 0x32; @@ -435,14 +435,14 @@ static int LEDRumble(u8 *led, u8 lrum, u8 rrum, int pad) usb_buf[0] = 0x05; usb_buf[1] = 0xFF; - usb_buf[4] = rrum; //ds4 has full control + usb_buf[4] = rrum; // ds4 has full control usb_buf[5] = lrum; - usb_buf[6] = led[0]; //r - usb_buf[7] = led[1]; //g - usb_buf[8] = led[2]; //b + usb_buf[6] = led[0]; // r + usb_buf[7] = led[1]; // g + usb_buf[8] = led[2]; // b - if (led[3]) { //means charging, so blink + if (led[3]) { // means charging, so blink usb_buf[9] = 0x80; // Time to flash bright (255 = 2.5 seconds) usb_buf[10] = 0x80; // Time to flash dark (255 = 2.5 seconds) } diff --git a/modules/ds34usb/iop/ds34usb.h b/modules/ds34usb/iop/ds34usb.h index 670e1fdf6..46fcf03c0 100644 --- a/modules/ds34usb/iop/ds34usb.h +++ b/modules/ds34usb/iop/ds34usb.h @@ -26,7 +26,7 @@ typedef struct _usb_ds34 u8 lrum; u8 rrum; u8 update_rum; - u8 oldled[4]; //rgb for ds4 and blink + u8 oldled[4]; // rgb for ds4 and blink u8 data[18]; u8 type; } ds34usb_device; diff --git a/modules/hdd/xhdd/xatad.c b/modules/hdd/xhdd/xatad.c index ae1dd079e..fa83b1577 100644 --- a/modules/hdd/xhdd/xatad.c +++ b/modules/hdd/xhdd/xatad.c @@ -64,7 +64,7 @@ int ata_device_set_transfer_mode(int device, int type, int mode) if (res) return res; - //Note: PIO is not supported by ata_device_sector_io. + // Note: PIO is not supported by ata_device_sector_io. switch (type) { case ATA_XFER_MODE_MDMA: ata_multiword_dma_mode(mode); diff --git a/modules/iopcore/common/cdvd_config.h b/modules/iopcore/common/cdvd_config.h index 82fc4f89e..e001b3dd1 100644 --- a/modules/iopcore/common/cdvd_config.h +++ b/modules/iopcore/common/cdvd_config.h @@ -34,7 +34,7 @@ struct cdvdman_settings_smb { struct { - //Please keep the string lengths in-sync with the limits within the UI. + // Please keep the string lengths in-sync with the limits within the UI. char smb_ip[16]; u16 smb_port; char smb_share[32]; diff --git a/modules/iopcore/imgdrv/imgdrv.c b/modules/iopcore/imgdrv/imgdrv.c index 264c2c996..704ffabe9 100644 --- a/modules/iopcore/imgdrv/imgdrv.c +++ b/modules/iopcore/imgdrv/imgdrv.c @@ -49,23 +49,23 @@ typedef struct _iop_device_ops_tm iop_device_ops_t my_device_ops = { - dummy_fs, //init - dummy_fs, //deinit - NULL, //dummy_fs,//format - dummy_fs, //open_fs,//open - dummy_fs, //close_fs,//close - read_fs, //read - NULL, //dummy_fs,//write - lseek_fs, //lseek + dummy_fs, // init + dummy_fs, // deinit + NULL, // dummy_fs,//format + dummy_fs, // open_fs,//open + dummy_fs, // close_fs,//close + read_fs, // read + NULL, // dummy_fs,//write + lseek_fs, // lseek /*dummy_fs,//ioctl - dummy_fs,//remove - dummy_fs,//mkdir - dummy_fs,//rmdir - dummy_fs,//dopen - dummy_fs,//dclose - dummy_fs,//dread - dummy_fs,//getstat - dummy_fs,//chstat*/ + dummy_fs,//remove + dummy_fs,//mkdir + dummy_fs,//rmdir + dummy_fs,//dopen + dummy_fs,//dclose + dummy_fs,//dread + dummy_fs,//getstat + dummy_fs,//chstat*/ }; const char name[] = "img"; @@ -78,7 +78,7 @@ iop_device_t my_device = { int _start(int argc, char **argv) { - //DelDrv("img"); + // DelDrv("img"); AddDrv((iop_device_t *)&my_device); return MODULE_RESIDENT_END; diff --git a/modules/iopcore/patches/apemodpatch/main.c b/modules/iopcore/patches/apemodpatch/main.c index ddadec41a..05354ad1a 100644 --- a/modules/iopcore/patches/apemodpatch/main.c +++ b/modules/iopcore/patches/apemodpatch/main.c @@ -22,7 +22,7 @@ static int evFlag; #define EV_TIMEOUT 2 static int _lock(void) -{ //Do polling, to keep the original behaviour. +{ // Do polling, to keep the original behaviour. return PollSema(lockSema); } @@ -42,7 +42,7 @@ static void _WaitEvent(void) iop_sys_clock_t sys_clock; u32 bits; - sys_clock.lo = 368640; //10000us = 36.864MHz * 1000 * 1000 / 1000 * 10, as per the original timeout. + sys_clock.lo = 368640; // 10000us = 36.864MHz * 1000 * 1000 / 1000 * 10, as per the original timeout. sys_clock.hi = 0; SetAlarm(&sys_clock, &EventTimeoutCb, (void *)evFlag); WaitEventFlag(evFlag, EV_ACTIVITY | EV_TIMEOUT, WEF_OR | WEF_CLEAR, &bits); @@ -76,7 +76,7 @@ int _start(int argc, char **argv) lc = GetLoadcoreInternalData(); - //Locate the specified module. + // Locate the specified module. m = lc->image_info; while (m != NULL) { if (modId == m->id) @@ -101,12 +101,12 @@ int _start(int argc, char **argv) /* Apply patch on module. */ *(vu32 *)(m->text_start + 0x00003bf8) = JAL((u32)&_lock); *(vu32 *)(m->text_start + 0x00003bfc) = 0x00000000; - *(vu32 *)(m->text_start + 0x00003c04) = 0x14400046; //bnez $v0, exit + *(vu32 *)(m->text_start + 0x00003c04) = 0x14400046; // bnez $v0, exit *(vu32 *)(m->text_start + 0x00003c0c) = 0x00000000; *(vu32 *)(m->text_start + 0x00003d18) = JAL((u32)&_unlock); *(vu32 *)(m->text_start + 0x00003d1c) = 0x00000000; - //Replace event system that used iReleaseWaitThread() - which could break other functions that use a semaphore. + // Replace event system that used iReleaseWaitThread() - which could break other functions that use a semaphore. *(vu32 *)(m->text_start + 0x00000348) = JAL((u32)&_WaitEvent); *(vu32 *)(m->text_start + 0x00000ac8) = JAL((u32)&_iSetEvent); *(vu32 *)(m->text_start + 0x00000bd0) = JAL((u32)&_iSetEvent); diff --git a/modules/iopcore/patches/cleareffects/main.c b/modules/iopcore/patches/cleareffects/main.c index ab3390fe5..3beedfeee 100644 --- a/modules/iopcore/patches/cleareffects/main.c +++ b/modules/iopcore/patches/cleareffects/main.c @@ -1,7 +1,7 @@ /** - * Patch for games (e.g. Half Life) that have the SPU2 Digital Effects function inadvertently enabled with old settings from previously-run software. - * Solve this problem by disabling sound effects via sceSdSetEfectAttr(), which will clear the necessary registers. - */ + * Patch for games (e.g. Half Life) that have the SPU2 Digital Effects function inadvertently enabled with old settings from previously-run software. + * Solve this problem by disabling sound effects via sceSdSetEfectAttr(), which will clear the necessary registers. + */ #include #include diff --git a/modules/iopcore/patches/f2techioppatch/main.c b/modules/iopcore/patches/f2techioppatch/main.c index de542bc11..635a10de6 100644 --- a/modules/iopcore/patches/f2techioppatch/main.c +++ b/modules/iopcore/patches/f2techioppatch/main.c @@ -33,7 +33,7 @@ int _start(int argc, char **argv) lc = GetLoadcoreInternalData(); - //Locate the specified module. + // Locate the specified module. m = lc->image_info; while (m != NULL) { if (modId == m->id) @@ -42,9 +42,9 @@ int _start(int argc, char **argv) m = m->next; } - if (m != NULL) { //Increase size of CompBuffers, to allow for 17 sectors to be stored. - *(u16 *)(m->text_start + 0x000016b8) = 0x8800; //Original: 0x8000 - *(u16 *)(m->text_start + 0x000016bc) = 0x8800; //Original: 0x8000 + if (m != NULL) { // Increase size of CompBuffers, to allow for 17 sectors to be stored. + *(u16 *)(m->text_start + 0x000016b8) = 0x8800; // Original: 0x8000 + *(u16 *)(m->text_start + 0x000016bc) = 0x8800; // Original: 0x8000 StartModule(modId, "", 0, NULL, &modRet); diff --git a/modules/iopcore/patches/iremsndpatch/main.c b/modules/iopcore/patches/iremsndpatch/main.c index fb568ec71..7b9e9d7ab 100644 --- a/modules/iopcore/patches/iremsndpatch/main.c +++ b/modules/iopcore/patches/iremsndpatch/main.c @@ -30,7 +30,7 @@ static int *tickThreadId; static int lockSema; static int postStopSeseqTick(void) -{ //Even if the atick thread waits on the locking semaphore, it will wake up immediately when the RPC thread unlocks the critical section. +{ // Even if the atick thread waits on the locking semaphore, it will wake up immediately when the RPC thread unlocks the critical section. WakeupThread(*tickThreadId); return 1; } @@ -63,7 +63,7 @@ int _start(int argc, char **argv) lc = GetLoadcoreInternalData(); - //Locate the specified module. + // Locate the specified module. m = lc->image_info; while (m != NULL) { if (modId == m->id) @@ -80,31 +80,31 @@ int _start(int argc, char **argv) lockSema = CreateSema(&sema); - //Generate pointer to the threadId variable. + // Generate pointer to the threadId variable. hi16 = *(vu16 *)(m->text_start + 0x00000ac0); lo16 = *(volatile s16 *)(m->text_start + 0x00000ac4); tickThreadId = (int *)(((u32)hi16 << 16) + lo16); - //Apply patch on module. The module has not been initialized yet and has no running threads. - //sndIopAtick + // Apply patch on module. The module has not been initialized yet and has no running threads. + // sndIopAtick *(vu32 *)(m->text_start + 0x00000418) = JAL((u32)&_lock); *(vu32 *)(m->text_start + 0x000018f4) = JMP((u32)&_unlock); - //sndIopRpcFunc + // sndIopRpcFunc *(vu32 *)(m->text_start + 0x00000d58) = JAL((u32)&_lock_RpcFunc); - *(vu32 *)(m->text_start + 0x00000d64) = 0x00000000; //nop - *(vu32 *)(m->text_start + 0x00000d80) = 0xac233d24; //sw v1, $3d24(at) - Replace instruction at 0xd64. + *(vu32 *)(m->text_start + 0x00000d64) = 0x00000000; // nop + *(vu32 *)(m->text_start + 0x00000d80) = 0xac233d24; // sw v1, $3d24(at) - Replace instruction at 0xd64. *(vu32 *)(m->text_start + 0x00000f54) = JAL((u32)&_unlock); - *(vu32 *)(m->text_start + 0x00000f58) = 0x00000000; //nop + *(vu32 *)(m->text_start + 0x00000f58) = 0x00000000; // nop - //sndIopSesqCmd_STOPSE + // sndIopSesqCmd_STOPSE *(vu32 *)(m->text_start + 0x00001f4c) = JMP((u32)&postStopSeseqTick); - //sndIopSesqCmd_STOPSEID + // sndIopSesqCmd_STOPSEID *(vu32 *)(m->text_start + 0x00001ff8) = JMP((u32)&postStopSeseqTick); - //sndIopCmd_STOPALL + // sndIopCmd_STOPALL *(vu32 *)(m->text_start + 0x00000c30) = JMP((u32)&postStopSeseqTick); - FlushIcache(); //Flush instruction cache as instructions were modified. + FlushIcache(); // Flush instruction cache as instructions were modified. return MODULE_RESIDENT_END; } diff --git a/modules/iopcore/resetspu/resetspu.c b/modules/iopcore/resetspu/resetspu.c index 0fa7f260d..64d4a43fe 100644 --- a/modules/iopcore/resetspu/resetspu.c +++ b/modules/iopcore/resetspu/resetspu.c @@ -1,6 +1,6 @@ /* resetspu.c Open PS2 Loader - + Copyright 2009-2010, Ifcaro, jimmikaelkael & Polo Copyright 2006-2008 Polo Licenced under Academic Free License version 3.0 diff --git a/modules/iopcore/udnl-t300/README.txt b/modules/iopcore/udnl-t300/README.txt index 2ece4172c..5b8b662f7 100644 --- a/modules/iopcore/udnl-t300/README.txt +++ b/modules/iopcore/udnl-t300/README.txt @@ -1,4 +1,4 @@ -UDNL (Updater) module (TOOL SDK v3.00) - 2014/08/03 +UDNL (Updater) module (TOOL SDK v3.00) - 2014/08/03 ---------------------------------------------------------- UDNL is a updater module, which is used for the final phase (Boot mode 3) within the IOP reset cycle. It is responsible for loading the requested IOPRP image into RAM and kickstarting the final IOP bootup sequence. @@ -21,7 +21,7 @@ Comment out FULL_UDNL within udnl.c to build a UDNL module that works like the S Syntax: ------- - UDNL ... [-v] [-nobusini] [-nocacheini] + UDNL ... [-v] [-nobusini] [-nocacheini] UDNL accepts multiple IORP images in the command passed to it. It'll scan through all the specified images to locate the newest version of each module that is specified in IOPBTCONF (which acts like CONFIG.SYS of MS-DOs, for those who know what that is), and will build a list of modules to load. @@ -30,23 +30,23 @@ It will look for modules from among the list of specified IOPRP images, in the o UDNL may also have a valid IOPRP image embedded within it, and it will automatically use that IOPRP image. The Sony ROM UDNL module requires that the programmer does NOT specify any commands for it if an IOPRP image is embedded within it (See below). This limitation does not exist for this clone. -v: - The -v command is elusive; although recognized by UDNL, no code actually reacts to its presence. - (It's most likely a verbosity level control though) + The -v command is elusive; although recognized by UDNL, no code actually reacts to its presence. + (It's most likely a verbosity level control though) -nobusini (or just -nb): - SSBUS initialization is skipped. + SSBUS initialization is skipped. -nocacheini (or just -nc): - Cache initialization is skipped. + Cache initialization is skipped. IOPBTCONF files can include other IOPBTCONF files, although this has some limitations (see below). IOPBTCONF file syntax: ---------------------- -@
- The address at which to start loading modules from. -!include - Includes the specified file. -!addr
- Includes a module that exists at the specified memory address. -# - The '#' symbol marks the whole line as a comment. +@
- The address at which to start loading modules from. +!include - Includes the specified file. +!addr
- Includes a module that exists at the specified memory address. +# - The '#' symbol marks the whole line as a comment. Lines beginning with other characters are automatically assumed to be the filenames of modules that are to be loaded. @@ -54,11 +54,11 @@ Note: SYSMEM and LOADCORE have to be the first and second modules to be loaded r Differences between the ROM UDNL module of retail consoles and the TOOL unit's: ------------------------------------------------------------------------------- - TOOL Retail -Arguments More options Only "-v" is recognized -Device checklist Whitelist + encrypted Blacklist -Startup sequence Within kernel mode With only interrupts disabled (With CpuDisableIntr) -Module relocation Done by separate function Code is inline + TOOL Retail +Arguments More options Only "-v" is recognized +Device checklist Whitelist + encrypted Blacklist +Startup sequence Within kernel mode With only interrupts disabled (With CpuDisableIntr) +Module relocation Done by separate function Code is inline Known bugs and limitations: --------------------------- @@ -67,14 +67,14 @@ Known bugs and limitations: 3. Certain devices cannot be used for storing IOPRP images, due to an internal blacklist (Refer to isIllegalBootDevice()). Blacklisted devices are "mc", "hd", "net" and "dev". 4. When IOPBTCONF files include another IOPBTCONF file that is being parsed and its modules are located, the modules will only be scanned from starting with the IOPRP image that contains the IOPBTCONF that is being parsed (e.g. if the 2nd IOPRP image contains a IOPBTCONF file that is included by another file, the modules listed in the IOPBTCONF file will only be scanned for stating with the 2nd IOPRP image. Files in the first IOPRP image will be IGNORED). Hence, keep the order of your IOPRP images/commands in mind! 5. The design for loading modules from an embedded IOPRP image of the boot ROM UDNL module is flawed. Its design seemed to be to allow the programmer to use either an embedded IOPRP image OR IOPRP images that are stored as accessible files. If the embedded IOPRP image is to be used, it would just get its reset data structure to point to the embedded IOPRP image as the buffer containing the IOPRP images... but that causes the reset data structure itself to become unprotected during the IOP bootup sequence and will possibly cause corruption under certain conditions. - The Sony DVD player UDNL modules were designed to allocate memory for storing its reset data structure and the embedded IOPRP image. It'll check the image and copy the image into the buffer, as if it is a normal IOPRP image that is stored as a file. + The Sony DVD player UDNL modules were designed to allocate memory for storing its reset data structure and the embedded IOPRP image. It'll check the image and copy the image into the buffer, as if it is a normal IOPRP image that is stored as a file. 6. If the IOPRP image (Other than the boot ROM) contains an IOPBTCONF file which includes another file, Modules will only be scanned for and selected from IOPRP images which come after the image which contains the IOPBTCONF file which included another IOPBTCONF file: - boot ROM - IOPRP image #3 - IOPRP image #2 (Contains IOPTBTCONF which includes IOPBTCONF again) - IOPRP image #1 + boot ROM + IOPRP image #3 + IOPRP image #2 (Contains IOPTBTCONF which includes IOPBTCONF again) + IOPRP image #1 - This means that when the list of modules within IOPBTCONF is parsed from IOPRP image #2, modules will only be selected from IOPRP image #2 and later. When the UDNL module finds the "!include" statement and parses through the boot ROM IOPBTCONF file (since no further images after IOPRP image #2 has one), only modules from IOPRP image #3 and the boot ROM will be selected. + This means that when the list of modules within IOPBTCONF is parsed from IOPRP image #2, modules will only be selected from IOPRP image #2 and later. When the UDNL module finds the "!include" statement and parses through the boot ROM IOPBTCONF file (since no further images after IOPRP image #2 has one), only modules from IOPRP image #3 and the boot ROM will be selected. #1 only applies to the Sony UDNL module, as it doesn't reset the relative module pointer. This clone has that bug fixed. #3 only applies to the Sony UDNL module. This clone has that check totally commented out. diff --git a/modules/iopcore/udnl-t300/include/COFF.h b/modules/iopcore/udnl-t300/include/COFF.h index 2a00e2a42..4ba5bbefc 100644 --- a/modules/iopcore/udnl-t300/include/COFF.h +++ b/modules/iopcore/udnl-t300/include/COFF.h @@ -29,7 +29,7 @@ typedef struct aouthdr u32 text_start; /* base of text used for this file */ u32 data_start; /* base of data used for this file */ u32 bss_start; /* base of bss used for this file */ - //Instead of the GPR and CPR masks, these 5 fields exist. + // Instead of the GPR and CPR masks, these 5 fields exist. u32 field_20; u32 field_24; u32 field_28; diff --git a/modules/iopcore/udnl-t300/include/ELF.h b/modules/iopcore/udnl-t300/include/ELF.h index 7756b3cdd..044d232e1 100644 --- a/modules/iopcore/udnl-t300/include/ELF.h +++ b/modules/iopcore/udnl-t300/include/ELF.h @@ -106,12 +106,12 @@ struct iopmod_id struct iopmod { - struct iopmod_id *mod_id; //0x00 - void *EntryPoint; //0x04 - void *gp; //0x08 - unsigned int text_size; //0x0C - unsigned int data_size; //0x10 - unsigned int bss_size; //0x14 - unsigned short int version; //0x18 - char modname[1]; //0x1A + struct iopmod_id *mod_id; // 0x00 + void *EntryPoint; // 0x04 + void *gp; // 0x08 + unsigned int text_size; // 0x0C + unsigned int data_size; // 0x10 + unsigned int bss_size; // 0x14 + unsigned short int version; // 0x18 + char modname[1]; // 0x1A }; diff --git a/modules/iopcore/udnl-t300/udnl.c b/modules/iopcore/udnl-t300/udnl.c index f2482aab2..18d297a36 100644 --- a/modules/iopcore/udnl-t300/udnl.c +++ b/modules/iopcore/udnl-t300/udnl.c @@ -10,54 +10,60 @@ #include "ELF.h" #include "COFF.h" -int CpuExecuteKmode(void *function, ...); //Exactly the same function as INTRMAN's export 14. +int CpuExecuteKmode(void *function, ...); // Exactly the same function as INTRMAN's export 14. -//#define DEBUG 1 //Comment out to disable debug messages. +//#define DEBUG 1 //Comment out to disable debug messages. #ifdef DEBUG #define DEBUG_PRINTF(args...) printf(args) #else #define DEBUG_PRINTF(args...) #endif -#define FULL_UDNL 1 //Comment out to build a UDNL module that updates the IOP with only its payload. +#define FULL_UDNL 1 // Comment out to build a UDNL module that updates the IOP with only its payload. #define MAX_MODULES 256 -#define alloca(size) __builtin_alloca(size) //The homebrew PS2SDK lacks alloca.h. +#define alloca(size) __builtin_alloca(size) // The homebrew PS2SDK lacks alloca.h. -//Function prototypes +// Function prototypes static void CopySection(const void *module, void *buffer, unsigned int FileSize); static void *AllocMemory(int nbytes); #ifdef FULL_UDNL /* Evil function. */ /* 0x00000000 */ -/* int isIllegalBootDevice(const char *arg1){ - unsigned int temp1, temp2, temp3, DeviceHash; +/* +int isIllegalBootDevice(const char *arg1) +{ + unsigned int temp1, temp2, temp3, DeviceHash; - while(*path==' ') path++; + while (*path == ' ') + path++; - temp1=*path++; - temp2=*path++; - temp3=*path++; + temp1 = *path++; + temp2 = *path++; + temp3 = *path++; - DeviceHash=(((((temp1<<8) | temp2) <<8) | temp3) << 8) ^ 0x72e7c42f; + DeviceHash = (((((temp1 << 8) | temp2) << 8) | temp3) << 8) ^ 0x72e7c42f; - // "rom", "host" and "cdrom". - if((DeviceHash>>8==0x000088A9) || (DeviceHash==0x1A88B75B) || ((DeviceHash==0x1183b640)) && (*path++)=='m')){ - return((*path-0x30)<0x0b?1:0); - }else{ - return 1; - } -} */ + // "rom", "host" and "cdrom". + if ((DeviceHash >> 8 == 0x000088A9) || (DeviceHash == 0x1A88B75B) || ((DeviceHash == 0x1183b640)) && (*path++) == 'm')) + { + return ((*path - 0x30) < 0x0b ? 1 : 0); + } + else { + return 1; + } +} +*/ #endif /* - 0x00 - RAM size in MB. - 0x04 - The boot mode (0 = hard reset, 1 = soft reset, 2 = update reset, 3 = update complete). - 0x08 - Updater command line (Only for when boot mode = 2). - 0x0C - Pointer to the entry point of the first module. - 0x10 - Result from QueryMemSize() - 0x00200000 - 0x1C - pointer to the buffer (Size: Size of images + MAX_MODULES*sizeof(void*) + sizeof(struct ResetData) bytes) + 0x00 - RAM size in MB. + 0x04 - The boot mode (0 = hard reset, 1 = soft reset, 2 = update reset, 3 = update complete). + 0x08 - Updater command line (Only for when boot mode = 2). + 0x0C - Pointer to the entry point of the first module. + 0x10 - Result from QueryMemSize() - 0x00200000 + 0x1C - pointer to the buffer (Size: Size of images + MAX_MODULES*sizeof(void*) + sizeof(struct ResetData) bytes) */ struct ResetData @@ -191,13 +197,13 @@ static void ScanImagesForFile(const struct ImageData *ImageDataBuffer, unsigned if (NumFiles > 0) { /* - Let f(x)=((x-1)*2+(x-1))*8; - f(1)=((1-1)*2+(1-1))*8=0 - f(2)=((2-1)*2+(2-1))*8=24 - f(3)=((3-1)*2+(3-1))*8=48 + Let f(x)=((x-1)*2+(x-1))*8; + f(1)=((1-1)*2+(1-1))*8=0 + f(2)=((2-1)*2+(2-1))*8=24 + f(3)=((3-1)*2+(3-1))*8=48 - ImageDataBuffer+(NumFiles<<1+NumFiles)<<3 - */ + ImageDataBuffer+(NumFiles<<1+NumFiles)<<3 + */ i = NumFiles - 1; ImageData = &ImageDataBuffer[i]; @@ -236,7 +242,7 @@ static void TerminateResidentLibraries(const char *message, unsigned int options ModuleData = NextModule; continue; } - } else if ((ModuleData->flags & 6) == 2) { //Won't ever happen? + } else if ((ModuleData->flags & 6) == 2) { // Won't ever happen? ModuleData = NextModule; continue; } @@ -257,7 +263,7 @@ struct ssbus_regs volatile unsigned int *address, *delay; }; -static struct ssbus_regs ssbus_regs[] = { //0x00001e24 +static struct ssbus_regs ssbus_regs[] = { // 0x00001e24 { (volatile unsigned int *)0xbf801000, (volatile unsigned int *)0xbf801008}, @@ -274,7 +280,7 @@ static struct ssbus_regs ssbus_regs[] = { //0x00001e24 {NULL, NULL}}; -//0x00000f80 +// 0x00000f80 static volatile unsigned int *func_00000f80(volatile unsigned int *address) { struct ssbus_regs *pSSBUS_regs; @@ -289,10 +295,10 @@ static volatile unsigned int *func_00000f80(volatile unsigned int *address) return pSSBUS_regs->delay; } -//0x00001b38 +// 0x00001b38 void func_00001b38(unsigned int arg1); -//0x00000c98 +// 0x00000c98 static void TerminateResidentEntriesDI(unsigned int options) { int prid; @@ -321,16 +327,16 @@ static void TerminateResidentEntriesDI(unsigned int options) struct ModuleInfo { - unsigned int ModuleType; //0x00 - void *EntryPoint; //0x04 - void *gp; //0x08 - void *text_start; //0x0C - unsigned int text_size; //0x10 - unsigned int data_size; //0x14 - unsigned int bss_size; //0x18 - unsigned int MemSize; //0x1C - struct iopmod_id *mod_id; //0x20 - unsigned int unknown_24; //0x24 + unsigned int ModuleType; // 0x00 + void *EntryPoint; // 0x04 + void *gp; // 0x08 + void *text_start; // 0x0C + unsigned int text_size; // 0x10 + unsigned int data_size; // 0x14 + unsigned int bss_size; // 0x18 + unsigned int MemSize; // 0x1C + struct iopmod_id *mod_id; // 0x20 + unsigned int unknown_24; // 0x24 }; void func_00001930(void); @@ -352,16 +358,18 @@ static int InitModuleInfo(const void *module, struct ModuleInfo *ModuleInfo) const elf_pheader_t *ELF_phdr; const struct iopmod *iopmod; - /* sizeof(struct coff_filehdr) = 20 bytes - sizeof(AOUTHDR) = 56 bytes - sizeof(struct scnhdr) = 40 bytes */ + /* + sizeof(struct coff_filehdr) = 20 bytes + sizeof(AOUTHDR) = 56 bytes + sizeof(struct scnhdr) = 40 bytes + */ memcpy(&Ident_10, &((struct coff_filehdr *)module)->f_opthdr, 4); COFF_AoutHdr = (AOUTHDR *)((unsigned int)module + sizeof(struct coff_filehdr)); COFF_ScnHdr = (struct scnhdr *)((unsigned int)module + sizeof(struct coff_filehdr) + sizeof(AOUTHDR)); if (((struct coff_filehdr *)module)->f_magic == MIPSELMAGIC && COFF_AoutHdr->magic == OMAGIC && ((struct coff_filehdr *)module)->f_nscns < 0x20 && ((Ident_10 & 0x0002FFFF) == 0x20038) && COFF_ScnHdr->s_paddr == COFF_AoutHdr->text_start) { if (COFF_AoutHdr->vstamp != 0x7001) { - /* 0x00000bf8 - COFF */ + /* 0x00000bf8 - COFF */ ModuleInfo->ModuleType = IOP_MOD_TYPE_COFF; ModuleInfo->EntryPoint = (void *)COFF_AoutHdr->entry; ModuleInfo->gp = (void *)COFF_AoutHdr->gp_value; @@ -377,7 +385,7 @@ static int InitModuleInfo(const void *module, struct ModuleInfo *ModuleInfo) return -1; } } else { - /* 0x00000C68 - ELF */ + /* 0x00000C68 - ELF */ ELF_Hdr = module; ELF_phdr = (elf_pheader_t *)((unsigned int)module + ELF_Hdr->phoff); @@ -451,9 +459,11 @@ static void LoadCOFFModule(const void *module) const AOUTHDR *COFF_AoutHdr; const struct scnhdr *ScnHdr; - /* sizeof(struct coff_filehdr) = 20 bytes - sizeof(AOUTHDR) = 56 bytes - sizeof(struct scnhdr) = 40 bytes */ + /* + sizeof(struct coff_filehdr) = 20 bytes + sizeof(AOUTHDR) = 56 bytes + sizeof(struct scnhdr) = 40 bytes + */ COFF_AoutHdr = (AOUTHDR *)((unsigned int)module + sizeof(struct coff_filehdr)); ScnHdr = (struct scnhdr *)((unsigned int)module + sizeof(struct coff_filehdr) + sizeof(AOUTHDR)); @@ -502,7 +512,7 @@ static void LoadIRXModule(const void *module, struct ModuleInfo *ModuleInfo) /* 0x0000107c - Warning: beware of sign extension! The code here depends on sign extension. */ for (i = 0, ELF_relocation = (elf_rel *)((unsigned int)module + CurrentELF_shdr->offset); i < NumRelocs; i++, ELF_relocation++) { - // DEBUG_PRINTF("Reloc %d: %p\n", (unsigned char)ELF_relocation->info&0xFF, ModuleInfo->text_start+ELF_relocation->offset); //Code for debugging only: Not originally present. + // DEBUG_PRINTF("Reloc %d: %p\n", (unsigned char)ELF_relocation->info&0xFF, ModuleInfo->text_start+ELF_relocation->offset); //Code for debugging only: Not originally present. switch (ELF_relocation->info & 0xFF) { case R_MIPS_NONE: @@ -521,7 +531,7 @@ static void LoadIRXModule(const void *module, struct ModuleInfo *ModuleInfo) WordPatchLocation = (unsigned int *)(ModuleInfo->text_start + ELF_relocation->offset); *WordPatchLocation = (((unsigned int)ModuleInfo->text_start + ((*WordPatchLocation & 0x03FFFFFF) << 2 | ((unsigned int)WordPatchLocation & 0xF0000000))) << 4 >> 6) | (*WordPatchLocation & 0xFC000000); break; - case R_MIPS_HI16: //0x00001120 - Ouch. D: + case R_MIPS_HI16: // 0x00001120 - Ouch. D: temp = (((unsigned int)*(unsigned short int *)(ModuleInfo->text_start + ELF_relocation->offset)) << 16) + *(short int *)(ModuleInfo->text_start + ELF_relocation[1].offset); temp += (unsigned int)ModuleInfo->text_start; WordPatchLocation = (unsigned int *)(ModuleInfo->text_start + ELF_relocation->offset); @@ -541,20 +551,20 @@ static void LoadIRXModule(const void *module, struct ModuleInfo *ModuleInfo) struct ModInfo { - struct ModInfo *next; //0x00 - const char *name; //0x04 - unsigned short int version; //0x08 - unsigned short int newflags; //0x0A - unsigned short int id; //0x0C - unsigned short int flags; //0x0E - void *EntryPoint; //0x10 - void *gp; //0x14 - void *text_start; //0x18 - unsigned int text_size; //0x1C - unsigned int data_size; //0x20 - unsigned int bss_size; //0x24 - unsigned int unused1; //0x28 - unsigned int unused2; //0x2C + struct ModInfo *next; // 0x00 + const char *name; // 0x04 + unsigned short int version; // 0x08 + unsigned short int newflags; // 0x0A + unsigned short int id; // 0x0C + unsigned short int flags; // 0x0E + void *EntryPoint; // 0x10 + void *gp; // 0x14 + void *text_start; // 0x18 + unsigned int text_size; // 0x1C + unsigned int data_size; // 0x20 + unsigned int bss_size; // 0x24 + unsigned int unused1; // 0x28 + unsigned int unused2; // 0x2C }; /* 0x00000df8 - Initializes the module information structure, which exists 0x30 bytes before the module itself. */ @@ -618,12 +628,12 @@ static void BeginBootupSequence(struct ResetData *ResetData, unsigned int option MemSizeInBytes = ResetData->MemSize << 20; - //Load SYSMEM + // Load SYSMEM switch (InitModuleInfo(ResetData->ModData[0], &LoadedModules[0])) { case IOP_MOD_TYPE_2: case IOP_MOD_TYPE_IRX: LoadedModules[0].text_start = (void *)((unsigned int)ResetData->StartAddress + 0x30); - //Fall through. + // Fall through. case IOP_MOD_TYPE_COFF: case IOP_MOD_TYPE_ELF: LoadModule(ResetData->ModData[0], &LoadedModules[0]); @@ -636,12 +646,12 @@ static void BeginBootupSequence(struct ResetData *ResetData, unsigned int option ModuleEntryPoint = LoadedModules[0].EntryPoint; FreeMemStart = (void *)ModuleEntryPoint(MemSizeInBytes); - //Load LOADCORE + // Load LOADCORE switch (InitModuleInfo(ResetData->ModData[1], &LoadedModules[1])) { case IOP_MOD_TYPE_2: case IOP_MOD_TYPE_IRX: LoadedModules[1].text_start = (void *)((unsigned int)FreeMemStart + 0x30); - //Fall through. + // Fall through. case IOP_MOD_TYPE_COFF: case IOP_MOD_TYPE_ELF: LoadModule(ResetData->ModData[1], &LoadedModules[1]); @@ -654,9 +664,9 @@ static void BeginBootupSequence(struct ResetData *ResetData, unsigned int option ResetData->StartAddress = LoadedModules[0].text_start; ModuleEntryPoint = LoadedModules[1].EntryPoint; - ModuleEntryPoint((int)ResetData); //LOADCORE will start the bootup sequence. + ModuleEntryPoint((int)ResetData); // LOADCORE will start the bootup sequence. - //HALT loop + // HALT loop while (1) *(volatile unsigned char *)0x80000000 = 2; } @@ -692,7 +702,7 @@ static void *ParseStartAddress(const char **line) struct ExtInfoField { unsigned short int data; - unsigned short int header; //Upper 8 bits contain the type. + unsigned short int header; // Upper 8 bits contain the type. }; /* 0x000013d8 */ @@ -720,7 +730,7 @@ static const struct ExtInfoField *GetFileInfo(const struct RomdirFileStat *stat, return NULL; } -/* 0x00000878 - Scans through all loaded IOPRP images for the newest version of the specified module. */ +/* 0x00000878 - Scans through all loaded IOPRP images for the newest version of the specified module. */ static struct RomdirFileStat *SelectModuleFromImages(const struct ImageData *ImageDataBuffer, unsigned int NumFiles, const char *line, struct RomdirFileStat *stat_out) { char filename[32]; @@ -780,7 +790,7 @@ static struct RomdirFileStat *SelectModuleFromImages(const struct ImageData *Ima return result; } -//Code for debugging only - not originally present. +// Code for debugging only - not originally present. #ifdef DEBUG static void DisplayModuleName(int id, const char *line) { @@ -847,36 +857,36 @@ static void ParseIOPBTCONF(const struct ImageData *ImageDataBuffer, unsigned int ModList = &ResetData->ModData[ResetData->NumModules]; /* - I have problems seeing why this won't break down if "!include" is used in the middle of a list of modules: - Before parsing included IOPBTCONF file: - ###_____________ - | ^ - After parsing included IOPBTCONF file: - ###XXXXXXXX_____ - | ^ (The pointer would still be offset by 3, wouldn't it?) - If 2 additional modules are added to the list of modules: - ###XXXXXXXX___XX_ - | ^ (If I'm not wrong, a gap of 3 would result) - Legend: - # -> Modules loaded during the first call to ParseIOPBTCONF. - X -> Modules loaded when the included IOPBTCONF file is parsed. - | -> The base pointer to the start of the module list. - ^ -> The pointer to the end of the module list. - _ -> Blank module slots. - - $s2 seems to contain a relative pointer which points to the first blank module slot. It seems to be added to the base pointer ($s0) when the module list is accessed. - When an included IOPBTCONF file is parsed, $s0 is adjusted but $s2 is not. - - If it's by design, then it will mean that Sony had intended only one additional IOPBTCONF file to be included in each file, and it must be included at only either the absolute start or end of the file. - */ - NumModules = 0; //Therefore, unlike the Sony original, reset the module offset counter. + I have problems seeing why this won't break down if "!include" is used in the middle of a list of modules: + Before parsing included IOPBTCONF file: + ###_____________ + | ^ + After parsing included IOPBTCONF file: + ###XXXXXXXX_____ + | ^ (The pointer would still be offset by 3, wouldn't it?) + If 2 additional modules are added to the list of modules: + ###XXXXXXXX___XX_ + | ^ (If I'm not wrong, a gap of 3 would result) + Legend: + # -> Modules loaded during the first call to ParseIOPBTCONF. + X -> Modules loaded when the included IOPBTCONF file is parsed. + | -> The base pointer to the start of the module list. + ^ -> The pointer to the end of the module list. + _ -> Blank module slots. + + $s2 seems to contain a relative pointer which points to the first blank module slot. It seems to be added to the base pointer ($s0) when the module list is accessed. + When an included IOPBTCONF file is parsed, $s0 is adjusted but $s2 is not. + + If it's by design, then it will mean that Sony had intended only one additional IOPBTCONF file to be included in each file, and it must be included at only either the absolute start or end of the file. + */ + NumModules = 0; // Therefore, unlike the Sony original, reset the module offset counter. } break; case '#': /* 0x0000077c */ break; default: /* 0x00000784 */ #ifdef DEBUG - DisplayModuleName(ResetData->NumModules, ptr); //Code for debugging only - not originally present. + DisplayModuleName(ResetData->NumModules, ptr); // Code for debugging only - not originally present. #endif if (SelectModuleFromImages(ImageDataBuffer, NumFiles, ptr, &ModuleFileStat) == NULL) { __asm("break\n"); @@ -939,28 +949,28 @@ int _start(int argc, char *argv[]) } /* - Let f(x)=((x+2)*2+(x+2))*8, where x>0 - f(1)=((1+2)*2+(1+2))*8=72 - f(2)=((2+2)*2+(2+2))*8=96 - f(3)=((3+2)*2+(3+2))*8=120 - - Therefore, each element is 24 bytes long, with an additional 48 bytes extra allocated for the built-in IOPRP images (The boot ROM and the DATA section of the UDNL module). - - --- Original disassembly --- - ImageDataTotalSize=((argc+2)<<1); - ImageDataTotalSize=ImageDataTotalSize+(argc+2); - ImageDataTotalSize=(ImageDataTotalSize<<3); - - Note: The function reserves an additional 32-bytes of space on the stack when the function enters. - The pointers are then offset by 0x10 bytes. - $s7=$sp+0x10 <- Start of image list buffer. - $s4=$sp+0x40 <- Points to the image entries within the image list buffer. - */ + Let f(x)=((x+2)*2+(x+2))*8, where x>0 + f(1)=((1+2)*2+(1+2))*8=72 + f(2)=((2+2)*2+(2+2))*8=96 + f(3)=((3+2)*2+(3+2))*8=120 + + Therefore, each element is 24 bytes long, with an additional 48 bytes extra allocated for the built-in IOPRP images (The boot ROM and the DATA section of the UDNL module). + + --- Original disassembly --- + ImageDataTotalSize=((argc+2)<<1); + ImageDataTotalSize=ImageDataTotalSize+(argc+2); + ImageDataTotalSize=(ImageDataTotalSize<<3); + + Note: The function reserves an additional 32-bytes of space on the stack when the function enters. + The pointers are then offset by 0x10 bytes. + $s7=$sp+0x10 <- Start of image list buffer. + $s4=$sp+0x40 <- Points to the image entries within the image list buffer. + */ ImageDataTotalSize = (argc + 2) * sizeof(struct ImageData); ImageDataBuffer = alloca(ImageDataTotalSize); memset(ImageDataBuffer, 0, ImageDataTotalSize); - TotalSize = MAX_MODULES * sizeof(void *) + sizeof(struct ResetData) + ((size_IOPRP_img + 0xF) & ~0xF); //Unlike the ROM UDNL module, allocate space for the embedded IOPRP image as well like the DVD player UDNL module does. + TotalSize = MAX_MODULES * sizeof(void *) + sizeof(struct ResetData) + ((size_IOPRP_img + 0xF) & ~0xF); // Unlike the ROM UDNL module, allocate space for the embedded IOPRP image as well like the DVD player UDNL module does. #ifdef FULL_UDNL i = 1; @@ -975,13 +985,13 @@ int _start(int argc, char *argv[]) } else if (strcmp(argv[i], "-nocacheini") == 0 || strcmp(argv[i], "-nc") == 0) { options |= 2; } else { - /* if(isIllegalBootDevice(argv[i])){ //This block of commented-out code (and the commented-out isIllegalBootDevice() function) is what all Sony UDNL modules have, to prevent the loading of IOPRP images from unsecured devices. - if(BootMode4&2) goto end; - else{ - SleepThread(); - __asm("break"); - } - } */ + /* if(isIllegalBootDevice(argv[i])){ //This block of commented-out code (and the commented-out isIllegalBootDevice() function) is what all Sony UDNL modules have, to prevent the loading of IOPRP images from unsecured devices. + if(BootMode4&2) goto end; + else{ + SleepThread(); + __asm("break"); + } + } */ if ((fd = open(argv[i], O_RDONLY)) < 0) { printf("kupdate: pannic ! file \'%s\' can't open\n", argv[i]); @@ -1048,12 +1058,12 @@ int _start(int argc, char *argv[]) } /* 0x00000398 */ - /* Originally, the Sony boot ROM UDNL module did this. However, it doesn't work well because the rest of the data used in the reset will go unprotected. The Sony DVD player UDNL modules allocate memory for the embedded IOPRP image and copies the IOPRP image into the buffer, like if it was read in from a file. - if(size_IOPRP_img>=0x10 && GetIOPRPStat(IOPRP_img, &IOPRP_img[size_IOPRP_img], &ImageDataBuffer[1].stat)!=NULL){ - ImageDataBuffer[1].filename="DATA"; - ResetData->IOPRPBuffer=(void*)((unsigned int)IOPRP_img&~0xF); - } */ - if (size_IOPRP_img >= 0x10) { //Hence, do this instead: + /* Originally, the Sony boot ROM UDNL module did this. However, it doesn't work well because the rest of the data used in the reset will go unprotected. The Sony DVD player UDNL modules allocate memory for the embedded IOPRP image and copies the IOPRP image into the buffer, like if it was read in from a file. + if(size_IOPRP_img>=0x10 && GetIOPRPStat(IOPRP_img, &IOPRP_img[size_IOPRP_img], &ImageDataBuffer[1].stat)!=NULL){ + ImageDataBuffer[1].filename="DATA"; + ResetData->IOPRPBuffer=(void*)((unsigned int)IOPRP_img&~0xF); + } */ + if (size_IOPRP_img >= 0x10) { // Hence, do this instead: memcpy(IoprpBuffer, IOPRP_img, size_IOPRP_img); if (GetIOPRPStat(IoprpBuffer, (void *)((unsigned int)IoprpBuffer + size_IOPRP_img), &ImageDataBuffer[1].stat) != NULL) { ImageDataBuffer[1].filename = "DATA"; diff --git a/modules/iopcore/udnl/README.txt b/modules/iopcore/udnl/README.txt index 30d0a36a6..756262f79 100644 --- a/modules/iopcore/udnl/README.txt +++ b/modules/iopcore/udnl/README.txt @@ -1,4 +1,4 @@ -UDNL (Updater) module - 2013/08/04 +UDNL (Updater) module - 2013/08/04 ------------------------------------------ UDNL is a updater module, which is used for the final phase (Boot mode 3) within the IOP reset cycle. It is responsible for loading the requested IOPRP image into RAM and kickstarting the final IOP bootup sequence. @@ -21,7 +21,7 @@ Comment out FULL_UDNL within udnl.c to build a UDNL module that works like the S Syntax: ------- - UDNL ... [-v] + UDNL ... [-v] UDNL accepts multiple IORP images in the command passed to it. It'll scan through all the specified images to locate the newest version of each module that is specified in IOPBTCONF (which acts like CONFIG.SYS of MS-DOs, for those who know what that is), and will build a list of modules to load. @@ -36,10 +36,10 @@ IOPBTCONF files can include other IOPBTCONF files, although this has some limita IOPBTCONF file syntax: ---------------------- -@
- The address at which to start loading modules from. -!include - Includes the specified file. -!addr
- Includes a module that exists at the specified memory address. -# - The '#' symbol marks the whole line as a comment. +@
- The address at which to start loading modules from. +!include - Includes the specified file. +!addr
- Includes a module that exists at the specified memory address. +# - The '#' symbol marks the whole line as a comment. Lines beginning with other characters are automatically assumed to be the filenames of modules that are to be loaded. @@ -52,14 +52,14 @@ Known bugs and limitations: 3. Certain devices cannot be used for storing IOPRP images, due to an internal blacklist (Refer to isIllegalBootDevice()). Blacklisted devices are "mc", "hd", "net" and "dev". 4. When IOPBTCONF files include another IOPBTCONF file that is being parsed and its modules are located, the modules will only be scanned from starting with the IOPRP image that contains the IOPBTCONF that is being parsed (e.g. if the 2nd IOPRP image contains a IOPBTCONF file that is included by another file, the modules listed in the IOPBTCONF file will only be scanned for stating with the 2nd IOPRP image. Files in the first IOPRP image will be IGNORED). Hence, keep the order of your IOPRP images/commands in mind! 5. The design for loading modules from an embedded IOPRP image of the boot ROM UDNL module is flawed. Its design seemed to be to allow the programmer to use either an embedded IOPRP image OR IOPRP images that are stored as accessible files. If the embedded IOPRP image is to be used, it would just get its reset data structure to point to the embedded IOPRP image as the buffer containing the IOPRP images... but that causes the reset data structure itself to become unprotected during the IOP bootup sequence and will possibly cause corruption under certain conditions. - The Sony DVD player UDNL modules were designed to allocate memory for storing its reset data structure and the embedded IOPRP image. It'll check the image and copy the image into the buffer, as if it is a normal IOPRP image that is stored as a file. + The Sony DVD player UDNL modules were designed to allocate memory for storing its reset data structure and the embedded IOPRP image. It'll check the image and copy the image into the buffer, as if it is a normal IOPRP image that is stored as a file. 6. If the IOPRP image (Other than the boot ROM) contains an IOPBTCONF file which includes another file, Modules will only be scanned for and selected from IOPRP images which come after the image which contains the IOPBTCONF file which included another IOPBTCONF file: - boot ROM - IOPRP image #3 - IOPRP image #2 (Contains IOPTBTCONF which includes IOPBTCONF again) - IOPRP image #1 + boot ROM + IOPRP image #3 + IOPRP image #2 (Contains IOPTBTCONF which includes IOPBTCONF again) + IOPRP image #1 - This means that when the list of modules within IOPBTCONF is parsed from IOPRP image #2, modules will only be selected from IOPRP image #2 and later. When the UDNL module finds the "!include" statement and parses through the boot ROM IOPBTCONF file (since no further images after IOPRP image #2 has one), only modules from IOPRP image #3 and the boot ROM will be selected. + This means that when the list of modules within IOPBTCONF is parsed from IOPRP image #2, modules will only be selected from IOPRP image #2 and later. When the UDNL module finds the "!include" statement and parses through the boot ROM IOPBTCONF file (since no further images after IOPRP image #2 has one), only modules from IOPRP image #3 and the boot ROM will be selected. #1 only applies to the Sony UDNL module, as it doesn't reset the relative module pointer. This clone has that bug fixed. #2 only applies to the Sony boot ROM UDNL module, as it does not copy the embedded IOPRP image into its allocated buffer. It does not work well either, as the region that the embedded IOPRP image exists in does not get reserved. diff --git a/modules/iopcore/udnl/include/COFF.h b/modules/iopcore/udnl/include/COFF.h index 2a00e2a42..4ba5bbefc 100644 --- a/modules/iopcore/udnl/include/COFF.h +++ b/modules/iopcore/udnl/include/COFF.h @@ -29,7 +29,7 @@ typedef struct aouthdr u32 text_start; /* base of text used for this file */ u32 data_start; /* base of data used for this file */ u32 bss_start; /* base of bss used for this file */ - //Instead of the GPR and CPR masks, these 5 fields exist. + // Instead of the GPR and CPR masks, these 5 fields exist. u32 field_20; u32 field_24; u32 field_28; diff --git a/modules/iopcore/udnl/include/ELF.h b/modules/iopcore/udnl/include/ELF.h index 7756b3cdd..044d232e1 100644 --- a/modules/iopcore/udnl/include/ELF.h +++ b/modules/iopcore/udnl/include/ELF.h @@ -106,12 +106,12 @@ struct iopmod_id struct iopmod { - struct iopmod_id *mod_id; //0x00 - void *EntryPoint; //0x04 - void *gp; //0x08 - unsigned int text_size; //0x0C - unsigned int data_size; //0x10 - unsigned int bss_size; //0x14 - unsigned short int version; //0x18 - char modname[1]; //0x1A + struct iopmod_id *mod_id; // 0x00 + void *EntryPoint; // 0x04 + void *gp; // 0x08 + unsigned int text_size; // 0x0C + unsigned int data_size; // 0x10 + unsigned int bss_size; // 0x14 + unsigned short int version; // 0x18 + char modname[1]; // 0x1A }; diff --git a/modules/iopcore/udnl/udnl.c b/modules/iopcore/udnl/udnl.c index 23cc87d45..0dc313991 100644 --- a/modules/iopcore/udnl/udnl.c +++ b/modules/iopcore/udnl/udnl.c @@ -10,66 +10,66 @@ #include "ELF.h" #include "COFF.h" -//#define DEBUG 1 //Comment out to disable debug messages. +//#define DEBUG 1 //Comment out to disable debug messages. #ifdef DEBUG #define DEBUG_PRINTF(args...) printf(args) #else #define DEBUG_PRINTF(args...) #endif -#define FULL_UDNL 1 //Comment out to build a UDNL module that updates the IOP with only its payload. +#define FULL_UDNL 1 // Comment out to build a UDNL module that updates the IOP with only its payload. #define MAX_MODULES 256 -#define alloca(size) __builtin_alloca(size) //The homebrew PS2SDK lacks alloca.h. +#define alloca(size) __builtin_alloca(size) // The homebrew PS2SDK lacks alloca.h. -//Function prototypes +// Function prototypes static void CopySection(const void *module, void *buffer, unsigned int FileSize); static void *AllocMemory(int nbytes); #ifdef FULL_UDNL /* Evil function. */ /* 0x00000000 */ -/* int isIllegalBootDevice(const char *arg1){ - // Eliminate spaces from the path. - if(arg1[0]==' '){ - arg1++; - do{ - arg1++; - }while(arg1[0]==' '); - - arg1--; - } - - if(((arg1[0]|0x20)=='m')&&((arg1[1]|0x20)=='c')){ //"mc" - arg1+=2; - goto end_func1; - } - else if(((arg1[0]|0x20)=='h')&&((arg1[1]|0x20)=='d')){ //"hd" - arg1+=2; - goto end_func1; - } - else if(((arg1[0]|0x20)=='n')&&((arg1[1]|0x20)=='e')&&((arg1[2]|0x20)=='t')){ //"net" - arg1+=3; - goto end_func1; - } - else if(((arg1[0]|0x20)=='d')&&((arg1[1]|0x20)=='e')&&((arg1[2]|0x20)=='v')){ //"dev" - arg1+=3; - goto end_func1; - } - else return 0; +/* +int isIllegalBootDevice(const char *arg1) +{ + // Eliminate spaces from the path. + if (arg1[0] == ' ') { + arg1++; + do { + arg1++; + } while (arg1[0] == ' '); + + arg1--; + } + + if (((arg1[0] | 0x20) == 'm') && ((arg1[1] | 0x20) == 'c')) { //"mc" + arg1 += 2; + goto end_func1; + } else if (((arg1[0] | 0x20) == 'h') && ((arg1[1] | 0x20) == 'd')) { //"hd" + arg1 += 2; + goto end_func1; + } else if (((arg1[0] | 0x20) == 'n') && ((arg1[1] | 0x20) == 'e') && ((arg1[2] | 0x20) == 't')) { //"net" + arg1 += 3; + goto end_func1; + } else if (((arg1[0] | 0x20) == 'd') && ((arg1[1] | 0x20) == 'e') && ((arg1[2] | 0x20) == 'v')) { //"dev" + arg1 += 3; + goto end_func1; + } else + return 0; end_func1: - return((*arg1-0x30<0x0b)?1:0); // '0' to '9' and ':' -} */ + return ((*arg1 - 0x30 < 0x0b) ? 1 : 0); // '0' to '9' and ':' +} +*/ #endif /* - 0x00 - RAM size in MB. - 0x04 - The boot mode (0 = hard reset, 1 = soft reset, 2 = update reset, 3 = update complete). - 0x08 - Updater command line (Only for when boot mode = 2). - 0x0C - Pointer to the entry point of the first module. - 0x10 - Result from QueryMemSize() - 0x00200000 - 0x1C - pointer to the buffer (Size: Size of images + MAX_MODULES*sizeof(void*) + sizeof(struct ResetData) bytes) + 0x00 - RAM size in MB. + 0x04 - The boot mode (0 = hard reset, 1 = soft reset, 2 = update reset, 3 = update complete). + 0x08 - Updater command line (Only for when boot mode = 2). + 0x0C - Pointer to the entry point of the first module. + 0x10 - Result from QueryMemSize() - 0x00200000 + 0x1C - pointer to the buffer (Size: Size of images + MAX_MODULES*sizeof(void*) + sizeof(struct ResetData) bytes) */ struct ResetData @@ -198,13 +198,13 @@ static void ScanImagesForFile(const struct ImageData *ImageDataBuffer, unsigned if (NumFiles > 0) { /* - Let f(x)=((x-1)*2+(x-1))*8; - f(1)=((1-1)*2+(1-1))*8=0 - f(2)=((2-1)*2+(2-1))*8=24 - f(3)=((3-1)*2+(3-1))*8=48 + Let f(x)=((x-1)*2+(x-1))*8; + f(1)=((1-1)*2+(1-1))*8=0 + f(2)=((2-1)*2+(2-1))*8=24 + f(3)=((3-1)*2+(3-1))*8=48 - ImageDataBuffer+(NumFiles<<1+NumFiles)<<3 - */ + ImageDataBuffer+(NumFiles<<1+NumFiles)<<3 + */ i = NumFiles - 1; ImageData = &ImageDataBuffer[i]; @@ -228,16 +228,16 @@ static void ScanImagesForFile(const struct ImageData *ImageDataBuffer, unsigned struct ModuleInfo { - unsigned int ModuleType; //0x00 - void *EntryPoint; //0x04 - void *gp; //0x08 - void *text_start; //0x0C - unsigned int text_size; //0x10 - unsigned int data_size; //0x14 - unsigned int bss_size; //0x18 - unsigned int MemSize; //0x1C - struct iopmod_id *mod_id; //0x20 - unsigned int unknown_24; //0x24 + unsigned int ModuleType; // 0x00 + void *EntryPoint; // 0x04 + void *gp; // 0x08 + void *text_start; // 0x0C + unsigned int text_size; // 0x10 + unsigned int data_size; // 0x14 + unsigned int bss_size; // 0x18 + unsigned int MemSize; // 0x1C + struct iopmod_id *mod_id; // 0x20 + unsigned int unknown_24; // 0x24 }; void func_00001440(void); @@ -259,16 +259,18 @@ static int InitModuleInfo(const void *module, struct ModuleInfo *ModuleInfo) const elf_pheader_t *ELF_phdr; const struct iopmod *iopmod; - /* sizeof(struct coff_filehdr) = 20 bytes - sizeof(AOUTHDR) = 56 bytes - sizeof(struct scnhdr) = 40 bytes */ + /* + sizeof(struct coff_filehdr) = 20 bytes + sizeof(AOUTHDR) = 56 bytes + sizeof(struct scnhdr) = 40 bytes + */ memcpy(&Ident_10, &((struct coff_filehdr *)module)->f_opthdr, 4); COFF_AoutHdr = (AOUTHDR *)((unsigned int)module + sizeof(struct coff_filehdr)); COFF_ScnHdr = (struct scnhdr *)((unsigned int)module + sizeof(struct coff_filehdr) + sizeof(AOUTHDR)); if (((struct coff_filehdr *)module)->f_magic == MIPSELMAGIC && COFF_AoutHdr->magic == OMAGIC && ((struct coff_filehdr *)module)->f_nscns < 0x20 && ((Ident_10 & 0x0002FFFF) == 0x20038) && COFF_ScnHdr->s_paddr == COFF_AoutHdr->text_start) { if (COFF_AoutHdr->vstamp != 0x7001) { - /* 0x00000bf8 - COFF */ + /* 0x00000bf8 - COFF */ ModuleInfo->ModuleType = IOP_MOD_TYPE_COFF; ModuleInfo->EntryPoint = (void *)COFF_AoutHdr->entry; ModuleInfo->gp = (void *)COFF_AoutHdr->gp_value; @@ -284,7 +286,7 @@ static int InitModuleInfo(const void *module, struct ModuleInfo *ModuleInfo) return -1; } } else { - /* 0x00000C68 - ELF */ + /* 0x00000C68 - ELF */ ELF_Hdr = module; ELF_phdr = (elf_pheader_t *)((unsigned int)module + ELF_Hdr->phoff); @@ -358,9 +360,11 @@ static void LoadCOFFModule(const void *module) const AOUTHDR *COFF_AoutHdr; const struct scnhdr *ScnHdr; - /* sizeof(struct coff_filehdr) = 20 bytes - sizeof(AOUTHDR) = 56 bytes - sizeof(struct scnhdr) = 40 bytes */ + /* + sizeof(struct coff_filehdr) = 20 bytes + sizeof(AOUTHDR) = 56 bytes + sizeof(struct scnhdr) = 40 bytes + */ COFF_AoutHdr = (AOUTHDR *)((unsigned int)module + sizeof(struct coff_filehdr)); ScnHdr = (struct scnhdr *)((unsigned int)module + sizeof(struct coff_filehdr) + sizeof(AOUTHDR)); @@ -409,7 +413,7 @@ static void LoadIRXModule(const void *module, struct ModuleInfo *ModuleInfo) /* 0x0000107c - Warning: beware of sign extension! The code here depends on sign extension. */ for (i = 0, ELF_relocation = (elf_rel *)((unsigned int)module + CurrentELF_shdr->offset); i < NumRelocs; i++, ELF_relocation++) { - // DEBUG_PRINTF("Reloc %d: %p\n", (unsigned char)ELF_relocation->info&0xFF, ModuleInfo->text_start+ELF_relocation->offset); //Code for debugging only: Not originally present. + // DEBUG_PRINTF("Reloc %d: %p\n", (unsigned char)ELF_relocation->info&0xFF, ModuleInfo->text_start+ELF_relocation->offset); //Code for debugging only: Not originally present. switch (ELF_relocation->info & 0xFF) { case R_MIPS_NONE: @@ -428,7 +432,7 @@ static void LoadIRXModule(const void *module, struct ModuleInfo *ModuleInfo) WordPatchLocation = (unsigned int *)(ModuleInfo->text_start + ELF_relocation->offset); *WordPatchLocation = (((unsigned int)ModuleInfo->text_start + ((*WordPatchLocation & 0x03FFFFFF) << 2 | ((unsigned int)WordPatchLocation & 0xF0000000))) << 4 >> 6) | (*WordPatchLocation & 0xFC000000); break; - case R_MIPS_HI16: //0x00001120 - Ouch. D: + case R_MIPS_HI16: // 0x00001120 - Ouch. D: temp = (((unsigned int)*(unsigned short int *)(ModuleInfo->text_start + ELF_relocation->offset)) << 16) + *(short int *)(ModuleInfo->text_start + ELF_relocation[1].offset); temp += (unsigned int)ModuleInfo->text_start; WordPatchLocation = (unsigned int *)(ModuleInfo->text_start + ELF_relocation->offset); @@ -448,20 +452,20 @@ static void LoadIRXModule(const void *module, struct ModuleInfo *ModuleInfo) struct ModInfo { - struct ModInfo *next; //0x00 - const char *name; //0x04 - unsigned short int version; //0x08 - unsigned short int newflags; //0x0A - unsigned short int id; //0x0C - unsigned short int flags; //0x0E - void *EntryPoint; //0x10 - void *gp; //0x14 - void *text_start; //0x18 - unsigned int text_size; //0x1C - unsigned int data_size; //0x20 - unsigned int bss_size; //0x24 - unsigned int unused1; //0x28 - unsigned int unused2; //0x2C + struct ModInfo *next; // 0x00 + const char *name; // 0x04 + unsigned short int version; // 0x08 + unsigned short int newflags; // 0x0A + unsigned short int id; // 0x0C + unsigned short int flags; // 0x0E + void *EntryPoint; // 0x10 + void *gp; // 0x14 + void *text_start; // 0x18 + unsigned int text_size; // 0x1C + unsigned int data_size; // 0x20 + unsigned int bss_size; // 0x24 + unsigned int unused1; // 0x28 + unsigned int unused2; // 0x2C }; /* 0x00000df8 - Initializes the module information structure, which exists 0x30 bytes before the module itself. */ @@ -519,12 +523,12 @@ static void BeginBootupSequence(struct ResetData *ResetData) MemSizeInBytes = ResetData->MemSize << 20; - //Load SYSMEM + // Load SYSMEM switch (InitModuleInfo(ResetData->ModData[0], &LoadedModules[0])) { case IOP_MOD_TYPE_2: case IOP_MOD_TYPE_IRX: LoadedModules[0].text_start = (void *)((unsigned int)ResetData->StartAddress + 0x30); - //Fall through. + // Fall through. case IOP_MOD_TYPE_COFF: case IOP_MOD_TYPE_ELF: LoadModule(ResetData->ModData[0], &LoadedModules[0]); @@ -537,12 +541,12 @@ static void BeginBootupSequence(struct ResetData *ResetData) ModuleEntryPoint = LoadedModules[0].EntryPoint; FreeMemStart = (void *)ModuleEntryPoint(MemSizeInBytes); - //Load LOADCORE + // Load LOADCORE switch (InitModuleInfo(ResetData->ModData[1], &LoadedModules[1])) { case IOP_MOD_TYPE_2: case IOP_MOD_TYPE_IRX: LoadedModules[1].text_start = (void *)((unsigned int)FreeMemStart + 0x30); - //Fall through. + // Fall through. case IOP_MOD_TYPE_COFF: case IOP_MOD_TYPE_ELF: LoadModule(ResetData->ModData[1], &LoadedModules[1]); @@ -555,9 +559,9 @@ static void BeginBootupSequence(struct ResetData *ResetData) ResetData->StartAddress = LoadedModules[0].text_start; ModuleEntryPoint = LoadedModules[1].EntryPoint; - ModuleEntryPoint((int)ResetData); //LOADCORE will start the bootup sequence. + ModuleEntryPoint((int)ResetData); // LOADCORE will start the bootup sequence. - //HALT loop + // HALT loop while (1) *(volatile unsigned char *)0x80000000 = 2; } @@ -593,7 +597,7 @@ static void *ParseStartAddress(const char **line) struct ExtInfoField { unsigned short int data; - unsigned short int header; //Upper 8 bits contain the type. + unsigned short int header; // Upper 8 bits contain the type. }; /* 0x000013d8 */ @@ -621,7 +625,7 @@ static const struct ExtInfoField *GetFileInfo(const struct RomdirFileStat *stat, return NULL; } -/* 0x00000878 - Scans through all loaded IOPRP images for the newest version of the specified module. */ +/* 0x00000878 - Scans through all loaded IOPRP images for the newest version of the specified module. */ static struct RomdirFileStat *SelectModuleFromImages(const struct ImageData *ImageDataBuffer, unsigned int NumFiles, const char *line, struct RomdirFileStat *stat_out) { char filename[32]; @@ -681,7 +685,7 @@ static struct RomdirFileStat *SelectModuleFromImages(const struct ImageData *Ima return result; } -//Code for debugging only - not originally present. +// Code for debugging only - not originally present. #ifdef DEBUG static void DisplayModuleName(int id, const char *line) { @@ -748,36 +752,36 @@ static void ParseIOPBTCONF(const struct ImageData *ImageDataBuffer, unsigned int ModList = &ResetData->ModData[ResetData->NumModules]; /* - I have problems seeing why this won't break down if "!include" is used in the middle of a list of modules: - Before parsing included IOPBTCONF file: - ###_____________ - | ^ - After parsing included IOPBTCONF file: - ###XXXXXXXX_____ - | ^ (The pointer would still be offset by 3, wouldn't it?) - If 2 additional modules are added to the list of modules: - ###XXXXXXXX___XX_ - | ^ (If I'm not wrong, a gap of 3 would result) - Legend: - # -> Modules loaded during the first call to ParseIOPBTCONF. - X -> Modules loaded when the included IOPBTCONF file is parsed. - | -> The base pointer to the start of the module list. - ^ -> The pointer to the end of the module list. - _ -> Blank module slots. - - $s2 seems to contain a relative pointer which points to the first blank module slot. It seems to be added to the base pointer ($s0) when the module list is accessed. - When an included IOPBTCONF file is parsed, $s0 is adjusted but $s2 is not. - - If it's by design, then it will mean that Sony had intended only one additional IOPBTCONF file to be included in each file, and it must be included at only either the absolute start or end of the file. - */ - NumModules = 0; //Therefore, unlike the Sony original, reset the module offset counter. + I have problems seeing why this won't break down if "!include" is used in the middle of a list of modules: + Before parsing included IOPBTCONF file: + ###_____________ + | ^ + After parsing included IOPBTCONF file: + ###XXXXXXXX_____ + | ^ (The pointer would still be offset by 3, wouldn't it?) + If 2 additional modules are added to the list of modules: + ###XXXXXXXX___XX_ + | ^ (If I'm not wrong, a gap of 3 would result) + Legend: + # -> Modules loaded during the first call to ParseIOPBTCONF. + X -> Modules loaded when the included IOPBTCONF file is parsed. + | -> The base pointer to the start of the module list. + ^ -> The pointer to the end of the module list. + _ -> Blank module slots. + + $s2 seems to contain a relative pointer which points to the first blank module slot. It seems to be added to the base pointer ($s0) when the module list is accessed. + When an included IOPBTCONF file is parsed, $s0 is adjusted but $s2 is not. + + If it's by design, then it will mean that Sony had intended only one additional IOPBTCONF file to be included in each file, and it must be included at only either the absolute start or end of the file. + */ + NumModules = 0; // Therefore, unlike the Sony original, reset the module offset counter. } break; case '#': /* 0x0000077c */ break; default: /* 0x00000784 */ #ifdef DEBUG - DisplayModuleName(ResetData->NumModules, ptr); //Code for debugging only - not originally present. + DisplayModuleName(ResetData->NumModules, ptr); // Code for debugging only - not originally present. #endif if (SelectModuleFromImages(ImageDataBuffer, NumFiles, ptr, &ModuleFileStat) == NULL) { __asm("break\n"); @@ -828,28 +832,28 @@ int _start(int argc, char *argv[]) struct RomdirFileStat FileStat; /* - Let f(x)=((x+2)*2+(x+2))*8, where x>0 - f(1)=((1+2)*2+(1+2))*8=72 - f(2)=((2+2)*2+(2+2))*8=96 - f(3)=((3+2)*2+(3+2))*8=120 - - Therefore, each element is 24 bytes long, with an additional 48 bytes extra allocated for the built-in IOPRP images (The boot ROM and the DATA section of the UDNL module). - - --- Original disassembly --- - ImageDataTotalSize=((argc+2)<<1); - ImageDataTotalSize=ImageDataTotalSize+(argc+2); - ImageDataTotalSize=(ImageDataTotalSize<<3); - - Note: The function reserves an additional 32-bytes of space on the stack when the function enters. - The pointers are then offset by 0x10 bytes. - $s7=$sp+0x10 <- Start of image list buffer. - $s4=$sp+0x40 <- Points to the image entries within the image list buffer. - */ + Let f(x)=((x+2)*2+(x+2))*8, where x>0 + f(1)=((1+2)*2+(1+2))*8=72 + f(2)=((2+2)*2+(2+2))*8=96 + f(3)=((3+2)*2+(3+2))*8=120 + + Therefore, each element is 24 bytes long, with an additional 48 bytes extra allocated for the built-in IOPRP images (The boot ROM and the DATA section of the UDNL module). + + --- Original disassembly --- + ImageDataTotalSize=((argc+2)<<1); + ImageDataTotalSize=ImageDataTotalSize+(argc+2); + ImageDataTotalSize=(ImageDataTotalSize<<3); + + Note: The function reserves an additional 32-bytes of space on the stack when the function enters. + The pointers are then offset by 0x10 bytes. + $s7=$sp+0x10 <- Start of image list buffer. + $s4=$sp+0x40 <- Points to the image entries within the image list buffer. + */ ImageDataTotalSize = (argc + 2) * sizeof(struct ImageData); ImageDataBuffer = alloca(ImageDataTotalSize); memset(ImageDataBuffer, 0, ImageDataTotalSize); - TotalSize = MAX_MODULES * sizeof(void *) + sizeof(struct ResetData) + ((size_IOPRP_img + 0xF) & ~0xF); //Unlike the ROM UDNL module, allocate space for the embedded IOPRP image as well like the DVD player UDNL module does. + TotalSize = MAX_MODULES * sizeof(void *) + sizeof(struct ResetData) + ((size_IOPRP_img + 0xF) & ~0xF); // Unlike the ROM UDNL module, allocate space for the embedded IOPRP image as well like the DVD player UDNL module does. #ifdef FULL_UDNL i = 1; @@ -857,10 +861,12 @@ int _start(int argc, char *argv[]) ImageData = &ImageDataBuffer[2]; while (i < argc) { if (strcmp(argv[i], "-v") != 0) { - /* if(isIllegalBootDevice(argv[i])){ //This block of commented-out code (and the commented-out isIllegalBootDevice() function) is what all Sony UDNL modules have, to prevent the loading of IOPRP images from unsecured devices. - SleepThread(); - __asm("break"); - } */ + /* + if (isIllegalBootDevice(argv[i])) { //This block of commented-out code (and the commented-out isIllegalBootDevice() function) is what all Sony UDNL modules have, to prevent the loading of IOPRP images from unsecured devices. + SleepThread(); + __asm("break"); + } + */ if ((fd = open(argv[i], O_RDONLY)) < 0) { printf("file \'%s\' can't open\n", argv[i]); @@ -907,12 +913,12 @@ int _start(int argc, char *argv[]) ImageDataBuffer[0].filename = "ROM"; } /* 0x00000398 */ - /* Originally, the Sony boot ROM UDNL module did this. However, it doesn't work well because the rest of the data used in the reset will go unprotected. The Sony DVD player UDNL modules allocate memory for the embedded IOPRP image and copies the IOPRP image into the buffer, like if it was read in from a file. - if(size_IOPRP_img>=0x10 && GetIOPRPStat(IOPRP_img, &IOPRP_img[size_IOPRP_img], &ImageDataBuffer[1].stat)!=NULL){ - ImageDataBuffer[1].filename="DATA"; - ResetData->IOPRPBuffer=(void*)((unsigned int)IOPRP_img&~0xF); - } */ - if (size_IOPRP_img >= 0x10) { //Hence, do this instead: + /* Originally, the Sony boot ROM UDNL module did this. However, it doesn't work well because the rest of the data used in the reset will go unprotected. The Sony DVD player UDNL modules allocate memory for the embedded IOPRP image and copies the IOPRP image into the buffer, like if it was read in from a file. + if(size_IOPRP_img>=0x10 && GetIOPRPStat(IOPRP_img, &IOPRP_img[size_IOPRP_img], &ImageDataBuffer[1].stat)!=NULL){ + ImageDataBuffer[1].filename="DATA"; + ResetData->IOPRPBuffer=(void*)((unsigned int)IOPRP_img&~0xF); + } */ + if (size_IOPRP_img >= 0x10) { // Hence, do this instead: memcpy(IoprpBuffer, IOPRP_img, size_IOPRP_img); if (GetIOPRPStat(IoprpBuffer, (void *)((unsigned int)IoprpBuffer + size_IOPRP_img), &ImageDataBuffer[1].stat) != NULL) { ImageDataBuffer[1].filename = "DATA"; diff --git a/modules/isofs/isofs.c b/modules/isofs/isofs.c index d4c31d780..4b5d6b5e6 100644 --- a/modules/isofs/isofs.c +++ b/modules/isofs/isofs.c @@ -8,7 +8,7 @@ #include -#define DPRINTF(args...) //printf(args) +#define DPRINTF(args...) // printf(args) struct dirTocEntry { @@ -216,7 +216,7 @@ static struct dirTocEntry *cdvdman_locatefile(char *name, u32 tocLBA, int tocLen strcpy(cdvdman_dirname, p); - //Correct filenames (for files), if necessary. + // Correct filenames (for files), if necessary. if ((p_tmp = strchr(cdvdman_dirname, '.')) != NULL) { for (i = 0, p_tmp++; i < 3 && (*p_tmp != '\0'); i++, p_tmp++) { if (p_tmp[0] == ';') @@ -394,7 +394,7 @@ static int IsofsRead(iop_file_t *f, void *buf, int size) rpos = 0; if (size > 0) { - //Phase 1: read data until the offset of the file is nicely aligned to a 2048-byte boundary. + // Phase 1: read data until the offset of the file is nicely aligned to a 2048-byte boundary. if ((offset = fh->position % 2048) != 0) { nbytes = 2048 - offset; if (size < nbytes) @@ -409,7 +409,7 @@ static int IsofsRead(iop_file_t *f, void *buf, int size) buf += nbytes; } - //Phase 2: read the data to the middle of the buffer, in units of 2048. + // Phase 2: read the data to the middle of the buffer, in units of 2048. if ((nsectors = size / 2048) > 0) { nbytes = nsectors * 2048; @@ -421,7 +421,7 @@ static int IsofsRead(iop_file_t *f, void *buf, int size) rpos += nbytes; } - //Phase 3: read any remaining data that isn't divisible by 2048. + // Phase 3: read any remaining data that isn't divisible by 2048. if ((nbytes = size) > 0) { cdEmuRead(fh->lsn + (fh->position / 2048), 1, cdvdman_fs_buf); diff --git a/modules/mcemu/mcemu.c b/modules/mcemu/mcemu.c index c0a8552e4..fc0596192 100644 --- a/modules/mcemu/mcemu.c +++ b/modules/mcemu/mcemu.c @@ -21,7 +21,7 @@ void (*pademu_hookSio2man)(Sio2Packet *sd, Sio2McProc sio2proc) = no_pademu; // Shutdown callback //--------------------------------------------------------------------------- static void mcemuShutdown(void) -{ //If necessary, implement some locking mechanism to prevent further requests from being made. +{ // If necessary, implement some locking mechanism to prevent further requests from being made. DeviceShutdown(); } @@ -49,7 +49,7 @@ int _start(int argc, char *argv[]) return readyToGo; } //------------------------------ -//endfunc _start +// endfunc _start //--------------------------------------------------------------------------- void StartNow(void *param) { @@ -97,7 +97,7 @@ void StartNow(void *param) readyToGo = MODULE_RESIDENT_END; } //------------------------------ -//endfunc _start +// endfunc _start //--------------------------------------------------------------------------- /* Installs SecrAuthCard handler for the enabled virtual memory cards */ void InstallSecrmanHook(void *exp) @@ -116,7 +116,7 @@ void InstallSecrmanHook(void *exp) } } //------------------------------ -//endfunc +// endfunc //--------------------------------------------------------------------------- /* Installs handlers for SIO2MAN's routine for enabled virtual memory cards */ void InstallSio2manHook(void *exp, int ver) @@ -128,7 +128,7 @@ void InstallSio2manHook(void *exp, int ver) pSio2man67 = HookExportEntry(exp, 67, hookSio2man67); } //------------------------------ -//endfunc +// endfunc //--------------------------------------------------------------------------- /* Install hooks for MCMAN's sceMcReadFast & sceMcWriteFast */ void InstallMcmanHook(void *exp) @@ -150,7 +150,7 @@ void InstallMcmanHook(void *exp) HookExportEntry(exp, 68, mcman68); } //------------------------------ -//endfunc +// endfunc //--------------------------------------------------------------------------- int hookDmac_request(u32 channel, void *addr, u32 size, u32 count, int dir); void hookDmac_transfer(u32 channel); @@ -229,13 +229,14 @@ int DummySecrAuthCard(int port, int slot, int cnum) // port; slot; cnum; DPRINTF("SecrAuthCard(0x%X, 0x%X, 0x%X)\n", port, slot, cnum); - // if(slot != 0) - // return 0; - + /* + if (slot != 0) + return 0; + */ return 1; } //------------------------------ -//endfunc +// endfunc //--------------------------------------------------------------------------- /* Hook for the LOADCORE's RegisterLibraryEntires call */ int hookRegisterLibraryEntires(iop_library_t *lib) @@ -284,7 +285,7 @@ int hookRegisterLibraryEntires(iop_library_t *lib) return pRegisterLibraryEntires(lib); } //------------------------------ -//endfunc +// endfunc //--------------------------------------------------------------------------- /* Hook for SIO2MAN entry #25 (called by MCMAN) */ void hookSio2man25(Sio2Packet *sd) @@ -292,7 +293,7 @@ void hookSio2man25(Sio2Packet *sd) hookSio2man(sd, pSio2man25); } //------------------------------ -//endfunc +// endfunc //--------------------------------------------------------------------------- /* Hook for SIO2MAN entry #51 (called by MC2* and PADMAN) */ void hookSio2man51(Sio2Packet *sd) @@ -300,7 +301,7 @@ void hookSio2man51(Sio2Packet *sd) hookSio2man(sd, pSio2man51); } //------------------------------ -//endfunc +// endfunc //--------------------------------------------------------------------------- /* SIO2MAN generic hook routine */ void hookSio2man(Sio2Packet *sd, Sio2McProc sio2proc) @@ -341,7 +342,7 @@ void hookSio2man(Sio2Packet *sd, Sio2McProc sio2proc) #endif } //------------------------------ -//endfunc +// endfunc //--------------------------------------------------------------------------- /* Hook for the SecrAuthCard call */ int hookSecrAuthCard(int port, int slot, int cnum) @@ -355,7 +356,7 @@ int hookSecrAuthCard(int port, int slot, int cnum) return pSecrAuthCard[port & 0x1](port, slot, cnum); } //------------------------------ -//endfunc +// endfunc //--------------------------------------------------------------------------- #define SIO2CTRL (*(volatile u32 *)(0xbf808268)) @@ -591,7 +592,7 @@ void Sio2McEmu(Sio2Packet *sd) /* DPRINTF("SIO2 status 0x%X\n", sd->iostatus); */ } //------------------------------ -//endfunc +// endfunc //--------------------------------------------------------------------------- /* Generates a "0xFF 0xFF ... 0xFF 0x2B 0x55" sequence */ void SioResponse(MemoryCard *mcd, void *buf, int length) @@ -614,7 +615,7 @@ void SioResponse(MemoryCard *mcd, void *buf, int length) p[1] = mcd->tcode; } //------------------------------ -//endfunc +// endfunc //--------------------------------------------------------------------------- /* int cslogfd = -1; int prnflag = 0; */ @@ -641,7 +642,7 @@ int MceEraseBlock(MemoryCard *mcd, int page) return 1; } //------------------------------ -//endfunc +// endfunc //--------------------------------------------------------------------------- static int do_read(MemoryCard *mcd) { @@ -668,7 +669,7 @@ int MceStartRead(MemoryCard *mcd, int page) return 1; } //------------------------------ -//endfunc +// endfunc //--------------------------------------------------------------------------- /* Reads memory card page */ int MceRead(MemoryCard *mcd, void *buf, u32 size) @@ -709,7 +710,7 @@ int MceRead(MemoryCard *mcd, void *buf, u32 size) return 1; } //------------------------------ -//endfunc +// endfunc //--------------------------------------------------------------------------- int MceStartWrite(MemoryCard *mcd, int page) { @@ -720,7 +721,7 @@ int MceStartWrite(MemoryCard *mcd, int page) return 1; } //------------------------------ -//endfunc +// endfunc //--------------------------------------------------------------------------- /* Writes memory card page */ int MceWrite(MemoryCard *mcd, void *buf, u32 size) @@ -765,7 +766,7 @@ int MceWrite(MemoryCard *mcd, void *buf, u32 size) return 1; } //------------------------------ -//endfunc +// endfunc //--------------------------------------------------------------------------- // End of file: mcemu.c //--------------------------------------------------------------------------- diff --git a/modules/mcemu/mcemu_sys.c b/modules/mcemu/mcemu_sys.c index 090fc4ea4..b37d9c233 100644 --- a/modules/mcemu/mcemu_sys.c +++ b/modules/mcemu/mcemu_sys.c @@ -31,7 +31,7 @@ void *GetExportTable(char *libname, int version) return NULL; } //------------------------------ -//endfunc +// endfunc //--------------------------------------------------------------------------- /* Returns number of entries in the export table */ u32 GetExportTableSize(void *table) @@ -49,7 +49,7 @@ u32 GetExportTableSize(void *table) return size; } //------------------------------ -//endfunc +// endfunc //--------------------------------------------------------------------------- /* Returns an entry from the export table */ void *GetExportEntry(void *table, u32 entry) @@ -65,7 +65,7 @@ void *GetExportEntry(void *table, u32 entry) return NULL; } //------------------------------ -//endfunc +// endfunc //--------------------------------------------------------------------------- /* Replaces an entry in the export table */ void *HookExportEntry(void *table, u32 entry, void *func) @@ -89,7 +89,7 @@ void *HookExportEntry(void *table, u32 entry, void *func) return NULL; } //------------------------------ -//endfunc +// endfunc //--------------------------------------------------------------------------- /* Allocates system memory on IOP */ void *_SysAlloc(u64 size) @@ -104,7 +104,7 @@ void *_SysAlloc(u64 size) return p; } //------------------------------ -//endfunc +// endfunc //--------------------------------------------------------------------------- /* Frees system memory on IOP */ int _SysFree(void *area) @@ -119,7 +119,7 @@ int _SysFree(void *area) return r; } //------------------------------ -//endfunc +// endfunc //--------------------------------------------------------------------------- /* Makes an integer value */ int GetInt(void *ptr) @@ -131,7 +131,7 @@ int GetInt(void *ptr) return p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24); } //------------------------------ -//endfunc +// endfunc //--------------------------------------------------------------------------- /* Calculates a "checksum" */ u32 CalculateEDC(u8 *buf, u32 size) @@ -147,7 +147,7 @@ u32 CalculateEDC(u8 *buf, u32 size) return x & 0xFF; } //------------------------------ -//endfunc +// endfunc //--------------------------------------------------------------------------- /* Calculates ECC for a 0x80 bytes of data */ void CalculateECC(u8 *buf, void *chk) @@ -176,7 +176,7 @@ void CalculateECC(u8 *buf, void *chk) ptr[2] = ~c3 & 0x7F; } //------------------------------ -//endfunc +// endfunc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- // End of file: mcsiosys.c diff --git a/modules/mcemu/mcemu_var.c b/modules/mcemu/mcemu_var.c index fec1c61e4..493407798 100644 --- a/modules/mcemu/mcemu_var.c +++ b/modules/mcemu/mcemu_var.c @@ -65,7 +65,7 @@ void *pFastRpcBuf; /* Pointer to buffer for RPC data for libmc cal PtrMcIo pMcRead, pMcWrite; /* Pointers to MCMAN's file I/O functions */ //------------------------------ -//end of data definitions +// end of data definitions //--------------------------------------------------------------------------- // End of file: mcsiovar.c //--------------------------------------------------------------------------- diff --git a/modules/network/SMSTCPIP/api_lib.c b/modules/network/SMSTCPIP/api_lib.c index daa6d8f84..8551c605c 100644 --- a/modules/network/SMSTCPIP/api_lib.c +++ b/modules/network/SMSTCPIP/api_lib.c @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, @@ -11,21 +11,21 @@ * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Adam Dunkels * */ diff --git a/modules/network/SMSTCPIP/api_msg.c b/modules/network/SMSTCPIP/api_msg.c index 9c684a785..ea2c6bf39 100644 --- a/modules/network/SMSTCPIP/api_msg.c +++ b/modules/network/SMSTCPIP/api_msg.c @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, @@ -11,21 +11,21 @@ * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Adam Dunkels * */ @@ -267,7 +267,7 @@ accept_function(void *arg, struct tcp_pcb *newpcb, err_t err) if (conn->callback) { (*conn->callback)(conn, NETCONN_EVT_RCVPLUS, 0); /* We have to set the callback here even though - * the new socket is unknown. Mark the socket as -1. */ + * the new socket is unknown. Mark the socket as -1. */ newconn->callback = conn->callback; newconn->socket = -1; } @@ -282,7 +282,7 @@ do_newconn(struct api_msg_msg *msg) { if (msg->conn->pcb.tcp != NULL) { /* This "new" connection already has a PCB allocated. */ - /* Is this an error condition? Should it be deleted? + /* Is this an error condition? Should it be deleted? We currently just are happy and return. */ TCPIP_APIMSG_ACK(msg->conn->mbox); return; diff --git a/modules/network/SMSTCPIP/etharp.c b/modules/network/SMSTCPIP/etharp.c index 2b6b24266..614a753b3 100644 --- a/modules/network/SMSTCPIP/etharp.c +++ b/modules/network/SMSTCPIP/etharp.c @@ -121,9 +121,10 @@ struct etharp_entry struct eth_addr ethaddr; enum etharp_state state; #if ARP_QUEUEING - /** - * Pointer to queue of pending outgoing packets on this ARP entry. - * Must be at most a single packet for now. */ + /** + * Pointer to queue of pending outgoing packets on this ARP entry. + * Must be at most a single packet for now. + */ struct pbuf *p; #endif u8_t ctime; @@ -237,17 +238,17 @@ find_arp_entry(void) #if ARP_QUEUEING /* * Enqueues a pbuf (chain) on an ARP entry. - * + * * Places the pbuf (chain) on the queue (if space allows). The * caller may safely free the pbuf (chain) afterwards, as the * pbufs will be referenced by the queue and copies are made of * pbufs referencing external payloads. - * + * * @ i the ARP entry index * @arg q the pbuf (chain) to be queued on the ARP entry - * + * * @return Returns the new head of queue of the ARP entry. - * + * */ static struct pbuf * etharp_enqueue(s8_t i, struct pbuf *q) @@ -277,9 +278,9 @@ etharp_enqueue(s8_t i, struct pbuf *q) /** * Dequeues any pbufs queued on an ARP entry - * + * * @return number of pbufs removed from the queue - * + * * TODO: decide what is a sensible return value? */ static u8_t @@ -302,7 +303,7 @@ etharp_dequeue(s8_t i) * * If a pending entry is resolved, any queued packets will be sent * at this point. - * + * * @param ipaddr IP address of the inserted ARP entry. * @param ethaddr Ethernet address of the inserted ARP entry. * @param flags Defines behaviour: @@ -457,7 +458,7 @@ void etharp_ip_input(struct netif *netif, struct pbuf *p) } /** - * Responds to ARP requests to us. Upon ARP replies to us, add entry to cache + * Responds to ARP requests to us. Upon ARP replies to us, add entry to cache * send out queued IP packets. Updates cache with snooped address pairs. * * Should be called for incoming ARP packets. The pbuf in the argument @@ -494,7 +495,7 @@ void etharp_arp_input(struct netif *netif, struct eth_addr *ethaddr, struct pbuf /* add or update entries in the ARP cache */ if (for_us) { /* insert IP address in ARP cache (assume requester wants to talk to us) - * we might even send out a queued packet to this host */ + * we might even send out a queued packet to this host */ update_arp_entry(netif, &(hdr->sipaddr), &(hdr->shwaddr), ARP_INSERT_FLAG); /* request was not directed to us, but snoop anyway */ } else { @@ -626,7 +627,7 @@ etharp_output(struct netif *netif, struct ip_addr *ipaddr, struct pbuf *q) /* destination IP address is an IP unicast address */ else { /* destination IP network address not on local network? - * IP layer wants us to forward to the default gateway */ + * IP layer wants us to forward to the default gateway */ if (!ip_addr_maskcmp(ipaddr, &(netif->ip_addr), &(netif->netmask))) { /* interface has default gateway? */ if (netif->gw.addr != 0) { @@ -671,7 +672,7 @@ etharp_output(struct netif *netif, struct ip_addr *ipaddr, struct pbuf *q) srcaddr = (struct eth_addr *)netif->hwaddr; /* A valid IP->MAC address mapping was found, fill in the - * Ethernet header for the outgoing packet */ + * Ethernet header for the outgoing packet */ ethhdr = q->payload; for (i = 0; i < netif->hwaddr_len; i++) { @@ -760,8 +761,8 @@ err_t etharp_query(struct netif *netif, struct ip_addr *ipaddr, struct pbuf *q) struct pbuf *p; /* allocate a pbuf for the outgoing ARP request packet */ /* SP193: the original used PBUF_LINK, but doesn't reveal the Ethernet header with pbuf_header(). - So other than causing alignment problems when the frame is sent to linkoutput(), - I guess it could possibly write beyond the end of the PBUF. */ + So other than causing alignment problems when the frame is sent to linkoutput(), + I guess it could possibly write beyond the end of the PBUF. */ p = pbuf_alloc(PBUF_RAW, sizeof(struct etharp_hdr), PBUF_RAM); /* could allocate pbuf? */ if (p != NULL) { @@ -772,7 +773,7 @@ err_t etharp_query(struct netif *netif, struct ip_addr *ipaddr, struct pbuf *q) for (j = 0; j < netif->hwaddr_len; ++j) { hdr->shwaddr.addr[j] = srcaddr->addr[j]; /* the hardware address is what we ask for, in - * a request it is a don't-care, we use 0's */ + * a request it is a don't-care, we use 0's */ hdr->dhwaddr.addr[j] = 0x00; } ip_addr_set(&(hdr->dipaddr), ipaddr); diff --git a/modules/network/SMSTCPIP/include/lwip/api.h b/modules/network/SMSTCPIP/include/lwip/api.h index 76416a6a0..6fc7b1feb 100644 --- a/modules/network/SMSTCPIP/include/lwip/api.h +++ b/modules/network/SMSTCPIP/include/lwip/api.h @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, @@ -11,21 +11,21 @@ * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Adam Dunkels * */ diff --git a/modules/network/SMSTCPIP/include/lwip/api_msg.h b/modules/network/SMSTCPIP/include/lwip/api_msg.h index 6d2d8f82b..0bba299a5 100644 --- a/modules/network/SMSTCPIP/include/lwip/api_msg.h +++ b/modules/network/SMSTCPIP/include/lwip/api_msg.h @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, @@ -11,21 +11,21 @@ * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Adam Dunkels * */ diff --git a/modules/network/SMSTCPIP/include/lwip/arch.h b/modules/network/SMSTCPIP/include/lwip/arch.h index 7dcb67832..cca23ebb7 100644 --- a/modules/network/SMSTCPIP/include/lwip/arch.h +++ b/modules/network/SMSTCPIP/include/lwip/arch.h @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, @@ -11,21 +11,21 @@ * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Adam Dunkels * */ diff --git a/modules/network/SMSTCPIP/include/lwip/debug.h b/modules/network/SMSTCPIP/include/lwip/debug.h index 8495f45f9..c739b4f23 100644 --- a/modules/network/SMSTCPIP/include/lwip/debug.h +++ b/modules/network/SMSTCPIP/include/lwip/debug.h @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, @@ -11,21 +11,21 @@ * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Adam Dunkels * */ diff --git a/modules/network/SMSTCPIP/include/lwip/def.h b/modules/network/SMSTCPIP/include/lwip/def.h index 397056c8d..3a03b4f3f 100644 --- a/modules/network/SMSTCPIP/include/lwip/def.h +++ b/modules/network/SMSTCPIP/include/lwip/def.h @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, @@ -11,21 +11,21 @@ * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Adam Dunkels * */ diff --git a/modules/network/SMSTCPIP/include/lwip/err.h b/modules/network/SMSTCPIP/include/lwip/err.h index 116362de5..6c4bdfce9 100644 --- a/modules/network/SMSTCPIP/include/lwip/err.h +++ b/modules/network/SMSTCPIP/include/lwip/err.h @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, @@ -11,21 +11,21 @@ * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Adam Dunkels * */ diff --git a/modules/network/SMSTCPIP/include/lwip/icmp.h b/modules/network/SMSTCPIP/include/lwip/icmp.h index e3e39706d..714d59f6f 100644 --- a/modules/network/SMSTCPIP/include/lwip/icmp.h +++ b/modules/network/SMSTCPIP/include/lwip/icmp.h @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, @@ -11,21 +11,21 @@ * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Adam Dunkels * */ diff --git a/modules/network/SMSTCPIP/include/lwip/inet.h b/modules/network/SMSTCPIP/include/lwip/inet.h index 25725fded..1e51561f0 100644 --- a/modules/network/SMSTCPIP/include/lwip/inet.h +++ b/modules/network/SMSTCPIP/include/lwip/inet.h @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, @@ -11,21 +11,21 @@ * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Adam Dunkels * */ diff --git a/modules/network/SMSTCPIP/include/lwip/ip.h b/modules/network/SMSTCPIP/include/lwip/ip.h index ac5e46770..0424e9d58 100644 --- a/modules/network/SMSTCPIP/include/lwip/ip.h +++ b/modules/network/SMSTCPIP/include/lwip/ip.h @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, @@ -11,21 +11,21 @@ * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Adam Dunkels * */ diff --git a/modules/network/SMSTCPIP/include/lwip/ip_frag.h b/modules/network/SMSTCPIP/include/lwip/ip_frag.h index 1a084f766..9b6e7a7b3 100644 --- a/modules/network/SMSTCPIP/include/lwip/ip_frag.h +++ b/modules/network/SMSTCPIP/include/lwip/ip_frag.h @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, @@ -11,21 +11,21 @@ * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Jani Monoses * */ diff --git a/modules/network/SMSTCPIP/include/lwip/mem.h b/modules/network/SMSTCPIP/include/lwip/mem.h index 7ab8a2d8a..9fd5a3fef 100644 --- a/modules/network/SMSTCPIP/include/lwip/mem.h +++ b/modules/network/SMSTCPIP/include/lwip/mem.h @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, @@ -11,21 +11,21 @@ * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Adam Dunkels * */ diff --git a/modules/network/SMSTCPIP/include/lwip/memp.h b/modules/network/SMSTCPIP/include/lwip/memp.h index dbea5dc1a..d8bb6819d 100644 --- a/modules/network/SMSTCPIP/include/lwip/memp.h +++ b/modules/network/SMSTCPIP/include/lwip/memp.h @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, @@ -11,21 +11,21 @@ * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Adam Dunkels * */ diff --git a/modules/network/SMSTCPIP/include/lwip/netif.h b/modules/network/SMSTCPIP/include/lwip/netif.h index f85ba9649..fc7a941fe 100644 --- a/modules/network/SMSTCPIP/include/lwip/netif.h +++ b/modules/network/SMSTCPIP/include/lwip/netif.h @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, @@ -11,21 +11,21 @@ * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Adam Dunkels * */ diff --git a/modules/network/SMSTCPIP/include/lwip/opt.h b/modules/network/SMSTCPIP/include/lwip/opt.h index 571b5eeb3..f5df98890 100644 --- a/modules/network/SMSTCPIP/include/lwip/opt.h +++ b/modules/network/SMSTCPIP/include/lwip/opt.h @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, @@ -11,21 +11,21 @@ * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Adam Dunkels * */ @@ -199,7 +199,7 @@ a lot of data that needs to be copied, this should be set high. */ #endif /** If enabled, the first packet queued will not be overwritten by * later packets. If disabled, later packets overwrite early packets - * in the queue. Default is disabled, which is recommended. + * in the queue. Default is disabled, which is recommended. */ #ifndef ARP_QUEUE_FIRST #define ARP_QUEUE_FIRST 0 diff --git a/modules/network/SMSTCPIP/include/lwip/pbuf.h b/modules/network/SMSTCPIP/include/lwip/pbuf.h index 2fbac695c..8b08454b6 100644 --- a/modules/network/SMSTCPIP/include/lwip/pbuf.h +++ b/modules/network/SMSTCPIP/include/lwip/pbuf.h @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, @@ -11,21 +11,21 @@ * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Adam Dunkels * */ @@ -72,12 +72,12 @@ struct pbuf void *payload; /** - * total length of this buffer and all next buffers in chain - * belonging to the same packet. - * - * For non-queue packet chains this is the invariant: - * p->tot_len == p->len + (p->next? p->next->tot_len: 0) - */ + * total length of this buffer and all next buffers in chain + * belonging to the same packet. + * + * For non-queue packet chains this is the invariant: + * p->tot_len == p->len + (p->next? p->next->tot_len: 0) + */ u16_t tot_len; /* length of this buffer */ @@ -87,10 +87,10 @@ struct pbuf u16_t flags; /** - * the reference count always equals the number of pointers - * that refer to this pbuf. This can be pointers from an application, - * the stack itself, or pbuf->next pointers from a chain. - */ + * the reference count always equals the number of pointers + * that refer to this pbuf. This can be pointers from an application, + * the stack itself, or pbuf->next pointers from a chain. + */ u16_t ref; }; diff --git a/modules/network/SMSTCPIP/include/lwip/snmp.h b/modules/network/SMSTCPIP/include/lwip/snmp.h index 7493e6ae8..ba65c045c 100644 --- a/modules/network/SMSTCPIP/include/lwip/snmp.h +++ b/modules/network/SMSTCPIP/include/lwip/snmp.h @@ -2,8 +2,8 @@ * Copyright (c) 2001, 2002 Leon Woestenberg * Copyright (c) 2001, 2002 Axon Digital Design B.V., The Netherlands. * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, @@ -12,21 +12,21 @@ * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Leon Woestenberg * */ diff --git a/modules/network/SMSTCPIP/include/lwip/sockets.h b/modules/network/SMSTCPIP/include/lwip/sockets.h index cf1d3795f..f954ad32d 100644 --- a/modules/network/SMSTCPIP/include/lwip/sockets.h +++ b/modules/network/SMSTCPIP/include/lwip/sockets.h @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, @@ -11,21 +11,21 @@ * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Adam Dunkels * */ diff --git a/modules/network/SMSTCPIP/include/lwip/stats.h b/modules/network/SMSTCPIP/include/lwip/stats.h index d60c712ea..23b5337fd 100644 --- a/modules/network/SMSTCPIP/include/lwip/stats.h +++ b/modules/network/SMSTCPIP/include/lwip/stats.h @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, @@ -11,21 +11,21 @@ * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Adam Dunkels * */ diff --git a/modules/network/SMSTCPIP/include/lwip/sys.h b/modules/network/SMSTCPIP/include/lwip/sys.h index 16872ae4d..4a371be8c 100644 --- a/modules/network/SMSTCPIP/include/lwip/sys.h +++ b/modules/network/SMSTCPIP/include/lwip/sys.h @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, @@ -11,21 +11,21 @@ * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Adam Dunkels * */ @@ -71,7 +71,7 @@ struct sys_timeout /* Semaphore functions. */ sys_sem_t sys_sem_new(u8_t count); -//void sys_sem_signal(sys_sem_t sem); +// void sys_sem_signal(sys_sem_t sem); #define sys_sem_signal(s) SignalSema(s) u32_t sys_arch_sem_wait(sys_sem_t sem, u32_t timeout); @@ -127,7 +127,7 @@ unsigned long sys_now(void); * different implementation, then this macro may be defined in sys_arch.h */ #define SYS_ARCH_PROTECT(lev) CpuSuspendIntr(&lev) -//lev = sys_arch_protect() +// lev = sys_arch_protect() /** SYS_ARCH_UNPROTECT * Perform a "fast" set of the protection level to "lev". This could be * implemented by setting the interrupt level to "lev" within the MACRO or by @@ -137,9 +137,9 @@ unsigned long sys_now(void); * this macro may be defined in sys_arch.h */ #define SYS_ARCH_UNPROTECT(lev) CpuResumeIntr(lev) -//sys_arch_unprotect(lev) -//sys_prot_t sys_arch_protect(void); -//void sys_arch_unprotect(sys_prot_t pval); +// sys_arch_unprotect(lev) +// sys_prot_t sys_arch_protect(void); +// void sys_arch_unprotect(sys_prot_t pval); #else diff --git a/modules/network/SMSTCPIP/include/lwip/tcp.h b/modules/network/SMSTCPIP/include/lwip/tcp.h index 74b8ed780..806cae9ca 100644 --- a/modules/network/SMSTCPIP/include/lwip/tcp.h +++ b/modules/network/SMSTCPIP/include/lwip/tcp.h @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, @@ -11,21 +11,21 @@ * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Adam Dunkels * */ @@ -334,9 +334,9 @@ struct tcp_pcb_listen struct tcp_pcb_listen *next; /* for the linked list */ /* Even if state is obviously LISTEN this is here for - * field compatibility with tpc_pcb to which it is cast sometimes - * Until a cleaner solution emerges this is here.FIXME - */ + * field compatibility with tpc_pcb to which it is cast sometimes + * Until a cleaner solution emerges this is here.FIXME + */ enum tcp_state state; /* TCP state */ u8_t prio; @@ -482,7 +482,7 @@ extern struct tcp_pcb *tcp_tw_pcbs; /* List of all TCP PCBs in TIME-W extern struct tcp_pcb *tcp_tmp_pcb; /* Only used for temporary storage. */ -/* Axioms about the above lists: +/* Axioms about the above lists: 1) Every TCP PCB that is not CLOSED is in one of the lists. 2) A PCB is only in one of the lists. 3) All PCBs in the tcp_listen_pcbs list is in LISTEN state. diff --git a/modules/network/SMSTCPIP/include/lwip/tcpip.h b/modules/network/SMSTCPIP/include/lwip/tcpip.h index 18c496eba..043aaef35 100644 --- a/modules/network/SMSTCPIP/include/lwip/tcpip.h +++ b/modules/network/SMSTCPIP/include/lwip/tcpip.h @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, @@ -11,21 +11,21 @@ * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Adam Dunkels * */ diff --git a/modules/network/SMSTCPIP/include/lwip/timers.h b/modules/network/SMSTCPIP/include/lwip/timers.h index 07d681a92..c0bd9f4f1 100644 --- a/modules/network/SMSTCPIP/include/lwip/timers.h +++ b/modules/network/SMSTCPIP/include/lwip/timers.h @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2004 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, @@ -11,21 +11,21 @@ * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Adam Dunkels * Simon Goldschmidt * diff --git a/modules/network/SMSTCPIP/include/lwip/udp.h b/modules/network/SMSTCPIP/include/lwip/udp.h index 30f556d6c..8cbc86849 100644 --- a/modules/network/SMSTCPIP/include/lwip/udp.h +++ b/modules/network/SMSTCPIP/include/lwip/udp.h @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, @@ -11,21 +11,21 @@ * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Adam Dunkels * */ diff --git a/modules/network/SMSTCPIP/include/lwipopts.h b/modules/network/SMSTCPIP/include/lwipopts.h index 49469c4b0..eeb364d91 100644 --- a/modules/network/SMSTCPIP/include/lwipopts.h +++ b/modules/network/SMSTCPIP/include/lwipopts.h @@ -12,7 +12,7 @@ * ATTENTION: this does not work when tcpip_input() is called from * interrupt context! */ -//#define LWIP_TCPIP_CORE_LOCKING_INPUT 1 //Not supported because of the in-game SMAP driver's design (will deadlock). +// #define LWIP_TCPIP_CORE_LOCKING_INPUT 1 //Not supported because of the in-game SMAP driver's design (will deadlock). /* ---------- Memory options ---------- */ /** @@ -70,7 +70,7 @@ a lot of data that needs to be copied, this should be set high. */ /* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active timeouts. */ -//Only used by tcpip.c, which will be used for IP reassembly and ARP. +// Only used by tcpip.c, which will be used for IP reassembly and ARP. #define MEMP_NUM_SYS_TIMEOUT 1 /* MEMP_NUM_NETCONN: the number of struct netconns. */ @@ -103,8 +103,8 @@ a lot of data that needs to be copied, this should be set high. */ #endif /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */ -//Boman666: Should be atleast 1518 to be compatible with ps2smap -//TCP_MSS+TCP header+IP header+PBUF_LINK_HLEN = 1460 + 20 + 20 + 14 = 1514 +// Boman666: Should be atleast 1518 to be compatible with ps2smap +// TCP_MSS+TCP header+IP header+PBUF_LINK_HLEN = 1460 + 20 + 20 + 14 = 1514 #define PBUF_POOL_BUFSIZE 1540 /* PBUF_LINK_HLEN: the number of bytes that should be allocated for a @@ -114,7 +114,7 @@ a lot of data that needs to be copied, this should be set high. */ /** SYS_LIGHTWEIGHT_PROT * define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection - * for certain critical regions during buffer allocation, deallocation and + * for certain critical regions during buffer allocation, deallocation and * memory allocation and deallocation. */ #define SYS_LIGHTWEIGHT_PROT 1 @@ -170,7 +170,7 @@ a lot of data that needs to be copied, this should be set high. */ * If defined to 0, only existing cache entries are updated. Entries are added when * lwIP is sending to them. Recommended for embedded devices. */ -//Do not always insert ARP entries, as the ARP table is small. +// Do not always insert ARP entries, as the ARP table is small. #define ETHARP_ALWAYS_INSERT 0 /* ---------- IP options ---------- */ @@ -200,7 +200,7 @@ a lot of data that needs to be copied, this should be set high. */ /** * DHCP_DOES_ARP_CHECK==1: Do an ARP check on the offered address. */ -#define DHCP_DOES_ARP_CHECK 0 //Don't do the ARP check because an IP address would be first required. +#define DHCP_DOES_ARP_CHECK 0 // Don't do the ARP check because an IP address would be first required. #else @@ -235,58 +235,58 @@ a lot of data that needs to be copied, this should be set high. */ #define RAW_STATS 1 #endif /*LWIP_STATS*/ -//Boman666: This define will force the TX-data to be splitted in an even number of TCP-segments. This will significantly increase -//the upload speed, atleast on my configuration (PC - WinXP). -//#define PS2IP_EVEN_TCP_SEG -//spooo: -// It is a normal TCP behaviour that small data are delayed. This is -// Nagle's algorithm. If you don't want it there's a legal way of -// preventing delayed data which is the TCP_NODELAY option. +// Boman666: This define will force the TX-data to be splitted in an even number of TCP-segments. This will significantly increase +// the upload speed, atleast on my configuration (PC - WinXP). +//#define PS2IP_EVEN_TCP_SEG +// spooo: +// It is a normal TCP behaviour that small data are delayed. This is +// Nagle's algorithm. If you don't want it there's a legal way of +// preventing delayed data which is the TCP_NODELAY option. // -// I'm not really sure, here are my thoughts about Boman666's patch: +// I'm not really sure, here are my thoughts about Boman666's patch: // -// - This patch hard-breaks (compile time define) this old grandma-TCP -// behaviour, I'm not sure it is safe. +// - This patch hard-breaks (compile time define) this old grandma-TCP +// behaviour, I'm not sure it is safe. // -// - I suspect a possible loss of performance (I have experienced a 1/7 -// waste time on a not only networking algorithm) because in case -// that ps2 has to send small packets (sort of response to a query) -// of 2N bytes length, two packets of N bytes size are sent. Which is -// more overhead: 2*(40+N bytes + latency) instead of (40+2N + -// latency). +// - I suspect a possible loss of performance (I have experienced a 1/7 +// waste time on a not only networking algorithm) because in case +// that ps2 has to send small packets (sort of response to a query) +// of 2N bytes length, two packets of N bytes size are sent. Which is +// more overhead: 2*(40+N bytes + latency) instead of (40+2N + +// latency). // -// - I am aware that this patch improves other things, and I have not -// tested this myself yet. +// - I am aware that this patch improves other things, and I have not +// tested this myself yet. // -// - I don't really understand the effects of this patch: -// My understanding is that XP ("this" XP stack used with "this" -// protocol, check iop/tcpip/lwip/src/core/tcp_out.c) needs ps2 TCP -// acks to work efficiently (to send more quickly not waiting TCP -// 200ms). +// - I don't really understand the effects of this patch: +// My understanding is that XP ("this" XP stack used with "this" +// protocol, check iop/tcpip/lwip/src/core/tcp_out.c) needs ps2 TCP +// acks to work efficiently (to send more quickly not waiting TCP +// 200ms). // -// - I provide two runtime setsockopt()-configurable replacements +// - I provide two runtime setsockopt()-configurable replacements // -// In replacement, and to make people test with their apps, I added two -// new socket (TCP level) options which are: +// In replacement, and to make people test with their apps, I added two +// new socket (TCP level) options which are: // -// - TCP_EVENSEG - it re-enables the original Boman666's patch -// - TCP_ACKNODELAY - This option forces an ack to be sent -// at every data packet received. -// To activate or not these option *at runtime* (not compile time), use the same -// syntax as standard TCP_NODELAY: -// int ret, value = 1; /* or 0 */ -// ret = lwip_setsockopt(socket, IPPROTO_TCP, TCP_NODELAY, &value, sizeof(value)); -// To read option value: -// int ret, value, -// int valuesize = sizeof(value); -// ret = lwip_getsockopt(socket, IPPROTO_TCP, TCP_NODELAY, &value, &valuesize); -// printf("TCP_ACKNODELAY state: %i\n", ret == 0? value: -1); +// - TCP_EVENSEG - it re-enables the original Boman666's patch +// - TCP_ACKNODELAY - This option forces an ack to be sent +// at every data packet received. +// To activate or not these option *at runtime* (not compile time), use the same +// syntax as standard TCP_NODELAY: +// int ret, value = 1; /* or 0 */ +// ret = lwip_setsockopt(socket, IPPROTO_TCP, TCP_NODELAY, &value, sizeof(value)); +// To read option value: +// int ret, value, +// int valuesize = sizeof(value); +// ret = lwip_getsockopt(socket, IPPROTO_TCP, TCP_NODELAY, &value, &valuesize); +// printf("TCP_ACKNODELAY state: %i\n", ret == 0? value: -1); // -// setsockopt/getsockopt are POSIX, manual is available everywhere. They were not -// exported in ps2ip symbol list, I've added them. -// One should check performance penalty or improvement by activating any combination -// of these three options. The only one which is standard is TCP_NODELAY. -// By default, everything is not active. +// setsockopt/getsockopt are POSIX, manual is available everywhere. They were not +// exported in ps2ip symbol list, I've added them. +// One should check performance penalty or improvement by activating any combination +// of these three options. The only one which is standard is TCP_NODELAY. +// By default, everything is not active. /* -------------------------------------- @@ -294,7 +294,7 @@ a lot of data that needs to be copied, this should be set high. */ -------------------------------------- */ #ifdef INGAME_DRIVER -//Disable all higher-level checksum verification mechanisms for performance, relying on the MAC-level checksum. +// Disable all higher-level checksum verification mechanisms for performance, relying on the MAC-level checksum. /** * CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets. */ diff --git a/modules/network/SMSTCPIP/include/netif/etharp.h b/modules/network/SMSTCPIP/include/netif/etharp.h index 97a8bf6d8..56d90968b 100644 --- a/modules/network/SMSTCPIP/include/netif/etharp.h +++ b/modules/network/SMSTCPIP/include/netif/etharp.h @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, @@ -11,21 +11,21 @@ * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Adam Dunkels * */ diff --git a/modules/network/SMSTCPIP/include/netif/loopif.h b/modules/network/SMSTCPIP/include/netif/loopif.h index 086f81219..c80ec28c6 100644 --- a/modules/network/SMSTCPIP/include/netif/loopif.h +++ b/modules/network/SMSTCPIP/include/netif/loopif.h @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, @@ -11,21 +11,21 @@ * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Adam Dunkels * */ diff --git a/modules/network/SMSTCPIP/ip_addr.c b/modules/network/SMSTCPIP/ip_addr.c index 4b2da68fb..1ff0d6cad 100644 --- a/modules/network/SMSTCPIP/ip_addr.c +++ b/modules/network/SMSTCPIP/ip_addr.c @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, @@ -11,21 +11,21 @@ * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Adam Dunkels * */ diff --git a/modules/network/SMSTCPIP/ip_frag.c b/modules/network/SMSTCPIP/ip_frag.c index 6a3983c24..fe4661f2d 100644 --- a/modules/network/SMSTCPIP/ip_frag.c +++ b/modules/network/SMSTCPIP/ip_frag.c @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, @@ -11,24 +11,24 @@ * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * - * Author: Jani Monoses + * + * Author: Jani Monoses * original reassembly code by Adam Dunkels - * + * */ @@ -53,7 +53,7 @@ #include "smsutils.h" /* - * Copy len bytes from offset in pbuf to buffer + * Copy len bytes from offset in pbuf to buffer * * helper used by both ip_reass and ip_frag */ @@ -308,11 +308,11 @@ err_t ip_frag(struct pbuf *p, struct netif *netif, struct ip_addr *dest) if (last) pbuf_realloc(rambuf, left + IP_HLEN); - /* This part is ugly: we alloc a RAM based pbuf for - * the link level header for each chunk and then - * free it.A PBUF_ROM style pbuf for which pbuf_header - * worked would make things simpler. - */ + /* This part is ugly: we alloc a RAM based pbuf for + * the link level header for each chunk and then + * free it.A PBUF_ROM style pbuf for which pbuf_header + * worked would make things simpler. + */ header = pbuf_alloc(PBUF_LINK, 0, PBUF_RAM); pbuf_chain(header, rambuf); netif->output(netif, header, dest); diff --git a/modules/network/SMSTCPIP/loopif.c b/modules/network/SMSTCPIP/loopif.c index c75a7f023..ac932410f 100644 --- a/modules/network/SMSTCPIP/loopif.c +++ b/modules/network/SMSTCPIP/loopif.c @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, @@ -11,21 +11,21 @@ * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Adam Dunkels * */ @@ -84,14 +84,14 @@ loopif_output(struct netif *netif, struct pbuf *p, arg[0] = netif; arg[1] = r; /** - * workaround (patch #1779) to try to prevent bug #2595: - * When connecting to "localhost" with the loopif interface, - * tcp_output doesn't get the opportunity to finnish sending the - * segment before tcp_process gets it, resulting in tcp_process - * referencing pcb->unacked-> which still is NULL. - * - * TODO: Is there still a race condition here? Leon - */ + * workaround (patch #1779) to try to prevent bug #2595: + * When connecting to "localhost" with the loopif interface, + * tcp_output doesn't get the opportunity to finnish sending the + * segment before tcp_process gets it, resulting in tcp_process + * referencing pcb->unacked-> which still is NULL. + * + * TODO: Is there still a race condition here? Leon + */ sys_timeout(1, loopif_input, arg); return ERR_OK; diff --git a/modules/network/SMSTCPIP/mem.c b/modules/network/SMSTCPIP/mem.c index b56b94934..39b9f3bb6 100644 --- a/modules/network/SMSTCPIP/mem.c +++ b/modules/network/SMSTCPIP/mem.c @@ -4,11 +4,11 @@ * */ -/* +/* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, @@ -17,21 +17,21 @@ * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Adam Dunkels * */ @@ -188,8 +188,8 @@ void mem_init(void) { struct mem *mem; - //Boman666: Originally ram was the array now called ramblock. I didn't experience any problem but ram could end up incorrecly - //aligned, causing a crash. + // Boman666: Originally ram was the array now called ramblock. I didn't experience any problem but ram could end up incorrecly + // aligned, causing a crash. ram = MEM_ALIGN(ramblock + MEM_ALIGNMENT - 1); mips_memset(ram, 0, MEM_SIZE); mem = (struct mem *)ram; diff --git a/modules/network/SMSTCPIP/memp.c b/modules/network/SMSTCPIP/memp.c index 104a32085..784a412c5 100644 --- a/modules/network/SMSTCPIP/memp.c +++ b/modules/network/SMSTCPIP/memp.c @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, @@ -11,21 +11,21 @@ * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Adam Dunkels * */ diff --git a/modules/network/SMSTCPIP/netif.c b/modules/network/SMSTCPIP/netif.c index 537c011ef..206ea0ca7 100644 --- a/modules/network/SMSTCPIP/netif.c +++ b/modules/network/SMSTCPIP/netif.c @@ -189,7 +189,7 @@ void netif_set_ipaddr(struct netif *netif, struct ip_addr *ipaddr) /* PCB bound to current local interface address? */ if (ip_addr_cmp(&(lpcb->local_ip), &(netif->ip_addr))) { /* The PCB is listening to the old ipaddr and - * is set to listen to the new one instead */ + * is set to listen to the new one instead */ ip_addr_set(&(lpcb->local_ip), ipaddr); } } diff --git a/modules/network/SMSTCPIP/pbuf.c b/modules/network/SMSTCPIP/pbuf.c index d39c08631..1b8cb8e84 100644 --- a/modules/network/SMSTCPIP/pbuf.c +++ b/modules/network/SMSTCPIP/pbuf.c @@ -312,10 +312,10 @@ pbuf_alloc(pbuf_layer l, u16_t length, pbuf_flag flag) } /* Set up internal structure of the pbuf. */ - //Boman666: The memory isn't allocated to allow payload to be aligned. If payload is aligned according to the commented out - //line the last two bytes in payload will be located outside the allocated memoryblock. Which will have the effect of - //screwing up the memory-allocation structures, causing a crash. - // p->payload = MEM_ALIGN((void *)((u8_t *)p + sizeof(struct pbuf) + offset)); + // Boman666: The memory isn't allocated to allow payload to be aligned. If payload is aligned according to the commented out + // line the last two bytes in payload will be located outside the allocated memoryblock. Which will have the effect of + // screwing up the memory-allocation structures, causing a crash. + // p->payload = MEM_ALIGN((void *)((u8_t *)p + sizeof(struct pbuf) + offset)); p->payload = (void *)((u8_t *)p + sizeof(struct pbuf) + offset); p->len = p->tot_len = length; @@ -413,7 +413,7 @@ void pbuf_realloc(struct pbuf *p, u16_t new_len) } /* the pbuf chain grows by (new_len - p->tot_len) bytes - * (which may be negative in case of shrinking) */ + * (which may be negative in case of shrinking) */ grow = new_len - p->tot_len; /* first, step over any pbufs that should remain in the chain */ @@ -497,7 +497,7 @@ u8_t pbuf_header(struct pbuf *p, s16_t header_size) p->payload = (u8_t *)p->payload - header_size; } else { /* cannot expand payload to front (yet!) - * bail out unsuccesfully */ + * bail out unsuccesfully */ return 1; } } @@ -533,7 +533,7 @@ u8_t pbuf_header(struct pbuf *p, s16_t header_size) * * Assuming existing chains a->b->c with the following reference * counts, calling pbuf_free(a) results in: - * + * * 1->2->3 becomes ...1->3 * 3->3->3 becomes 2->3->3 * 1->1->2 becomes ......1 @@ -559,11 +559,11 @@ u8_t pbuf_free(struct pbuf *p) count = 0; /* Since decrementing ref cannot be guaranteed to be a single machine operation - * we must protect it. Also, the later test of ref must be protected. - */ + * we must protect it. Also, the later test of ref must be protected. + */ SYS_ARCH_PROTECT(old_level); /* de-allocate all consecutive pbufs from the head of the chain that - * obtain a zero reference count after decrementing*/ + * obtain a zero reference count after decrementing*/ while (p != NULL) { /* all pbufs in a chain are referenced at least once */ LWIP_ASSERT("pbuf_free: p->ref > 0", p->ref > 0); @@ -643,10 +643,10 @@ void pbuf_ref(struct pbuf *p) /** * Concatenate two pbufs (each may be a pbuf chain) and take over * the caller's reference of the tail pbuf. - * + * * @note The caller MAY NOT reference the tail pbuf afterwards. * Use pbuf_chain() for that purpose. - * + * * @see pbuf_chain() */ @@ -674,10 +674,10 @@ void pbuf_cat(struct pbuf *h, struct pbuf *t) /** * Chain two pbufs (or pbuf chains) together. - * + * * The caller MUST call pbuf_free(t) once it has stopped * using it. Use pbuf_cat() instead if you no longer use t. - * + * * @param h head pbuf (chain) * @param t tail pbuf (chain) * @note The pbufs MUST belong to the same packet. @@ -771,12 +771,12 @@ pbuf_take(struct pbuf *p) q->tot_len = p->tot_len; q->len = p->len; /* in case p was the first pbuf, it is no longer refered to by - * our caller, as the caller MUST do p = pbuf_take(p); - * in case p was not the first pbuf, it is no longer refered to - * by prev. we can safely free the pbuf here. - * (note that we have set p->next to NULL already so that - * we will not free the rest of the chain by accident.) - */ + * our caller, as the caller MUST do p = pbuf_take(p); + * in case p was not the first pbuf, it is no longer refered to + * by prev. we can safely free the pbuf here. + * (note that we have set p->next to NULL already so that + * we will not free the rest of the chain by accident.) + */ pbuf_free(p); /* do not copy ref, since someone else might be using the old buffer */ LWIP_DEBUGF(PBUF_DEBUG, ("pbuf_take: replaced PBUF_REF %p with %p\n", (void *)p, (void *)q)); diff --git a/modules/network/SMSTCPIP/ps2ip.c b/modules/network/SMSTCPIP/ps2ip.c index 941c8eb92..f00bdd969 100644 --- a/modules/network/SMSTCPIP/ps2ip.c +++ b/modules/network/SMSTCPIP/ps2ip.c @@ -208,10 +208,10 @@ extern sys_mbox_t g_TCPIPMBox; err_t ps2ip_input(struct pbuf *pInput, struct netif *pNetIF) { - //When ps2smap receive data, it invokes this function. It'll be called directly by the interrupthandler, which means we are - //running in an interrupt-context. We'll pass on the data to the tcpip message-thread by adding a callback message. If the - //messagebox is full, we can't wait for the tcpip-thread to process a message to make room for our message, since we're - //in interrupt-context. If the messagebox or messagequeue is full, drop the packet. + // When ps2smap receive data, it invokes this function. It'll be called directly by the interrupthandler, which means we are + // running in an interrupt-context. We'll pass on the data to the tcpip message-thread by adding a callback message. If the + // messagebox is full, we can't wait for the tcpip-thread to process a message to make room for our message, since we're + // in interrupt-context. If the messagebox or messagequeue is full, drop the packet. InputMSG *pIMSG; struct tcpip_msg *pMSG; @@ -219,10 +219,10 @@ err_t ps2ip_input(struct pbuf *pInput, struct netif *pNetIF) pbuf_free(pInput); return ERR_OK; } /* end if */ - //Allocate messagequeue entry. + // Allocate messagequeue entry. pIMSG = &aMSGs[u8LastMSG]; u8LastMSG = GetNextMSGQueueIndex(u8LastMSG); - //Initialize the InputMSG. + // Initialize the InputMSG. pIMSG->pInput = pInput; pIMSG->pNetIF = pNetIF; pMSG = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG); @@ -243,21 +243,21 @@ err_t ps2ip_input(struct pbuf *pInput, struct netif *pNetIF) #else err_t ps2ip_input(struct pbuf *pInput, struct netif *pNetIF) { - // switch(htons(((struct eth_hdr*)(pInput->payload))->type)) // Don't know why, but using htons will cause this function to not work in the SMS LWIP stack. + // switch(htons(((struct eth_hdr*)(pInput->payload))->type)) // Don't know why, but using htons will cause this function to not work in the SMS LWIP stack. switch (((struct eth_hdr *)(pInput->payload))->type) { case ETHTYPE_IP: - //IP-packet. Update ARP table, obtain first queued packet. + // IP-packet. Update ARP table, obtain first queued packet. etharp_ip_input(pNetIF, pInput); pbuf_header(pInput, (int)-sizeof(struct eth_hdr)); pNetIF->input(pInput, pNetIF); break; case ETHTYPE_ARP: - //ARP-packet. Pass pInput to ARP module, get ARP reply or ARP queued packet. - //Pass to network layer. + // ARP-packet. Pass pInput to ARP module, get ARP reply or ARP queued packet. + // Pass to network layer. etharp_arp_input(pNetIF, (struct eth_addr *)&pNetIF->hwaddr, pInput); - //Fall through: The SMS LWIP stack was modified, and etharp_arp_input does not free the PBUF on its own. + // Fall through: The SMS LWIP stack was modified, and etharp_arp_input does not free the PBUF on its own. default: - //Unsupported ethernet packet-type. Free pInput. + // Unsupported ethernet packet-type. Free pInput. pbuf_free(pInput); } @@ -438,7 +438,7 @@ u32_t sys_arch_mbox_fetch(sys_mbox_t pMBox, void **ppvMSG, u32_t u32Timeout) } /* end while */ - if (ppvMSG != NULL) //This pointer may be NULL. + if (ppvMSG != NULL) // This pointer may be NULL. *ppvMSG = pMBox->apvMSG[pMBox->u16First]; pMBox->u16First = GenNextMBoxIndex(pMBox->u16First); @@ -554,7 +554,7 @@ void ps2ip_mem_free(void *rmem) } /* Only pbuf_realloc() uses mem_realloc(), which uses this function. - As pbuf_realloc can only shrink PBUFs, I don't think SYSMEM will fail to allocate a smaller region. */ + As pbuf_realloc can only shrink PBUFs, I don't think SYSMEM will fail to allocate a smaller region. */ void *ps2ip_mem_realloc(void *rmem, int newsize) { int OldState; diff --git a/modules/network/SMSTCPIP/sockets.c b/modules/network/SMSTCPIP/sockets.c index bfd5d409e..5631699d1 100644 --- a/modules/network/SMSTCPIP/sockets.c +++ b/modules/network/SMSTCPIP/sockets.c @@ -341,7 +341,7 @@ int lwip_listen(int s, int backlog) return 0; } -//Note: This function was modified so that the SMB header can be retrieved directly and the payload stored separately from it. +// Note: This function was modified so that the SMB header can be retrieved directly and the payload stored separately from it. int lwip_recvfrom(int s, void *header, int index, void *payload, int plen, unsigned int flags, struct sockaddr *from, socklen_t *fromlen) { @@ -391,7 +391,7 @@ int lwip_recvfrom(int s, void *header, int index, void *payload, int plen, unsig if (index) { if (avail_len >= 63) { // header of (SMB command) READ ANDX RESPONSE is 63 + padding bytes, which are "0x00" thus useless netbuf_copy_partial(buf, header, 63, sock->lastoffset); - index = ((u8_t *)header)[index] + 4; //The word at offset 0 is sessionHeader, which Microsoft doesn't consider as being part of the SMB header. + index = ((u8_t *)header)[index] + 4; // The word at offset 0 is sessionHeader, which Microsoft doesn't consider as being part of the SMB header. copylen = index; avail_len -= index; } else { diff --git a/modules/network/SMSTCPIP/tcp.c b/modules/network/SMSTCPIP/tcp.c index b3fd31cc5..42c06b6fd 100644 --- a/modules/network/SMSTCPIP/tcp.c +++ b/modules/network/SMSTCPIP/tcp.c @@ -6,9 +6,9 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, @@ -17,21 +17,21 @@ * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Adam Dunkels * */ @@ -273,17 +273,17 @@ err_t tcp_bind(struct tcp_pcb *pcb, struct ip_addr *ipaddr, u16_t port) } } #else /* SO_REUSE */ - /* Search through list of PCB's in LISTEN state. - + /* Search through list of PCB's in LISTEN state. + If there is a PCB bound to specified port and IP_ADDR_ANY another PCB can be bound to the interface IP - or to the loopback address on the same port if SOF_REUSEADDR is set. Any combination of PCB's bound to + or to the loopback address on the same port if SOF_REUSEADDR is set. Any combination of PCB's bound to the same local port, but to one address out of {IP_ADDR_ANY, 127.0.0.1, interface IP} at a time is valid. But no two PCB's bound to same local port and same local address is valid. - - If SOF_REUSEPORT is set several PCB's can be bound to same local port and same local address also. But then + + If SOF_REUSEPORT is set several PCB's can be bound to same local port and same local address also. But then all PCB's must have the SOF_REUSEPORT option set. - - When the two options aren't set and specified port is already bound, ERR_USE is returned saying that + + When the two options aren't set and specified port is already bound, ERR_USE is returned saying that address is already in use. */ for (cpcb = (struct tcp_pcb *)tcp_listen_pcbs; cpcb != NULL; cpcb = cpcb->next) { if (cpcb->local_port == port) { @@ -307,7 +307,7 @@ err_t tcp_bind(struct tcp_pcb *pcb, struct ip_addr *ipaddr, u16_t port) } } - /* Search through list of PCB's in a state in which they can accept or send data. Same decription as for + /* Search through list of PCB's in a state in which they can accept or send data. Same decription as for PCB's in state LISTEN applies to this PCB's regarding the options SOF_REUSEADDR and SOF_REUSEPORT. */ for (cpcb = tcp_active_pcbs; cpcb != NULL; cpcb = cpcb->next) { if (cpcb->local_port == port) { @@ -331,13 +331,13 @@ err_t tcp_bind(struct tcp_pcb *pcb, struct ip_addr *ipaddr, u16_t port) } } - /* Search through list of PCB's in TIME_WAIT state. If SO_REUSEADDR is set a bound combination [IP, port} - can be rebound. The same applies when SOF_REUSEPORT is set. - - If SOF_REUSEPORT is set several PCB's can be bound to same local port and same local address also. But then + /* Search through list of PCB's in TIME_WAIT state. If SO_REUSEADDR is set a bound combination [IP, port} + can be rebound. The same applies when SOF_REUSEPORT is set. + + If SOF_REUSEPORT is set several PCB's can be bound to same local port and same local address also. But then all PCB's must have the SOF_REUSEPORT option set. - - When the two options aren't set and specified port is already bound, ERR_USE is returned saying that + + When the two options aren't set and specified port is already bound, ERR_USE is returned saying that address is already in use. */ for (cpcb = tcp_tw_pcbs; cpcb != NULL; cpcb = cpcb->next) { if (cpcb->local_port == port) { @@ -353,7 +353,7 @@ err_t tcp_bind(struct tcp_pcb *pcb, struct ip_addr *ipaddr, u16_t port) } } - /* If SOF_REUSEPORT isn't set in all PCB's bound to specified port and local address specified then + /* If SOF_REUSEPORT isn't set in all PCB's bound to specified port and local address specified then {IP, port} can't be reused. */ if (!reuse_port_all_set) { LWIP_DEBUGF(TCP_DEBUG, ("tcp_bind: not all sockets have SO_REUSEPORT set.\n")); @@ -593,7 +593,7 @@ void tcp_slowtmr(void) pcb->rtime, pcb->rto)); /* Double retransmission time-out unless we are trying to - * connect to somebody (i.e., we are in SYN_SENT). */ + * connect to somebody (i.e., we are in SYN_SENT). */ if (pcb->state != SYN_SENT) { pcb->rto = ((pcb->sa >> 3) + pcb->sv) << tcp_backoff[pcb->nrtx]; } diff --git a/modules/network/SMSTCPIP/tcp_in.c b/modules/network/SMSTCPIP/tcp_in.c index af1e542a0..247bace3e 100644 --- a/modules/network/SMSTCPIP/tcp_in.c +++ b/modules/network/SMSTCPIP/tcp_in.c @@ -540,7 +540,7 @@ tcp_process(struct tcp_pcb *pcb) tcp_parseopt(pcb); /* Call the user specified function to call when sucessfully - * connected. */ + * connected. */ TCP_EVENT_CONNECTED(pcb, ERR_OK, err); tcp_ack(pcb); } @@ -559,12 +559,12 @@ tcp_process(struct tcp_pcb *pcb) TCP_EVENT_ACCEPT(pcb, ERR_OK, err); if (err != ERR_OK) { /* If the accept function returns with an error, we abort - * the connection. */ + * the connection. */ tcp_abort(pcb); return ERR_ABRT; } /* If there was any data contained within this ACK, - * we'd better pass it on to the application as well. */ + * we'd better pass it on to the application as well. */ tcp_receive(pcb); pcb->cwnd = pcb->mss; } @@ -706,8 +706,8 @@ tcp_receive(struct tcp_pcb *pcb) /* We come here when the ACK acknowledges new data. */ /* Reset the "IN Fast Retransmit" flag, since we are no longer - in fast retransmit. Also reset the congestion window to the - slow start threshold. */ + in fast retransmit. Also reset the congestion window to the + slow start threshold. */ if (pcb->flags & TF_INFR) { pcb->flags &= ~TF_INFR; pcb->cwnd = pcb->ssthresh; @@ -752,11 +752,11 @@ tcp_receive(struct tcp_pcb *pcb) } /* We go through the ->unsent list to see if any of the segments - on the list are acknowledged by the ACK. This may seem - strange since an "unsent" segment shouldn't be acked. The - rationale is that lwIP puts all outstanding segments on the - ->unsent list after a retransmission, so these segments may - in fact have been sent once. */ + on the list are acknowledged by the ACK. This may seem + strange since an "unsent" segment shouldn't be acked. The + rationale is that lwIP puts all outstanding segments on the + ->unsent list after a retransmission, so these segments may + in fact have been sent once. */ while (pcb->unsent != NULL && TCP_SEQ_LEQ((lLen = ntohl(pcb->unsent->tcphdr->seqno)) + TCP_TCPLEN(pcb->unsent), ackno) && TCP_SEQ_LEQ(ackno, pcb->snd_max)) { next = pcb->unsent; @@ -772,7 +772,7 @@ tcp_receive(struct tcp_pcb *pcb) /* End of ACK for new data processing. */ /* RTT estimation calculations. This is done by checking if the incoming segment acknowledges the segment we use to take a - round-trip time measurement. */ + round-trip time measurement. */ if (pcb->rttest && TCP_SEQ_LT(pcb->rtseq, ackno)) { m = tcp_ticks - pcb->rttest; @@ -794,53 +794,53 @@ tcp_receive(struct tcp_pcb *pcb) if (tcplen > 0) { /* This code basically does three things: - +) If the incoming segment contains data that is the next - in-sequence data, this data is passed to the application. This - might involve trimming the first edge of the data. The rcv_nxt - variable and the advertised window are adjusted. - - +) If the incoming segment has data that is above the next - sequence number expected (->rcv_nxt), the segment is placed on - the ->ooseq queue. This is done by finding the appropriate - place in the ->ooseq queue (which is ordered by sequence - number) and trim the segment in both ends if needed. An - immediate ACK is sent to indicate that we received an - out-of-sequence segment. - - +) Finally, we check if the first segment on the ->ooseq queue - now is in sequence (i.e., if rcv_nxt >= ooseq->seqno). If - rcv_nxt > ooseq->seqno, we must trim the first edge of the - segment on ->ooseq before we adjust rcv_nxt. The data in the - segments that are now on sequence are chained onto the - incoming segment so that we only need to call the application - once. - */ + +) If the incoming segment contains data that is the next + in-sequence data, this data is passed to the application. This + might involve trimming the first edge of the data. The rcv_nxt + variable and the advertised window are adjusted. + + +) If the incoming segment has data that is above the next + sequence number expected (->rcv_nxt), the segment is placed on + the ->ooseq queue. This is done by finding the appropriate + place in the ->ooseq queue (which is ordered by sequence + number) and trim the segment in both ends if needed. An + immediate ACK is sent to indicate that we received an + out-of-sequence segment. + + +) Finally, we check if the first segment on the ->ooseq queue + now is in sequence (i.e., if rcv_nxt >= ooseq->seqno). If + rcv_nxt > ooseq->seqno, we must trim the first edge of the + segment on ->ooseq before we adjust rcv_nxt. The data in the + segments that are now on sequence are chained onto the + incoming segment so that we only need to call the application + once. + */ /* First, we check if we must trim the first edge. We have to do - this if the sequence number of the incoming segment is less - than rcv_nxt, and the sequence number plus the length of the - segment is larger than rcv_nxt. */ + this if the sequence number of the incoming segment is less + than rcv_nxt, and the sequence number plus the length of the + segment is larger than rcv_nxt. */ if (TCP_SEQ_LT(seqno, pcb->rcv_nxt)) { if (TCP_SEQ_LT(pcb->rcv_nxt, seqno + tcplen)) { /* Trimming the first edge is done by pushing the payload - pointer in the pbuf downwards. This is somewhat tricky since - we do not want to discard the full contents of the pbuf up to - the new starting point of the data since we have to keep the - TCP header which is present in the first pbuf in the chain. - - What is done is really quite a nasty hack: the first pbuf in - the pbuf chain is pointed to by inseg.p. Since we need to be - able to deallocate the whole pbuf, we cannot change this - inseg.p pointer to point to any of the later pbufs in the - chain. Instead, we point the ->payload pointer in the first - pbuf to data in one of the later pbufs. We also set the - inseg.data pointer to point to the right place. This way, the - ->p pointer will still point to the first pbuf, but the - ->p->payload pointer will point to data in another pbuf. - - After we are done with adjusting the pbuf pointers we must - adjust the ->data pointer in the seg and the segment - length.*/ + pointer in the pbuf downwards. This is somewhat tricky since + we do not want to discard the full contents of the pbuf up to + the new starting point of the data since we have to keep the + TCP header which is present in the first pbuf in the chain. + + What is done is really quite a nasty hack: the first pbuf in + the pbuf chain is pointed to by inseg.p. Since we need to be + able to deallocate the whole pbuf, we cannot change this + inseg.p pointer to point to any of the later pbufs in the + chain. Instead, we point the ->payload pointer in the first + pbuf to data in one of the later pbufs. We also set the + inseg.data pointer to point to the right place. This way, the + ->p pointer will still point to the first pbuf, but the + ->p->payload pointer will point to data in another pbuf. + + After we are done with adjusting the pbuf pointers we must + adjust the ->data pointer in the seg and the segment + length.*/ off = pcb->rcv_nxt - seqno; if (inseg.p->len < off) { p = inseg.p; @@ -867,14 +867,14 @@ tcp_receive(struct tcp_pcb *pcb) } /* The sequence number must be within the window (above rcv_nxt - and below rcv_nxt + rcv_wnd) in order to be further - processed. */ + and below rcv_nxt + rcv_wnd) in order to be further + processed. */ if (TCP_SEQ_GEQ(seqno, pcb->rcv_nxt) && TCP_SEQ_LT(seqno, pcb->rcv_nxt + pcb->rcv_wnd)) { if (pcb->rcv_nxt == seqno) { int tcpflags; /* The incoming segment is the next in sequence. We check if - we have to trim the end of the segment and update rcv_nxt - and pass the data to the application. */ + we have to trim the end of the segment and update rcv_nxt + and pass the data to the application. */ #if TCP_QUEUE_OOSEQ if (pcb->ooseq != NULL && TCP_SEQ_LEQ(pcb->ooseq->tcphdr->seqno, seqno + inseg.len)) { /* We have to trim the second edge of the incoming segment. */ @@ -895,19 +895,19 @@ tcp_receive(struct tcp_pcb *pcb) } /* If there is data in the segment, we make preparations to - pass this up to the application. The ->recv_data variable - is used for holding the pbuf that goes to the - application. The code for reassembling out-of-sequence data - chains its data on this pbuf as well. - - If the segment was a FIN, we set the TF_GOT_FIN flag that will - be used to indicate to the application that the remote side has - closed its end of the connection. */ + pass this up to the application. The ->recv_data variable + is used for holding the pbuf that goes to the + application. The code for reassembling out-of-sequence data + chains its data on this pbuf as well. + + If the segment was a FIN, we set the TF_GOT_FIN flag that will + be used to indicate to the application that the remote side has + closed its end of the connection. */ if (inseg.p->tot_len > 0) { recv_data = inseg.p; /* Since this pbuf now is the responsibility of the - application, we delete our reference to it so that we won't - (mistakingly) deallocate it. */ + application, we delete our reference to it so that we won't + (mistakingly) deallocate it. */ inseg.p = NULL; } if (tcpflags & TCP_FIN) { @@ -960,28 +960,28 @@ tcp_receive(struct tcp_pcb *pcb) pcb->ooseq = tcp_seg_copy(&inseg); } else { /* If the queue is not empty, we walk through the queue and - try to find a place where the sequence number of the - incoming segment is between the sequence numbers of the - previous and the next segment on the ->ooseq queue. That is - the place where we put the incoming segment. If needed, we - trim the second edges of the previous and the incoming - segment so that it will fit into the sequence. + try to find a place where the sequence number of the + incoming segment is between the sequence numbers of the + previous and the next segment on the ->ooseq queue. That is + the place where we put the incoming segment. If needed, we + trim the second edges of the previous and the incoming + segment so that it will fit into the sequence. - If the incoming segment has the same sequence number as a - segment on the ->ooseq queue, we discard the segment that - contains less data. */ + If the incoming segment has the same sequence number as a + segment on the ->ooseq queue, we discard the segment that + contains less data. */ prev = NULL; for (next = pcb->ooseq; next != NULL; next = next->next) { if (seqno == next->tcphdr->seqno) { /* The sequence number of the incoming segment is the - same as the sequence number of the segment on - ->ooseq. We check the lengths to see which one to - discard. */ + same as the sequence number of the segment on + ->ooseq. We check the lengths to see which one to + discard. */ if (inseg.len > next->len) { /* The incoming segment is larger than the old - segment. We replace the old segment with the new - one. */ + segment. We replace the old segment with the new + one. */ cseg = tcp_seg_copy(&inseg); if (cseg != NULL) { cseg->next = next->next; @@ -994,17 +994,17 @@ tcp_receive(struct tcp_pcb *pcb) break; } else { /* Either the lenghts are the same or the incoming - segment was smaller than the old one; in either - case, we ditch the incoming segment. */ + segment was smaller than the old one; in either + case, we ditch the incoming segment. */ break; } } else { if (prev == NULL) { if (TCP_SEQ_LT(seqno, next->tcphdr->seqno)) { /* The sequence number of the incoming segment is lower - than the sequence number of the first segment on the - queue. We put the incoming segment first on the - queue. */ + than the sequence number of the first segment on the + queue. We put the incoming segment first on the + queue. */ if (TCP_SEQ_GT(seqno + inseg.len, next->tcphdr->seqno)) { /* We need to trim the incoming segment. */ @@ -1020,10 +1020,10 @@ tcp_receive(struct tcp_pcb *pcb) } } else if (TCP_SEQ_LT(prev->tcphdr->seqno, seqno) && TCP_SEQ_LT(seqno, next->tcphdr->seqno)) { /* The sequence number of the incoming segment is in - between the sequence numbers of the previous and - the next segment on ->ooseq. We trim and insert the - incoming segment and trim the previous segment, if - needed. */ + between the sequence numbers of the previous and + the next segment on ->ooseq. We trim and insert the + incoming segment and trim the previous segment, if + needed. */ if (TCP_SEQ_GT(seqno + inseg.len, next->tcphdr->seqno)) { /* We need to trim the incoming segment. */ inseg.len = next->tcphdr->seqno - seqno; @@ -1043,8 +1043,8 @@ tcp_receive(struct tcp_pcb *pcb) break; } /* If the "next" segment is the last segment on the - ooseq queue, we add the incoming segment to the end - of the list. */ + ooseq queue, we add the incoming segment to the end + of the list. */ if (next->next == NULL && TCP_SEQ_GT(seqno, next->tcphdr->seqno)) { next->next = tcp_seg_copy(&inseg); if (next->next != NULL) { diff --git a/modules/network/SMSTCPIP/tcp_out.c b/modules/network/SMSTCPIP/tcp_out.c index fb6e9327f..d1954f480 100644 --- a/modules/network/SMSTCPIP/tcp_out.c +++ b/modules/network/SMSTCPIP/tcp_out.c @@ -169,10 +169,10 @@ err_t tcp_enqueue( else { /* first, allocate a pbuf for holding the data. - * since the referenced data is available at least until it is sent out on the - * link (as it has to be ACKed by the remote party) we can safely use PBUF_ROM - * instead of PBUF_REF here. - */ + * since the referenced data is available at least until it is sent out on the + * link (as it has to be ACKed by the remote party) we can safely use PBUF_ROM + * instead of PBUF_REF here. + */ if ((p = pbuf_alloc(PBUF_TRANSPORT, seglen, PBUF_ROM)) == NULL) { LWIP_DEBUGF(TCP_OUTPUT_DEBUG | 2, ("tcp_enqueue: could not allocate memory for zero-copy pbuf\n")); goto memerr; @@ -184,7 +184,7 @@ err_t tcp_enqueue( /* Second, allocate a pbuf for the headers. */ if ((seg->p = pbuf_alloc(PBUF_TRANSPORT, 0, PBUF_RAM)) == NULL) { /* If allocation fails, we have to deallocate the data pbuf as - * well. */ + * well. */ pbuf_free(p); LWIP_DEBUGF(TCP_OUTPUT_DEBUG | 2, ("tcp_enqueue: could not allocate memory for header pbuf\n")); goto memerr; diff --git a/modules/network/SMSTCPIP/tcpip.c b/modules/network/SMSTCPIP/tcpip.c index 688abb1f5..3b13c297a 100644 --- a/modules/network/SMSTCPIP/tcpip.c +++ b/modules/network/SMSTCPIP/tcpip.c @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, @@ -11,21 +11,21 @@ * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Adam Dunkels * */ diff --git a/modules/network/SMSTCPIP/timers.c b/modules/network/SMSTCPIP/timers.c index 042996328..adfd2427a 100644 --- a/modules/network/SMSTCPIP/timers.c +++ b/modules/network/SMSTCPIP/timers.c @@ -190,7 +190,7 @@ void sys_timeout(u32_t msecs, sys_timeout_handler handler, void *arg) * * @param handler callback function that would be called by the timeout * @param arg callback argument that would be passed to handler -*/ + */ void sys_untimeout(sys_timeout_handler handler, void *arg) { struct sys_timeo *prev_t, *t; diff --git a/modules/network/SMSTCPIP/udp.c b/modules/network/SMSTCPIP/udp.c index 21c861b37..443a50df6 100644 --- a/modules/network/SMSTCPIP/udp.c +++ b/modules/network/SMSTCPIP/udp.c @@ -563,17 +563,17 @@ err_t udp_bind(struct udp_pcb *pcb, struct ip_addr *ipaddr, u16_t port) #endif #else /* SO_REUSE */ - /* Search through list of PCB's. - + /* Search through list of PCB's. + If there is a PCB bound to specified port and IP_ADDR_ANY another PCB can be bound to the interface IP - or to the loopback address on the same port if SOF_REUSEADDR is set. Any combination of PCB's bound to + or to the loopback address on the same port if SOF_REUSEADDR is set. Any combination of PCB's bound to the same local port, but to one address out of {IP_ADDR_ANY, 127.0.0.1, interface IP} at a time is valid. But no two PCB's bound to same local port and same local address is valid. - - If SOF_REUSEPORT is set several PCB's can be bound to same local port and same local address also. But then + + If SOF_REUSEPORT is set several PCB's can be bound to same local port and same local address also. But then all PCB's must have the SOF_REUSEPORT option set. - - When the two options aren't set and specified port is already bound, ERR_USE is returned saying that + + When the two options aren't set and specified port is already bound, ERR_USE is returned saying that address is already in use. */ else if (ipcb->local_port == port) { if (ip_addr_cmp(&(ipcb->local_ip), ipaddr)) { @@ -596,7 +596,7 @@ err_t udp_bind(struct udp_pcb *pcb, struct ip_addr *ipaddr, u16_t port) } #ifdef SO_REUSE - /* If SOF_REUSEPORT isn't set in all PCB's bound to specified port and local address specified then + /* If SOF_REUSEPORT isn't set in all PCB's bound to specified port and local address specified then {IP, port} can't be reused. */ if (!reuse_port_all_set) { LWIP_DEBUGF(UDP_DEBUG, ("udp_bind: not all sockets have SO_REUSEPORT set.\n")); diff --git a/modules/network/common/httpclient.h b/modules/network/common/httpclient.h index cefea4342..e47a0d1fd 100644 --- a/modules/network/common/httpclient.h +++ b/modules/network/common/httpclient.h @@ -1,19 +1,20 @@ #define HTTP_CMODE_CLOSED 0 #define HTTP_CMODE_PERSISTENT 1 -//EE-side only +// EE-side only int HttpInit(void); void HttpDeinit(void); int HttpEstabConnection(char *server, u16 port); void HttpCloseConnection(s32 HttpSocket); -/* mtime[0] = Years since year 2000 - mtime[1] = Month, 0-11 - mtime[2] = day in month, 0-30 - mtime[3] = Hour (0-23) - mtime[4] = Minute (0-59) - mtime[5] = Second (0-59) */ +/* mtime[0] = Years since year 2000 + mtime[1] = Month, 0-11 + mtime[2] = day in month, 0-30 + mtime[3] = Hour (0-23) + mtime[4] = Minute (0-59) + mtime[5] = Second (0-59) +*/ int HttpSendGetRequest(s32 HttpSocket, const char *UserAgent, const char *host, s8 *mode, const u8 *mtime, const char *uri, char *output, u16 *out_len); diff --git a/modules/network/common/smstcpip-common.h b/modules/network/common/smstcpip-common.h index f4d026f85..89ccbd3e8 100644 --- a/modules/network/common/smstcpip-common.h +++ b/modules/network/common/smstcpip-common.h @@ -87,9 +87,9 @@ struct pbuf void *payload; /** - * total length of this buffer and all next buffers in chain - * invariant: p->tot_len == p->len + (p->next? p->next->tot_len: 0) - */ + * total length of this buffer and all next buffers in chain + * invariant: p->tot_len == p->len + (p->next? p->next->tot_len: 0) + */ u16 tot_len; /* length of this buffer */ @@ -99,10 +99,10 @@ struct pbuf u16 flags; /** - * the reference count always equals the number of pointers - * that refer to this pbuf. This can be pointers from an application, - * the stack itself, or pbuf->next pointers from a chain. - */ + * the reference count always equals the number of pointers + * that refer to this pbuf. This can be pointers from an application, + * the stack itself, or pbuf->next pointers from a chain. + */ u16 ref; }; diff --git a/modules/network/httpclient/httpclient.c b/modules/network/httpclient/httpclient.c index b32df5abb..0b32bb051 100644 --- a/modules/network/httpclient/httpclient.c +++ b/modules/network/httpclient/httpclient.c @@ -1,5 +1,5 @@ -/* Simple HTTP client for retrieving files. - Support for the "chunked" encoding has not been implemented. */ +/* Simple HTTP client for retrieving files. + Support for the "chunked" encoding has not been implemented. */ #include #include @@ -55,7 +55,7 @@ static int GetData(int socket, char *buffer, int length) for (remaining = length, pointer = buffer; remaining > 0;) { ToRead = remaining; - //This safeguards against a deadlock, if the TCP connection gets broken for long enough. Long enough for the RST packet from the other side gets lost. + // This safeguards against a deadlock, if the TCP connection gets broken for long enough. Long enough for the RST packet from the other side gets lost. timeout.tv_sec = 10; timeout.tv_usec = 0; FD_ZERO(&readfds); @@ -69,14 +69,14 @@ static int GetData(int socket, char *buffer, int length) break; remaining -= result; pointer += result; - if (result != ToRead) //No further data at the moment. + if (result != ToRead) // No further data at the moment. break; } return length - remaining; } -#define HTTP_WORK_BUFFER_SIZE 256 //Not a really great design, but this must be long enough for the longest line in the HTTP entity. +#define HTTP_WORK_BUFFER_SIZE 256 // Not a really great design, but this must be long enough for the longest line in the HTTP entity. enum TRANFER_ENCODING { TRANFER_ENCODING_PLAIN, @@ -86,7 +86,7 @@ enum TRANFER_ENCODING { static int ContentLength; static short int StatusCode; static unsigned short int HeaderLineNumber; -//static char TransferEncoding; +// static char TransferEncoding; static char ConnectionMode; static void HttpParseEntityLine(const char *line) @@ -100,19 +100,20 @@ static void HttpParseEntityLine(const char *line) } } - //printf("%u\t%s\n", HeaderLineNumber, line); + // printf("%u\t%s\n", HeaderLineNumber, line); if (HeaderLineNumber == 0 && strncmp(line, "HTTP/1.1 ", 9) == 0) StatusCode = strtoul(line + 9, NULL, 10); if (strncmp(line, "Content-Length: ", 16) == 0) ContentLength = strtoul(line + 15, NULL, 10); - /* if(strncmp(line, "Transfer-Encoding: ", 19) == 0) - { - ContentLength = -1; - if(strcmp(line + 19, "chunked") == 0) - TransferEncoding = TRANFER_ENCODING_CHUNKED; - } */ + /* + if (strncmp(line, "Transfer-Encoding: ", 19) == 0) { + ContentLength = -1; + if (strcmp(line + 19, "chunked") == 0) + TransferEncoding = TRANFER_ENCODING_CHUNKED; + } + */ if (strcmp(line, "Connection: close") == 0) ConnectionMode = HTTP_CMODE_CLOSED; @@ -124,7 +125,7 @@ static int HttpGetResponse(s32 socket, s8 *mode, char *buffer, u16 *length) char work[HTTP_WORK_BUFFER_SIZE + 1], EndOfEntity, *ptr, *next_ptr, *PayloadPtr; int result, DataAvailable, PayloadAmount; - //TransferEncoding = TRANFER_ENCODING_PLAIN; + // TransferEncoding = TRANFER_ENCODING_PLAIN; ConnectionMode = *mode; ContentLength = -1; StatusCode = -1; @@ -141,10 +142,10 @@ static int HttpGetResponse(s32 socket, s8 *mode, char *buffer, u16 *length) ptr = work; while ((next_ptr = strstr(ptr, "\r\n")) != NULL) { *next_ptr = '\0'; - //Parse line + // Parse line HttpParseEntityLine(ptr); DataAvailable -= (next_ptr + 2 - ptr); - ptr = next_ptr + 2; //skip CRLN + ptr = next_ptr + 2; // skip CRLN if (strncmp(ptr, "\r\n", 2) == 0) { EndOfEntity = 1; DataAvailable -= 2; @@ -153,7 +154,7 @@ static int HttpGetResponse(s32 socket, s8 *mode, char *buffer, u16 *length) } } - //At this point, the final line (preceding NULL terminator) has been reached. Move any outstanding characters to the start of the buffer. + // At this point, the final line (preceding NULL terminator) has been reached. Move any outstanding characters to the start of the buffer. if (!EndOfEntity) { if (DataAvailable > 0) { memmove(work, ptr, DataAvailable); @@ -163,14 +164,14 @@ static int HttpGetResponse(s32 socket, s8 *mode, char *buffer, u16 *length) ptr = work; } } else { - //No more data. Connection lost? - // printf("DEBUG: connection lost?\n"); + // No more data. Connection lost? + // printf("DEBUG: connection lost?\n"); break; } } while (!EndOfEntity); - //Receive data normally (plain). - if (DataAvailable > 0) //Move leftover data into the output buffer. + // Receive data normally (plain). + if (DataAvailable > 0) // Move leftover data into the output buffer. { memcpy(buffer, ptr, DataAvailable); buffer[DataAvailable] = '\0'; @@ -190,8 +191,8 @@ static int HttpGetResponse(s32 socket, s8 *mode, char *buffer, u16 *length) result = StatusCode; if (ContentLength > 0 && ContentLength > *length) { - result = -EPIPE; //Incomplete transfer. - //printf("Pipe broken: %d/%d\n", *length, ContentLength); + result = -EPIPE; // Incomplete transfer. + // printf("Pipe broken: %d/%d\n", *length, ContentLength); } *mode = ConnectionMode; @@ -237,17 +238,17 @@ static const char *GetDayInWeek(const unsigned char *mtime) unsigned char LeapDays, month; unsigned int days; - LeapDays = mtime[0] / 4; //Number of leap days, in the years elasped. + LeapDays = mtime[0] / 4; // Number of leap days, in the years elasped. for (month = 0, DaysInYear = 0; month < mtime[1]; DaysInYear += daysInMonth[month], month++) - ; //Number of days, within the months elasped within the past year. + ; // Number of days, within the months elasped within the past year. if (mtime[0] % 4 == 0) { if (mtime[1] > 1) - DaysInYear++; //Account for this year's leap day, if applicable. + DaysInYear++; // Account for this year's leap day, if applicable. } else - LeapDays++; //Account for the leap day, of the leap year that just passed. + LeapDays++; // Account for the leap day, of the leap year that just passed. days = mtime[0] * 365 + LeapDays + DaysInYear + mtime[2]; - return dayLabels[(5 + days) % 7]; //2000/1/1 was a Saturday (5). + return dayLabels[(5 + days) % 7]; // 2000/1/1 was a Saturday (5). } int HttpSendGetRequest(s32 HttpSocket, const char *UserAgent, const char *host, s8 *mode, const u8 *mtime, const char *uri, char *output, u16 *out_len) diff --git a/modules/network/lwnbdsvr/lwNBD/nbd_opts.h b/modules/network/lwnbdsvr/lwNBD/nbd_opts.h index a574b950e..cd7e32050 100644 --- a/modules/network/lwnbdsvr/lwNBD/nbd_opts.h +++ b/modules/network/lwnbdsvr/lwNBD/nbd_opts.h @@ -1,15 +1,15 @@ /****************************************************************/ /** - * - * @file nbd_opts.h - * - * @author Ronan Bignaux - * - * @brief Network Block Device Protocol implementation options - * - * Copyright (c) Ronan Bignaux. 2021 - * All rights reserved. - * - ********************************************************************/ + * + * @file nbd_opts.h + * + * @author Ronan Bignaux + * + * @brief Network Block Device Protocol implementation options + * + * Copyright (c) Ronan Bignaux. 2021 + * All rights reserved. + * + ********************************************************************/ /* * Redistribution and use in source and binary forms, with or without diff --git a/modules/network/lwnbdsvr/lwNBD/nbd_server.c b/modules/network/lwnbdsvr/lwNBD/nbd_server.c index 37596ef68..5bcdff131 100644 --- a/modules/network/lwnbdsvr/lwNBD/nbd_server.c +++ b/modules/network/lwnbdsvr/lwNBD/nbd_server.c @@ -1,15 +1,15 @@ /****************************************************************/ /** - * - * @file nbd_server.c - * - * @author Ronan Bignaux - * - * @brief Network Block Device Protocol server - * - * Copyright (c) Ronan Bignaux. 2021 - * All rights reserved. - * - ********************************************************************/ + * + * @file nbd_server.c + * + * @author Ronan Bignaux + * + * @brief Network Block Device Protocol server + * + * Copyright (c) Ronan Bignaux. 2021 + * All rights reserved. + * + ********************************************************************/ /* * Redistribution and use in source and binary forms, with or without @@ -86,14 +86,14 @@ struct nbd_context *negotiation_phase(int client_socket, struct nbd_context **ct struct nbd_fixed_new_option_reply fixed_new_option_reply; struct nbd_new_handshake new_hs; - //temporary workaround + // temporary workaround struct nbd_context *ctx = ctxs[0]; /*** handshake ***/ new_hs.nbdmagic = htonll(NBD_MAGIC); new_hs.version = htonll(NBD_NEW_VERSION); - new_hs.gflags = 0; //htons(NBD_FLAG_FIXED_NEWSTYLE); + new_hs.gflags = 0; // htons(NBD_FLAG_FIXED_NEWSTYLE); size = send(client_socket, &new_hs, sizeof(struct nbd_new_handshake), 0); if (size < sizeof(struct nbd_new_handshake)) @@ -143,7 +143,7 @@ struct nbd_context *negotiation_phase(int client_socket, struct nbd_context **ct goto abort; case NBD_OPT_ABORT: - //TODO : test + // TODO : test fixed_new_option_reply.magic = htonll(NBD_REP_MAGIC); fixed_new_option_reply.option = htonl(new_opt.option); fixed_new_option_reply.reply = htonl(NBD_REP_ACK); @@ -159,7 +159,7 @@ struct nbd_context *negotiation_phase(int client_socket, struct nbd_context **ct desc_len = ctx->export_desc ? strlen(ctx->export_desc) : 0; len = htonl(name_len); - //TODO : many export in a loop + // TODO : many export in a loop fixed_new_option_reply.magic = htonll(NBD_REP_MAGIC); fixed_new_option_reply.option = htonl(new_opt.option); fixed_new_option_reply.reply = htonl(NBD_REP_SERVER); @@ -172,23 +172,23 @@ struct nbd_context *negotiation_phase(int client_socket, struct nbd_context **ct size = send(client_socket, ctx->export_name, name_len, MSG_MORE); size = send(client_socket, ctx->export_desc, desc_len, 0); break; - //TODO - // break; - // case NBD_OPT_STARTTLS: - // break; - // see nbdkit send_newstyle_option_reply_info_export() + // TODO + // break; + // case NBD_OPT_STARTTLS: + // break; + // see nbdkit send_newstyle_option_reply_info_export() case NBD_OPT_INFO: case NBD_OPT_GO: - // if (new_opt.option == NBD_OPT_GO) - // goto abort; - // break; + // if (new_opt.option == NBD_OPT_GO) + // goto abort; + // break; case NBD_OPT_STRUCTURED_REPLY: case NBD_OPT_LIST_META_CONTEXT: case NBD_OPT_SET_META_CONTEXT: default: - //TODO: test + // TODO: test fixed_new_option_reply.magic = htonll(NBD_REP_MAGIC); fixed_new_option_reply.option = htonl(new_opt.option); fixed_new_option_reply.reply = htonl(NBD_REP_ERR_UNSUP); @@ -284,7 +284,7 @@ static int transmission_phase(int client_socket, struct nbd_context *ctx) sendflag = 1; } else { goto error; // -EIO - // LWIP_DEBUGF(NBD_DEBUG | LWIP_DBG_STATE, ("nbd: error read\n")); + // LWIP_DEBUGF(NBD_DEBUG | LWIP_DBG_STATE, ("nbd: error read\n")); } } @@ -322,15 +322,15 @@ static int transmission_phase(int client_socket, struct nbd_context *ctx) if (r != 0) { error = NBD_EIO; sendflag = 0; - // LWIP_DEBUGF(NBD_DEBUG | LWIP_DBG_STATE, ("nbd: error read\n")); + // LWIP_DEBUGF(NBD_DEBUG | LWIP_DBG_STATE, ("nbd: error read\n")); } offset += bufbklsz; blkremains -= bufbklsz; retry = NBD_MAX_RETRIES; } else { - error = NBD_EOVERFLOW; //TODO + error = NBD_EOVERFLOW; // TODO sendflag = 0; - // LWIP_DEBUGF(NBD_DEBUG | LWIP_DBG_STATE, ("nbd: error read\n")); + // LWIP_DEBUGF(NBD_DEBUG | LWIP_DBG_STATE, ("nbd: error read\n")); } } @@ -341,7 +341,7 @@ static int transmission_phase(int client_socket, struct nbd_context *ctx) break; case NBD_CMD_DISC: - //TODO + // TODO goto soft_disconnect; break; diff --git a/modules/network/lwnbdsvr/lwNBD/nbd_server.h b/modules/network/lwnbdsvr/lwNBD/nbd_server.h index 75ee6ddf8..8150069f1 100644 --- a/modules/network/lwnbdsvr/lwNBD/nbd_server.h +++ b/modules/network/lwnbdsvr/lwNBD/nbd_server.h @@ -1,15 +1,15 @@ /****************************************************************/ /** - * - * @file nbd_server.h - * - * @author Ronan Bignaux - * - * @brief Network Block Device Protocol implementation options - * - * Copyright (c) Ronan Bignaux. 2021 - * All rights reserved. - * - ********************************************************************/ + * + * @file nbd_server.h + * + * @author Ronan Bignaux + * + * @brief Network Block Device Protocol implementation options + * + * Copyright (c) Ronan Bignaux. 2021 + * All rights reserved. + * + ********************************************************************/ /* * Redistribution and use in source and binary forms, with or without @@ -57,14 +57,14 @@ //#include //#include -//TODO: Missing in PS2SDK -// pickup from https://gist.github.com/jtbr/7a43e6281e6cca353b33ee501421860c +// TODO: Missing in PS2SDK +// pickup from https://gist.github.com/jtbr/7a43e6281e6cca353b33ee501421860c static inline uint64_t bswap64(uint64_t x) { return (((x & 0xff00000000000000ull) >> 56) | ((x & 0x00ff000000000000ull) >> 40) | ((x & 0x0000ff0000000000ull) >> 24) | ((x & 0x000000ff00000000ull) >> 8) | ((x & 0x00000000ff000000ull) << 8) | ((x & 0x0000000000ff0000ull) << 24) | ((x & 0x000000000000ff00ull) << 40) | ((x & 0x00000000000000ffull) << 56)); } -//TODO: Missing in PS2SK's "common/include/tcpip.h" +// TODO: Missing in PS2SK's "common/include/tcpip.h" #if __BIG_ENDIAN__ #define htonll(x) (x) #define ntohll(x) (x) @@ -73,8 +73,8 @@ static inline uint64_t bswap64(uint64_t x) #define ntohll(x) bswap64(x) #endif -//TODO: Missing in PS2SK's , needed for "nbd-protocol.h" -// https://en.cppreference.com/w/c/types/integer +// TODO: Missing in PS2SK's , needed for "nbd-protocol.h" +// https://en.cppreference.com/w/c/types/integer #define UINT64_MAX 0xffffffffffffffff #define UINT64_C(x) ((x) + (UINT64_MAX - UINT64_MAX)) #endif @@ -83,7 +83,7 @@ static inline uint64_t bswap64(uint64_t x) extern "C" { #endif -//extern uint8_t buffer[]; +// extern uint8_t buffer[]; extern uint8_t nbd_buffer[NBD_BUFFER_LEN] __attribute__((aligned(64))); /** @ingroup nbd @@ -101,39 +101,39 @@ struct nbd_context uint8_t blockshift; /* in power of 2 for bit shifting - log2(blocksize) */ uint8_t *buffer; /** - * block device - * @param - * @returns - */ + * block device + * @param + * @returns + */ int (*export_init)(struct nbd_context *me); /** - * Close block device handle - * @param handle File handle returned by open() - */ + * Close block device handle + * @param handle File handle returned by open() + */ // void (*close)(struct nbd_context *me); /** - * Read from block device - * @param - * @param buffer Target buffer to copy read data to - * @param offset Offset in block to copy read data to - * @param length Number of blocks to copy to buffer - * @returns >= 0: Success; < 0: Error - */ + * Read from block device + * @param + * @param buffer Target buffer to copy read data to + * @param offset Offset in block to copy read data to + * @param length Number of blocks to copy to buffer + * @returns >= 0: Success; < 0: Error + */ int (*read)(struct nbd_context *me, void *buffer, uint64_t offset, uint32_t length); /** - * Write to block device - * @param me () - * @param buffer Target buffer to copy write data to - * @param offset Offset in block to copy write data to - * @param length Number of blocks to copy to buffer - * @returns >= 0: Success; < 0: Error - */ + * Write to block device + * @param me () + * @param buffer Target buffer to copy write data to + * @param offset Offset in block to copy write data to + * @param length Number of blocks to copy to buffer + * @returns >= 0: Success; < 0: Error + */ int (*write)(struct nbd_context *me, void *buffer, uint64_t offset, uint32_t length); /** - * Flush to block device - * @param me () - * @returns >= 0: Success; < 0: Error - */ + * Flush to block device + * @param me () + * @returns >= 0: Success; < 0: Error + */ int (*flush)(struct nbd_context *me); }; diff --git a/modules/network/lwnbdsvr/lwnbdsvr.c b/modules/network/lwnbdsvr/lwnbdsvr.c index d9f109fdf..029e4447b 100644 --- a/modules/network/lwnbdsvr/lwnbdsvr.c +++ b/modules/network/lwnbdsvr/lwnbdsvr.c @@ -12,8 +12,8 @@ int _start(int argc, char **argv) { iop_thread_t nbd_thread; - //TODO : platform specific block device detection then nbd_context initialization go here - //TODO : many export in a loop + // TODO : platform specific block device detection then nbd_context initialization go here + // TODO : many export in a loop if (nbd_contexts[0]->export_init(nbd_contexts[0]) != 0) return -1; diff --git a/modules/network/nbns/nbns.c b/modules/network/nbns/nbns.c index 78f342237..34b9252a0 100644 --- a/modules/network/nbns/nbns.c +++ b/modules/network/nbns/nbns.c @@ -1,8 +1,8 @@ -/* Basic NetBIOS Name Service resolver client. - This client does not completely implement RFC1002, - as it only allows network addresses to be resolved. +/* Basic NetBIOS Name Service resolver client. + This client does not completely implement RFC1002, + as it only allows network addresses to be resolved. - Related reading materials: RFC1001 and RFC1002. */ + Related reading materials: RFC1001 and RFC1002. */ #include #include @@ -36,8 +36,8 @@ enum NB_OPCODE_TYPE { NB_OPCODE_TYPE_COUNT }; -#define QUESTION_TYPE_NB 0x0020 //NetBIOS general Name Service Resource Record -#define QUESTION_CLASS_IN 0x0001 //Internet class +#define QUESTION_TYPE_NB 0x0020 // NetBIOS general Name Service Resource Record +#define QUESTION_CLASS_IN 0x0001 // Internet class struct NbHeader { @@ -55,7 +55,7 @@ struct NbQuestionTrailer u16 qnClass; }; -//Record status bits. +// Record status bits. #define NBNS_NAME_RECORD_ALLOCATED 0x01 #define NBNS_NAME_RECORD_INIT 0x02 #define NBNS_NAME_RECORD_VALID 0x04 @@ -180,31 +180,31 @@ static void nbnsReceiveThread(void *arg) header = (struct NbHeader *)frame; code = BSWAP16(header->code); - // printf("R: %d, opcode: 0x%x, rcode: 0x%x, tcode: 0x%04x, flags: 0x%x\n", NB_GET_R(code), NB_GET_OPCODE(code), NB_GET_RCODE(code), BSWAP16(header->TransactionID), NB_GET_MN_FLAGS(code)); + // printf("R: %d, opcode: 0x%x, rcode: 0x%x, tcode: 0x%04x, flags: 0x%x\n", NB_GET_R(code), NB_GET_OPCODE(code), NB_GET_RCODE(code), BSWAP16(header->TransactionID), NB_GET_MN_FLAGS(code)); switch (NB_GET_OPCODE(code)) { case NB_OPCODE_TYPE_QUERY: if (NB_GET_R(code)) { - //Responses. - if (NB_GET_RCODE(code) == 0 && BSWAP16(header->ANCount) == 1) //Positive query response. + // Responses. + if (NB_GET_RCODE(code) == 0 && BSWAP16(header->ANCount) == 1) // Positive query response. { result = decode_name(&frame[sizeof(struct NbHeader)], decoded_name); decoded_name[result] = '\0'; if ((record = lookupName(decoded_name, BSWAP16(header->TransactionID))) != NULL && (record->status & NBNS_NAME_RECORD_INIT)) { if (!(record->status & NBNS_NAME_RECORD_VALID)) { - //Set the record as authoritative. + // Set the record as authoritative. CpuSuspendIntr(&OldState); memcpy(record->address, &frame[sizeof(struct NbHeader) + 34 + sizeof(struct NbQuestionTrailer) + 4 + 2 + 2], sizeof(record->address)); record->status |= NBNS_NAME_RECORD_VALID; CpuResumeIntr(OldState); - // printf("Received IP %u.%u.%u.%u for %s\n", record->address[0], record->address[1], record->address[2], record->address[3], record->name); + // printf("Received IP %u.%u.%u.%u for %s\n", record->address[0], record->address[1], record->address[2], record->address[3], record->name); if (record->thid >= 0) WakeupThread(record->thid); } else { - //Conflict. Don't handle. + // Conflict. Don't handle. } } } @@ -215,7 +215,7 @@ static void nbnsReceiveThread(void *arg) case NB_OPCODE_TYPE_REL: case NB_OPCODE_TYPE_REG: case NB_OPCODE_TYPE_REFRESH: - //Do nothing for unsupported codes. + // Do nothing for unsupported codes. break; default: printf("nbnsReceiveThread: unrecognized opcode: %x\n", NB_GET_OPCODE(code)); @@ -277,7 +277,7 @@ void nbnsDeinit(void) } if (nbnsReceiveThreadID > 0) { - //Wait for the receive thread to terminate. + // Wait for the receive thread to terminate. while (ReferThreadStatus(nbnsReceiveThreadID, &ThreadInfo) == 0 && ThreadInfo.status != THS_DORMANT) DelayThread(1000); DeleteThread(nbnsReceiveThreadID); @@ -330,7 +330,7 @@ int nbnsFindName(const char *name, unsigned char *ip_address) trailer->qnClass = BSWAP16(QUESTION_CLASS_IN); TotalLength = sizeof(struct NbHeader) + 34 + sizeof(struct NbQuestionTrailer); - //Like with Microsoft Windows, make up to 10 attempts. + // Like with Microsoft Windows, make up to 10 attempts. for (retries = 10; retries > 0; retries--) { struct sockaddr_in service; @@ -339,7 +339,7 @@ int nbnsFindName(const char *name, unsigned char *ip_address) service.sin_port = htons(137); if (sendto(nbnsSocket, frame, TotalLength, 0, (struct sockaddr *)&service, sizeof(service)) == TotalLength) { - clock.lo = 27600000; //250ms * 3 = 750ms of 36.8MHz clock ticks + clock.lo = 27600000; // 250ms * 3 = 750ms of 36.8MHz clock ticks clock.hi = 0; SetAlarm(&clock, &nbnsQueryNameTimeout, record); SleepThread(); diff --git a/modules/network/smap-ingame/main.c b/modules/network/smap-ingame/main.c index 008bf7962..76da05430 100644 --- a/modules/network/smap-ingame/main.c +++ b/modules/network/smap-ingame/main.c @@ -30,16 +30,16 @@ typedef struct pbuf PBuf; static NetIF NIF; -//From lwip/err.h and lwip/tcpip.h +// From lwip/err.h and lwip/tcpip.h -#define ERR_OK 0 //No error, everything OK -#define ERR_CONN -6 //Not connected -#define ERR_IF -11 //Low-level netif error +#define ERR_OK 0 // No error, everything OK +#define ERR_CONN -6 // Not connected +#define ERR_IF -11 // Low-level netif error -//SMapLowLevelOutput(): +// SMapLowLevelOutput(): -//This function is called by the TCP/IP stack when a low-level packet should be sent. It'll be invoked in the context of the -//tcpip-thread. +// This function is called by the TCP/IP stack when a low-level packet should be sent. It'll be invoked in the context of the +// tcpip-thread. static err_t SMapLowLevelOutput(NetIF *pNetIF, PBuf *pOutput) @@ -79,10 +79,10 @@ SMapLowLevelOutput(NetIF *pNetIF, PBuf *pOutput) return ERR_OK; } -//SMapOutput(): -//This function is called by the TCP/IP stack when an IP packet should be sent. It'll be invoked in the context of the -//tcpip-thread, hence no synchronization is required. -// For LWIP versions before v1.3.0. +// SMapOutput(): +// This function is called by the TCP/IP stack when an IP packet should be sent. It'll be invoked in the context of the +// tcpip-thread, hence no synchronization is required. +// For LWIP versions before v1.3.0. #ifdef PRE_LWIP_130_COMPAT static err_t SMapOutput(NetIF *pNetIF, PBuf *pOutput, IPAddr *pIPAddr) { @@ -107,8 +107,8 @@ static err_t SMapOutput(NetIF *pNetIF, PBuf *pOutput, IPAddr *pIPAddr) } #endif -//SMapIFInit(): -//Should be called at the beginning of the program to set up the network interface. +// SMapIFInit(): +// Should be called at the beginning of the program to set up the network interface. static err_t SMapIFInit(NetIF *pNetIF) { #if USE_GP_REGISTER @@ -133,12 +133,12 @@ static err_t SMapIFInit(NetIF *pNetIF) #endif pNetIF->mtu = 1500; - //Get MAC address. + // Get MAC address. SMAPGetMACAddress(pNetIF->hwaddr); dbgprintf("MAC address : %02d:%02d:%02d:%02d:%02d:%02d\n", pNetIF->hwaddr[0], pNetIF->hwaddr[1], pNetIF->hwaddr[2], pNetIF->hwaddr[3], pNetIF->hwaddr[4], pNetIF->hwaddr[5]); - //Enable sending and receiving of data. + // Enable sending and receiving of data. SMAPStart(); #if USE_GP_REGISTER @@ -150,8 +150,8 @@ static err_t SMapIFInit(NetIF *pNetIF) void SMapLowLevelInput(PBuf *pBuf) { - //When we receive data, the interrupt-handler will invoke this function, which means we are in an interrupt-context. Pass on - //the received data to ps2ip. + // When we receive data, the interrupt-handler will invoke this function, which means we are in an interrupt-context. Pass on + // the received data to ps2ip. ps2ip_input(pBuf, &NIF); } @@ -165,10 +165,10 @@ static inline int SMapInit(IPAddr IP, IPAddr NM, IPAddr GW, int argc, char *argv netif_add(&NIF, &IP, &NM, &GW, NULL, &SMapIFInit, tcpip_input); netif_set_default(&NIF); - // netif_set_up(&NIF); // Not supported by SMSTCPIP. + // netif_set_up(&NIF); // Not supported by SMSTCPIP. dbgprintf("SMapInit: NetIF added to ps2ip\n"); - //Return 1 (true) to indicate success. + // Return 1 (true) to indicate success. result = 1; } else result = 0; @@ -183,14 +183,14 @@ int _start(int argc, char *argv[]) dbgprintf("SMAP: argc %d\n", iArgC); - //Parse IP args. + // Parse IP args. if (argc >= 4) { dbgprintf("SMAP: %s %s %s\n", argv[1], argv[2], argv[3]); IP.addr = inet_addr(argv[1]); NM.addr = inet_addr(argv[2]); GW.addr = inet_addr(argv[3]); } else { - //Set some defaults. + // Set some defaults. IP4_ADDR(&IP, 192, 168, 0, 80); IP4_ADDR(&NM, 255, 255, 255, 0); IP4_ADDR(&GW, 192, 168, 0, 1); @@ -198,10 +198,10 @@ int _start(int argc, char *argv[]) if (!SMapInit(IP, NM, GW, argc - 4, &argv[4])) { - //Something went wrong. + // Something went wrong. result = MODULE_NO_RESIDENT_END; } else - result = MODULE_RESIDENT_END; //Initialized ok. + result = MODULE_RESIDENT_END; // Initialized ok. return result; } diff --git a/modules/network/smap-ingame/main.h b/modules/network/smap-ingame/main.h index baef4fa49..b3b179637 100644 --- a/modules/network/smap-ingame/main.h +++ b/modules/network/smap-ingame/main.h @@ -1,5 +1,5 @@ -//In the SONY original, all the calls to DEBUG_PRINTF() were to sceInetPrintf(). -#define DEBUG_PRINTF(args...) //printf(args) +// In the SONY original, all the calls to DEBUG_PRINTF() were to sceInetPrintf(). +#define DEBUG_PRINTF(args...) // printf(args) #define MAX_FRAME_SIZE 1518 diff --git a/modules/network/smap-ingame/smap.c b/modules/network/smap-ingame/smap.c index caddd70cf..fb666f18d 100644 --- a/modules/network/smap-ingame/smap.c +++ b/modules/network/smap-ingame/smap.c @@ -21,34 +21,34 @@ #include "main.h" #include "xfer.h" -/* There is a difference in how the transmissions are made, - between this driver and the SONY original. +/* There is a difference in how the transmissions are made, + between this driver and the SONY original. - SONY: - 1. NETDEV calls SMAP's xmit callback. - 2. SMAP's xmit event handler issues that XMIT event (for the main thread). - 3. XMIT event copies the frames to the Tx buffer and sets up the BDs. - 4. Tx DNV handler is called (always, regardless of what event it is being handled!). - 5. Interrupts are re-enabled, except for TXDNV. - 6. If there are frames to transmit, write to TX_GNP_0 and enable the TXDNV interrupt + SONY: + 1. NETDEV calls SMAP's xmit callback. + 2. SMAP's xmit event handler issues that XMIT event (for the main thread). + 3. XMIT event copies the frames to the Tx buffer and sets up the BDs. + 4. Tx DNV handler is called (always, regardless of what event it is being handled!). + 5. Interrupts are re-enabled, except for TXDNV. + 6. If there are frames to transmit, write to TX_GNP_0 and enable the TXDNV interrupt - The TXDNV interrupt is hence always disabled, but only enabled when a frame(s) is sent. - Perhaps there is a lack of a check on the TXEND interrupt because it is polling on the TX BDs before every transmission. + The TXDNV interrupt is hence always disabled, but only enabled when a frame(s) is sent. + Perhaps there is a lack of a check on the TXEND interrupt because it is polling on the TX BDs before every transmission. - I don't know how to test this, but it seems like the TXDNV interrupt is asserted for as long as - there is no valid frame to transmit, hence this design by SONY. + I don't know how to test this, but it seems like the TXDNV interrupt is asserted for as long as + there is no valid frame to transmit, hence this design by SONY. - OPL: - 1. Network stack calls SMAPSendPacket(). - 2. TX_GNP_0 is checked and waited on (Tx channel 0 is in single mode) - 3. Frame is copied into the Tx buffer and a BD is set up. - 4. TX_GNP_0 is written to. */ + OPL: + 1. Network stack calls SMAPSendPacket(). + 2. TX_GNP_0 is checked and waited on (Tx channel 0 is in single mode) + 3. Frame is copied into the Tx buffer and a BD is set up. + 4. TX_GNP_0 is written to. */ #define DEV9_SMAP_ALL_INTR_MASK (SMAP_INTR_EMAC3 | SMAP_INTR_RXEND | SMAP_INTR_TXEND | SMAP_INTR_RXDNV | SMAP_INTR_TXDNV) -//Unlike the SONY original, the RXDNV interrupt is not handled as statistics are not recorded. -//For the sake of simplicity, Tx channel 0 is operated in single-mode. Do not handle TXDNV. +// Unlike the SONY original, the RXDNV interrupt is not handled as statistics are not recorded. +// For the sake of simplicity, Tx channel 0 is operated in single-mode. Do not handle TXDNV. #define DEV9_SMAP_INTR_MASK (SMAP_INTR_EMAC3 | SMAP_INTR_RXEND) -//The Tx interrupt events are handled separately +// The Tx interrupt events are handled separately #define DEV9_SMAP_INTR_MASK2 (SMAP_INTR_EMAC3 | SMAP_INTR_RXEND) struct SmapDriverData SmapDriverData; @@ -74,7 +74,7 @@ static void _smap_write_phy(volatile u8 *emac3_regbase, unsigned int address, u1 break; } - //if(i>=100) printf("smap: %s: > %d ms\n", "_smap_write_phy", i); + // if(i>=100) printf("smap: %s: > %d ms\n", "_smap_write_phy", i); } static u16 _smap_read_phy(volatile u8 *emac3_regbase, unsigned int address) @@ -338,17 +338,17 @@ static int InitPHY(struct SmapDriverData *SmapDrivPrivData) return 0; } -//Checks the status of the Ethernet link +// Checks the status of the Ethernet link static void CheckLinkStatus(struct SmapDriverData *SmapDrivPrivData) { if (!(_smap_read_phy(SmapDrivPrivData->emac3_regbase, SMAP_DsPHYTER_BMSR) & SMAP_PHY_BMSR_LINK)) { - //Link lost + // Link lost SmapDrivPrivData->LinkStatus = 0; InitPHY(SmapDrivPrivData); } } -//This timer callback starts the Ethernet link check event. +// This timer callback starts the Ethernet link check event. static unsigned int LinkCheckTimerCB(struct SmapDriverData *SmapDrivPrivData) { CheckLinkStatus(SmapDrivPrivData); @@ -433,7 +433,7 @@ int SMAPStart(void) dev9IntrEnable(DEV9_SMAP_INTR_MASK2); - //Initialize the PHY, only if there's no valid link status. It should have already been previously initialized successfully by the previous instance of SMAP. + // Initialize the PHY, only if there's no valid link status. It should have already been previously initialized successfully by the previous instance of SMAP. result = (!(_smap_read_phy(emac3_regbase, SMAP_DsPHYTER_BMSR) & SMAP_PHY_BMSR_LINK)) ? InitPHY(&SmapDriverData) : 0; if (result == 0 && !SmapDriverData.NetDevStopFlag) { SMAP_EMAC3_SET32(SMAP_R_EMAC3_MODE0, SMAP_E3_TXMAC_ENABLE | SMAP_E3_RXMAC_ENABLE); @@ -441,7 +441,7 @@ int SMAPStart(void) SmapDriverData.SmapIsInitialized = 1; if (!SmapDriverData.EnableLinkCheckTimer) { - USec2SysClock(5000000, &SmapDriverData.LinkCheckTimer); //Since there isn't a thread that allows the link checking code to determine whether frames were received or not and to check the link status, just reduce the polling frequency. + USec2SysClock(5000000, &SmapDriverData.LinkCheckTimer); // Since there isn't a thread that allows the link checking code to determine whether frames were received or not and to check the link status, just reduce the polling frequency. SetAlarm(&SmapDriverData.LinkCheckTimer, (void *)&LinkCheckTimerCB, &SmapDriverData); SmapDriverData.EnableLinkCheckTimer = 1; } @@ -522,7 +522,7 @@ static int ParseSmapConfiguration(const char *cmd, unsigned int *configuration) return 0; fail_end: - // printf("smap: %s: %s - invalid digit\n", "scan_number", CmdStart); + // printf("smap: %s: %s - invalid digit\n", "scan_number", CmdStart); return -1; } @@ -556,7 +556,10 @@ int smap_init(int argc, char *argv[]) argv++; } - // if(argc!=0) return -1; + /* + if (argc != 0) + return -1; +*/ SmapDriverData.smap_regbase = smap_regbase; SmapDriverData.emac3_regbase = emac3_regbase; @@ -643,7 +646,7 @@ int smap_init(int argc, char *argv[]) SMAP_EMAC3_SET32(SMAP_R_EMAC3_TX_THRESHOLD, 12 << SMAP_E3_TX_THRESHLD_BITSFT); SMAP_EMAC3_SET32(SMAP_R_EMAC3_RX_WATERMARK, 16 << SMAP_E3_RX_LO_WATER_BITSFT | 128 << SMAP_E3_RX_HI_WATER_BITSFT); - //Unlike the SONY original, register the interrupt handler for only RXEND and EMAC3. + // Unlike the SONY original, register the interrupt handler for only RXEND and EMAC3. dev9RegisterIntrCb(5, &Dev9IntrCb); /* RXEND */ dev9RegisterIntrCb(6, &Dev9IntrCb); /* EMAC3 */ diff --git a/modules/network/smap-ingame/xfer.c b/modules/network/smap-ingame/xfer.c index a8a8bb8e1..8b4647de2 100644 --- a/modules/network/smap-ingame/xfer.c +++ b/modules/network/smap-ingame/xfer.c @@ -47,19 +47,19 @@ static inline int CopyFromFIFOWithDMA(volatile u8 *smap_regbase, void *buffer, i USE_SPD_REGS; u16 OldDMACtrl; - //Attempt to steal the DMA channel from the DEV9 module. + // Attempt to steal the DMA channel from the DEV9 module. if ((result = length / 64) > 0) { OldDMACtrl = SPD_REG16(SPD_R_DMA_CTRL); while (dmac_ch_get_chcr(IOP_DMAC_DEV9) & DMAC_CHCR_TR) { } - SPD_REG16(SPD_R_DMA_CTRL) = 7; //SPEED revision 17 (ES2) and above only. + SPD_REG16(SPD_R_DMA_CTRL) = 7; // SPEED revision 17 (ES2) and above only. SMAP_REG16(SMAP_R_RXFIFO_SIZE) = result; SMAP_REG8(SMAP_R_RXFIFO_CTRL) = SMAP_RXFIFO_DMAEN; - //Transfer in 64-byte (16x4) blocks + // Transfer in 64-byte (16x4) blocks dmac_request(IOP_DMAC_DEV9, buffer, 0x10, result, DMAC_TO_MEM); dmac_transfer(IOP_DMAC_DEV9); @@ -93,39 +93,39 @@ static inline void CopyFromFIFO(volatile u8 *smap_regbase, void *buffer, unsigne ".set noreorder\n\t" ".set nomacro\n\t" ".set noat\n\t" - "lui $2, 0xB000\n\t" - "srl $at, %1, 5\n\t" - "blez $at, 3f\n\t" - "andi %1, %1, 0x1F\n\t" + " lui $2, 0xB000\n\t" + " srl $at, %1, 5\n\t" + " blez $at, 3f\n\t" + " andi %1, %1, 0x1F\n\t" "4:\n\t" - "lw $8, 4608($2)\n\t" - "lw $9, 4608($2)\n\t" - "lw $10, 4608($2)\n\t" - "lw $11, 4608($2)\n\t" - "lw $12, 4608($2)\n\t" - "lw $13, 4608($2)\n\t" - "lw $14, 4608($2)\n\t" - "lw $15, 4608($2)\n\t" - "addiu $at, $at, -1\n\t" - "sw $8, 0(%0)\n\t" - "sw $9, 4(%0)\n\t" - "sw $10, 8(%0)\n\t" - "sw $11, 12(%0)\n\t" - "sw $12, 16(%0)\n\t" - "sw $13, 20(%0)\n\t" - "sw $14, 24(%0)\n\t" - "sw $15, 28(%0)\n\t" - "bgtz $at, 4b\n\t" - "addiu %0, %0, 32\n\t" + " lw $8, 4608($2)\n\t" + " lw $9, 4608($2)\n\t" + " lw $10, 4608($2)\n\t" + " lw $11, 4608($2)\n\t" + " lw $12, 4608($2)\n\t" + " lw $13, 4608($2)\n\t" + " lw $14, 4608($2)\n\t" + " lw $15, 4608($2)\n\t" + " addiu $at, $at, -1\n\t" + " sw $8, 0(%0)\n\t" + " sw $9, 4(%0)\n\t" + " sw $10, 8(%0)\n\t" + " sw $11, 12(%0)\n\t" + " sw $12, 16(%0)\n\t" + " sw $13, 20(%0)\n\t" + " sw $14, 24(%0)\n\t" + " sw $15, 28(%0)\n\t" + " bgtz $at, 4b\n\t" + " addiu %0, %0, 32\n\t" "3:\n\t" - "blez %1, 1f\n\t" - "nop\n\t" + " blez %1, 1f\n\t" + " nop\n\t" "2:\n\t" - "lw $8, 4608($2)\n\t" - "addiu %1, %1, -4\n\t" - "sw $8, 0(%0)\n\t" - "bgtz %1, 2b\n\t" - "addiu %0, %0, 4\n\t" + " lw $8, 4608($2)\n\t" + " addiu %1, %1, -4\n\t" + " sw $8, 0(%0)\n\t" + " bgtz %1, 2b\n\t" + " addiu %0, %0, 4\n\t" "1:\n\t" ".set at\n\t" ".set macro\n\t" @@ -162,7 +162,7 @@ int HandleRxIntr(struct SmapDriverData *SmapDrivPrivData) if ((pbuf = pbuf_alloc(PBUF_RAW, LengthRounded, PBUF_POOL)) != NULL) { CopyFromFIFO(SmapDrivPrivData->smap_regbase, pbuf->payload, length, pointer); - //Inform ps2ip that we've received data. + // Inform ps2ip that we've received data. SMapLowLevelInput(pbuf); NumPacketsReceived++; @@ -209,31 +209,31 @@ int SMAPSendPacket(const void *data, unsigned int length) ".set noreorder\n\t" ".set nomacro\n\t" ".set noat\n\t" - "srl $at, %1, 4\n\t" - "lui $3, 0xB000\n\t" - "beqz $at, 3f\n\t" - "andi %1, %1, 0xF\n\t" + " srl $at, %1, 4\n\t" + " lui $3, 0xB000\n\t" + " beqz $at, 3f\n\t" + " andi %1, %1, 0xF\n\t" "4:\n\t" - "lw $8, 0(%0)\n\t" - "lw $9, 4(%0)\n\t" - "lw $10, 8(%0)\n\t" - "lw $11, 12(%0)\n\t" - "addiu $at, $at, -1\n\t" - "sw $8, 4352($3)\n\t" - "sw $9, 4352($3)\n\t" - "sw $10, 4352($3)\n\t" - "addiu %0, %0, 16\n\t" - "bgtz $at, 4b\n\t" - "sw $11, 4352($3)\n\t" + " lw $8, 0(%0)\n\t" + " lw $9, 4(%0)\n\t" + " lw $10, 8(%0)\n\t" + " lw $11, 12(%0)\n\t" + " addiu $at, $at, -1\n\t" + " sw $8, 4352($3)\n\t" + " sw $9, 4352($3)\n\t" + " sw $10, 4352($3)\n\t" + " addiu %0, %0, 16\n\t" + " bgtz $at, 4b\n\t" + " sw $11, 4352($3)\n\t" "3:\n\t" - "beqz %1, 1f\n\t" - "nop\n\t" + " beqz %1, 1f\n\t" + " nop\n\t" "2:\n\t" - "lw $2, 0(%0)\n\t" - "addiu %1, %1, -4\n\t" - "sw $2, 4352($3)\n\t" - "bnez %1, 2b\n\t" - "addiu %0, %0, 4\n\t" + " lw $2, 0(%0)\n\t" + " addiu %1, %1, -4\n\t" + " sw $2, 4352($3)\n\t" + " bnez %1, 2b\n\t" + " addiu %0, %0, 4\n\t" "1:\n\t" ".set reorder\n\t" ".set macro\n\t" diff --git a/modules/network/smbinit/des.c b/modules/network/smbinit/des.c index 802a4a233..ac8b22bfe 100644 --- a/modules/network/smbinit/des.c +++ b/modules/network/smbinit/des.c @@ -376,42 +376,42 @@ static const unsigned int des_skb[8][64] = { des_SPtrans[6][(u >> 24) & 0x3f]; /* IP and FP - * The problem is more of a geometric problem that random bit fiddling. - 0 1 2 3 4 5 6 7 62 54 46 38 30 22 14 6 - 8 9 10 11 12 13 14 15 60 52 44 36 28 20 12 4 - 16 17 18 19 20 21 22 23 58 50 42 34 26 18 10 2 - 24 25 26 27 28 29 30 31 to 56 48 40 32 24 16 8 0 - - 32 33 34 35 36 37 38 39 63 55 47 39 31 23 15 7 - 40 41 42 43 44 45 46 47 61 53 45 37 29 21 13 5 - 48 49 50 51 52 53 54 55 59 51 43 35 27 19 11 3 - 56 57 58 59 60 61 62 63 57 49 41 33 25 17 9 1 - - The output has been subject to swaps of the form - 0 1 -> 3 1 but the odd and even bits have been put into - 2 3 2 0 - different words. The main trick is to remember that - t=((l>>size)^r)&(mask); - r^=t; - l^=(t< 3 1 but the odd and even bits have been put into + 2 3 2 0 + different words. The main trick is to remember that + t=((l>>size)^r)&(mask); + r^=t; + l^=(t<> (n)) ^ (b)) & (m)), \ (b) ^= (t), \ (a) ^= ((t) << (n))) @@ -460,8 +460,8 @@ static unsigned char *DES_createkeys(unsigned char *key) c2l(in, d); /* I now do it in 47 simple operations :-) - * Thanks to John Fletcher (john_fletcher@lccmail.ocf.llnl.gov) - * for the inspiration. :-) */ + * Thanks to John Fletcher (john_fletcher@lccmail.ocf.llnl.gov) + * for the inspiration. :-) */ PERM_OP(d, c, t, 4, 0x0f0f0f0f); HPERM_OP(c, t, -2, 0xcccc0000); HPERM_OP(d, t, -2, 0xcccc0000); @@ -483,7 +483,7 @@ static unsigned char *DES_createkeys(unsigned char *key) c &= 0x0fffffff; d &= 0x0fffffff; /* could be a few less shifts but I am to lazy at this - * point in time to investigate */ + * point in time to investigate */ s = des_skb[0][(c)&0x3f] | des_skb[1][((c >> 6) & 0x03) | ((c >> 7) & 0x3c)] | des_skb[2][((c >> 13) & 0x0f) | ((c >> 14) & 0x30)] | @@ -524,21 +524,21 @@ unsigned char *DES(unsigned char *key, unsigned char *message, unsigned char *ci PERM_OP(l, r, t, 8, 0x00ff00ff); PERM_OP(r, l, t, 1, 0x55555555); /* r and l are reversed - remember that :-) - fix - * it in the next step */ + * it in the next step */ /* Things have been modified so that the initial rotate is - * done outside the loop. This required the - * des_SPtrans values in sp.h to be rotated 1 bit to the right. - * One perl script later and things have a 5% speed up on a sparc2. - * Thanks to Richard Outerbridge <71755.204@CompuServe.COM> - * for pointing this out. */ + * done outside the loop. This required the + * des_SPtrans values in sp.h to be rotated 1 bit to the right. + * One perl script later and things have a 5% speed up on a sparc2. + * Thanks to Richard Outerbridge <71755.204@CompuServe.COM> + * for pointing this out. */ t = (r << 1) | (r >> 31); r = (l << 1) | (l >> 31); l = t; s = (unsigned int *)keys; /* I don't know if it is worth the effort of loop unrolling the - * inner loop */ + * inner loop */ for (i = 0; i < 32; i += 4) { D_ENCRYPT(l, r, i + 0); /* 1 */ D_ENCRYPT(r, l, i + 2); /* 2 */ @@ -547,9 +547,9 @@ unsigned char *DES(unsigned char *key, unsigned char *message, unsigned char *ci r = (r >> 1) | (r << 31); /* swap l and r - * we will not do the swap so just remember they are - * reversed for the rest of the subroutine - * luckily FP fixes this problem :-) */ + * we will not do the swap so just remember they are + * reversed for the rest of the subroutine + * luckily FP fixes this problem :-) */ PERM_OP(r, l, t, 1, 0x55555555); PERM_OP(l, r, t, 8, 0x00ff00ff); diff --git a/modules/network/smbinit/des.h b/modules/network/smbinit/des.h index b19c9886b..68c86d0b0 100644 --- a/modules/network/smbinit/des.h +++ b/modules/network/smbinit/des.h @@ -3,7 +3,7 @@ Copyright 2006-2008 Polo Licenced under Academic Free License version 3.0 Review Open-Ps2-Loader README & LICENSE files for further details. - + Some parts of the code are taken from HD Project by Polo */ diff --git a/modules/network/smbinit/md4.c b/modules/network/smbinit/md4.c index ac3381961..aa5ad0b26 100644 --- a/modules/network/smbinit/md4.c +++ b/modules/network/smbinit/md4.c @@ -1,12 +1,12 @@ -/* +/* * Adapted from java to C by jimmikaelkael */ /** * Implements the MD4 message digest algorithm in Java. - * + * * References: - * + * * Ronald L. Rivest, * The MD4 Message-Digest Algorithm: , * IETF RFC-1320 (informational). @@ -136,8 +136,8 @@ static void engineReset() context[3] = 0x10325476; } -/** - * produce a MD4 message digest from message of len bytes +/** + * produce a MD4 message digest from message of len bytes */ unsigned char *MD4(unsigned char *message, int len, unsigned char *cipher) { diff --git a/modules/network/smbinit/md4.h b/modules/network/smbinit/md4.h index 946d24df0..ddb2e885a 100644 --- a/modules/network/smbinit/md4.h +++ b/modules/network/smbinit/md4.h @@ -3,7 +3,7 @@ Copyright 2006-2008 Polo Licenced under Academic Free License version 3.0 Review Open-Ps2-Loader README & LICENSE files for further details. - + Some parts of the code are taken from HD Project by Polo */ diff --git a/modules/pademu/ds34bt.c b/modules/pademu/ds34bt.c index 409f823cf..fe3dffa40 100644 --- a/modules/pademu/ds34bt.c +++ b/modules/pademu/ds34bt.c @@ -265,7 +265,7 @@ static u8 rgbled_patterns[][2][3] = {{0x00, 0x10, 0x10}, {0x00, 0x7F, 0x7F}}, // light cyan/cyan }; -static u8 link_key[] = //for ds4 authorisation +static u8 link_key[] = // for ds4 authorisation { 0x56, 0xE8, 0x81, 0x38, 0x08, 0x06, 0x51, 0x41, 0xC0, 0x7F, 0x12, 0xAA, 0xD9, 0x66, 0x3C, 0xCE}; @@ -332,7 +332,7 @@ static u8 GenuineMacAddress[][3] = {0x00, 0x24, 0x23}, {0x00, 0x22, 0x43}, {0x00, 0x15, 0xAF}, - //fake with AirohaTechnologyCorp's Chip + // fake with AirohaTechnologyCorp's Chip {0x0C, 0xFC, 0x83}}; #define REQ_HCI_OUT (USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_DEVICE) @@ -414,7 +414,7 @@ static int hci_accept_connection(u8 *bdaddr) hci_cmd_buf[6] = *(bdaddr + 3); hci_cmd_buf[7] = *(bdaddr + 4); hci_cmd_buf[8] = *(bdaddr + 5); - hci_cmd_buf[9] = 0x01; //switch role to (slave = 1 / master = 0) + hci_cmd_buf[9] = 0x01; // switch role to (slave = 1 / master = 0) return HCI_Command(10, hci_cmd_buf); } @@ -449,7 +449,7 @@ static int hci_reject_connection(u8 *bdaddr) hci_cmd_buf[6] = *(bdaddr + 3); hci_cmd_buf[7] = *(bdaddr + 4); hci_cmd_buf[8] = *(bdaddr + 5); - hci_cmd_buf[9] = 0x09; //reason max connection + hci_cmd_buf[9] = 0x09; // reason max connection return HCI_Command(10, hci_cmd_buf); } @@ -579,7 +579,7 @@ static void HCI_event_task(int result) DPRINTF("\t Status = 0x%02X \n", hci_buf[2]); DPRINTF("\t Connection_Handle = 0x%04X \n", (hci_buf[3] | ((hci_buf[4] & 0x0F) << 8))); DPRINTF("\t Reason = 0x%02X \n", hci_buf[5]); - for (i = 0; i < MAX_PADS; i++) { //detect pad + for (i = 0; i < MAX_PADS; i++) { // detect pad if (ds34pad[i].hci_handle == (hci_buf[3] | ((hci_buf[4] & 0x0F) << 8))) { break; } @@ -642,18 +642,18 @@ static void HCI_event_task(int result) } DPRINTF("\n\t Link = 0x%02X \n", hci_buf[11]); DPRINTF("\t Class = 0x%02X 0x%02X 0x%02X \n", hci_buf[8], hci_buf[9], hci_buf[10]); - for (i = 0; i < MAX_PADS; i++) { //find free slot + for (i = 0; i < MAX_PADS; i++) { // find free slot if (!pad_status_check(DS34BT_STATE_RUNNING, i) && ds34pad[i].enabled) { if (pad_status_check(DS34BT_STATE_CONNECTED, i)) { - if (pad_status_check(DS34BT_STATE_DISCONNECTING, i)) //if we're waiting for hci disconnect event + if (pad_status_check(DS34BT_STATE_DISCONNECTING, i)) // if we're waiting for hci disconnect event continue; else - hci_disconnect(ds34pad[i].hci_handle); //try to disconnect + hci_disconnect(ds34pad[i].hci_handle); // try to disconnect } break; } } - if (i >= MAX_PADS) { //no free slot + if (i >= MAX_PADS) { // no free slot hci_reject_connection(hci_buf + 2); break; } @@ -661,8 +661,8 @@ static void HCI_event_task(int result) mips_memcpy(ds34pad[pad].bdaddr, hci_buf + 2, 6); ds34pad[pad].isfake = 0; if (!disable_fake) { - ds34pad[pad].isfake = 1; //fake ds3 - for (i = 0; i < sizeof(GenuineMacAddress) / 3; i++) { //check if ds3 is genuine + ds34pad[pad].isfake = 1; // fake ds3 + for (i = 0; i < sizeof(GenuineMacAddress) / 3; i++) { // check if ds3 is genuine if (ds34pad[pad].bdaddr[5] == GenuineMacAddress[i][0] && ds34pad[pad].bdaddr[4] == GenuineMacAddress[i][1] && ds34pad[pad].bdaddr[3] == GenuineMacAddress[i][2]) { @@ -839,10 +839,10 @@ static int l2cap_config_request(u16 handle, u8 rxid, u16 dcid) cmd_buf[7] = 0x00; cmd_buf[8] = 0x01; // Config Opt: type = MTU (Maximum Transmission Unit) cmd_buf[9] = 0x02; // Config Opt: length - //cmd_buf[10] = 0x96; // Config Opt: data - //cmd_buf[11] = 0x00; + // cmd_buf[10] = 0x96; // Config Opt: data + // cmd_buf[11] = 0x00; - //this setting disable hid cmd reports from ds3 + // this setting disable hid cmd reports from ds3 cmd_buf[10] = 0xFF; // Config Opt: data cmd_buf[11] = 0xFF; @@ -1092,7 +1092,7 @@ static void l2cap_event_cb(int resultCode, int bytes, void *arg) } } else { if (!ds34pad[ret].isfake && ds34pad[ret].type == DS3) - DelayThread(42000); //fix for some bt adapters + DelayThread(42000); // fix for some bt adapters } } @@ -1162,14 +1162,14 @@ static int hid_LEDRumble(u8 *led, u8 lrum, u8 rrum, int pad) rrum = 0; } - led_buf[3] = 0xFE; //rt - led_buf[4] = rrum; //rp - led_buf[5] = 0xFE; //lt - led_buf[6] = lrum; //lp + led_buf[3] = 0xFE; // rt + led_buf[4] = rrum; // rp + led_buf[5] = 0xFE; // lt + led_buf[6] = lrum; // lp - led_buf[11] = led[0] & 0x7F; //LED Conf + led_buf[11] = led[0] & 0x7F; // LED Conf - if (led[3]) { //means charging, so blink + if (led[3]) { // means charging, so blink led_buf[15] = 0x32; led_buf[20] = 0x32; led_buf[25] = 0x32; @@ -1182,17 +1182,17 @@ static int hid_LEDRumble(u8 *led, u8 lrum, u8 rrum, int pad) led_buf[0] = HID_THDR_SET_REPORT_OUTPUT; // THdr led_buf[1] = PS4_11_REPORT_ID; // Report ID - led_buf[2] = 0x80; //update rate 1000Hz + led_buf[2] = 0x80; // update rate 1000Hz led_buf[4] = 0xFF; led_buf[7] = rrum * 255; led_buf[8] = lrum; - led_buf[9] = led[0]; //r - led_buf[10] = led[1]; //g - led_buf[11] = led[2]; //b + led_buf[9] = led[0]; // r + led_buf[10] = led[1]; // g + led_buf[11] = led[2]; // b - if (led[3]) { //means charging, so blink + if (led[3]) { // means charging, so blink led_buf[12] = 0x80; // Time to flash bright (255 = 2.5 seconds) led_buf[13] = 0x80; // Time to flash dark (255 = 2.5 seconds) } @@ -1222,51 +1222,51 @@ static void hid_readReport(u8 *data, int bytes, int pad) ds34pad[pad].data[0] = ~report->ButtonStateL; ds34pad[pad].data[1] = ~report->ButtonStateH; - ds34pad[pad].data[2] = report->RightStickX; //rx - ds34pad[pad].data[3] = report->RightStickY; //ry - ds34pad[pad].data[4] = report->LeftStickX; //lx - ds34pad[pad].data[5] = report->LeftStickY; //ly + ds34pad[pad].data[2] = report->RightStickX; // rx + ds34pad[pad].data[3] = report->RightStickY; // ry + ds34pad[pad].data[4] = report->LeftStickX; // lx + ds34pad[pad].data[5] = report->LeftStickY; // ly if (bytes == 21 && !press_emu) press_emu = 1; - if (press_emu) { //needs emulating pressure buttons - ds34pad[pad].data[6] = report->Right * 255; //right - ds34pad[pad].data[7] = report->Left * 255; //left - ds34pad[pad].data[8] = report->Up * 255; //up - ds34pad[pad].data[9] = report->Down * 255; //down + if (press_emu) { // needs emulating pressure buttons + ds34pad[pad].data[6] = report->Right * 255; // right + ds34pad[pad].data[7] = report->Left * 255; // left + ds34pad[pad].data[8] = report->Up * 255; // up + ds34pad[pad].data[9] = report->Down * 255; // down - ds34pad[pad].data[10] = report->Triangle * 255; //triangle - ds34pad[pad].data[11] = report->Circle * 255; //circle - ds34pad[pad].data[12] = report->Cross * 255; //cross - ds34pad[pad].data[13] = report->Square * 255; //square + ds34pad[pad].data[10] = report->Triangle * 255; // triangle + ds34pad[pad].data[11] = report->Circle * 255; // circle + ds34pad[pad].data[12] = report->Cross * 255; // cross + ds34pad[pad].data[13] = report->Square * 255; // square - ds34pad[pad].data[14] = report->L1 * 255; //L1 - ds34pad[pad].data[15] = report->R1 * 255; //R1 - ds34pad[pad].data[16] = report->L2 * 255; //L2 - ds34pad[pad].data[17] = report->R2 * 255; //R2 + ds34pad[pad].data[14] = report->L1 * 255; // L1 + ds34pad[pad].data[15] = report->R1 * 255; // R1 + ds34pad[pad].data[16] = report->L2 * 255; // L2 + ds34pad[pad].data[17] = report->R2 * 255; // R2 report->Power = 0x05; } else { - ds34pad[pad].data[6] = report->PressureRight; //right - ds34pad[pad].data[7] = report->PressureLeft; //left - ds34pad[pad].data[8] = report->PressureUp; //up - ds34pad[pad].data[9] = report->PressureDown; //down - - ds34pad[pad].data[10] = report->PressureTriangle; //triangle - ds34pad[pad].data[11] = report->PressureCircle; //circle - ds34pad[pad].data[12] = report->PressureCross; //cross - ds34pad[pad].data[13] = report->PressureSquare; //square - - ds34pad[pad].data[14] = report->PressureL1; //L1 - ds34pad[pad].data[15] = report->PressureR1; //R1 - ds34pad[pad].data[16] = report->PressureL2; //L2 - ds34pad[pad].data[17] = report->PressureR2; //R2 + ds34pad[pad].data[6] = report->PressureRight; // right + ds34pad[pad].data[7] = report->PressureLeft; // left + ds34pad[pad].data[8] = report->PressureUp; // up + ds34pad[pad].data[9] = report->PressureDown; // down + + ds34pad[pad].data[10] = report->PressureTriangle; // triangle + ds34pad[pad].data[11] = report->PressureCircle; // circle + ds34pad[pad].data[12] = report->PressureCross; // cross + ds34pad[pad].data[13] = report->PressureSquare; // square + + ds34pad[pad].data[14] = report->PressureL1; // L1 + ds34pad[pad].data[15] = report->PressureR1; // R1 + ds34pad[pad].data[16] = report->PressureL2; // L2 + ds34pad[pad].data[17] = report->PressureR2; // R2 } - if (report->PSButtonState) { //display battery level - if (report->Select && (ds34pad[pad].btn_delay == MAX_DELAY)) { //PS + SELECT - if (ds34pad[pad].analog_btn < 2) //unlocked mode + if (report->PSButtonState) { // display battery level + if (report->Select && (ds34pad[pad].btn_delay == MAX_DELAY)) { // PS + SELECT + if (ds34pad[pad].analog_btn < 2) // unlocked mode ds34pad[pad].analog_btn = !ds34pad[pad].analog_btn; ds34pad[pad].oldled[0] = led_patterns[pad][(ds34pad[pad].analog_btn & 1)]; @@ -1285,7 +1285,7 @@ static void hid_readReport(u8 *data, int bytes, int pad) ds34pad[pad].btn_delay--; } - if (report->Power == 0xEE) //charging + if (report->Power == 0xEE) // charging ds34pad[pad].oldled[3] = 1; else ds34pad[pad].oldled[3] = 0; @@ -1352,29 +1352,29 @@ static void hid_readReport(u8 *data, int bytes, int pad) ds34pad[pad].data[0] = ~(report->Share | report->L3 << 1 | report->R3 << 2 | report->Option << 3 | up << 4 | right << 5 | down << 6 | left << 7); ds34pad[pad].data[1] = ~(report->L2 | report->R2 << 1 | report->L1 << 2 | report->R1 << 3 | report->Triangle << 4 | report->Circle << 5 | report->Cross << 6 | report->Square << 7); - ds34pad[pad].data[2] = report->RightStickX; //rx - ds34pad[pad].data[3] = report->RightStickY; //ry - ds34pad[pad].data[4] = report->LeftStickX; //lx - ds34pad[pad].data[5] = report->LeftStickY; //ly - - ds34pad[pad].data[6] = right * 255; //right - ds34pad[pad].data[7] = left * 255; //left - ds34pad[pad].data[8] = up * 255; //up - ds34pad[pad].data[9] = down * 255; //down - - ds34pad[pad].data[10] = report->Triangle * 255; //triangle - ds34pad[pad].data[11] = report->Circle * 255; //circle - ds34pad[pad].data[12] = report->Cross * 255; //cross - ds34pad[pad].data[13] = report->Square * 255; //square - - ds34pad[pad].data[14] = report->L1 * 255; //L1 - ds34pad[pad].data[15] = report->R1 * 255; //R1 - ds34pad[pad].data[16] = report->PressureL2; //L2 - ds34pad[pad].data[17] = report->PressureR2; //R2 - - if (report->PSButton) { //display battery level - if (report->Share && (ds34pad[pad].btn_delay == MAX_DELAY)) { //PS + Share - if (ds34pad[pad].analog_btn < 2) //unlocked mode + ds34pad[pad].data[2] = report->RightStickX; // rx + ds34pad[pad].data[3] = report->RightStickY; // ry + ds34pad[pad].data[4] = report->LeftStickX; // lx + ds34pad[pad].data[5] = report->LeftStickY; // ly + + ds34pad[pad].data[6] = right * 255; // right + ds34pad[pad].data[7] = left * 255; // left + ds34pad[pad].data[8] = up * 255; // up + ds34pad[pad].data[9] = down * 255; // down + + ds34pad[pad].data[10] = report->Triangle * 255; // triangle + ds34pad[pad].data[11] = report->Circle * 255; // circle + ds34pad[pad].data[12] = report->Cross * 255; // cross + ds34pad[pad].data[13] = report->Square * 255; // square + + ds34pad[pad].data[14] = report->L1 * 255; // L1 + ds34pad[pad].data[15] = report->R1 * 255; // R1 + ds34pad[pad].data[16] = report->PressureL2; // L2 + ds34pad[pad].data[17] = report->PressureR2; // R2 + + if (report->PSButton) { // display battery level + if (report->Share && (ds34pad[pad].btn_delay == MAX_DELAY)) { // PS + Share + if (ds34pad[pad].analog_btn < 2) // unlocked mode ds34pad[pad].analog_btn = !ds34pad[pad].analog_btn; ds34pad[pad].oldled[0] = rgbled_patterns[pad][(ds34pad[pad].analog_btn & 1)][0]; @@ -1398,7 +1398,7 @@ static void hid_readReport(u8 *data, int bytes, int pad) ds34pad[pad].btn_delay--; } - if (report->Power != 0xB && report->Usb_plugged) //charging + if (report->Power != 0xB && report->Usb_plugged) // charging ds34pad[pad].oldled[3] = 1; else ds34pad[pad].oldled[3] = 0; diff --git a/modules/pademu/ds34bt.h b/modules/pademu/ds34bt.h index 949da0ebc..151d494f3 100644 --- a/modules/pademu/ds34bt.h +++ b/modules/pademu/ds34bt.h @@ -33,15 +33,15 @@ typedef struct typedef struct { - u16 hci_handle; //hci connection handle + u16 hci_handle; // hci connection handle u16 control_scid; // Channel endpoint on command destination u16 interrupt_scid; // Channel endpoint on interrupt destination u8 bdaddr[6]; u8 enabled; u8 status; u8 isfake; - u8 type; //0 - ds3, 1 - ds4 - u8 oldled[4]; //rgb for ds4 and blink + u8 type; // 0 - ds3, 1 - ds4 + u8 oldled[4]; // rgb for ds4 and blink u8 lrum; u8 rrum; u8 update_rum; @@ -117,7 +117,7 @@ enum eHCI { HCI_EVENT_LINK_KEY_REQUEST = 0x17, HCI_EVENT_CHANGED_CONNECTION_TYPE = 0x1D, HCI_EVENT_PAGE_SR_CHANGED = 0x20, - HCI_EVENT_MAX_SLOT_CHANGE = 0x1B, //Max Slots Change event + HCI_EVENT_MAX_SLOT_CHANGE = 0x1B, // Max Slots Change event /* HCI event flags for hci_event_flag */ HCI_FLAG_COMMAND_COMPLETE = 0x01, @@ -178,25 +178,25 @@ enum eL2CAP { L2CAP_CMD_DISCONNECT_RESPONSE = 0x07, /* HCI ACL Data Packet - * - * buf[0] buf[1] buf[2] buf[3] - * 0 4 8 11 12 16 24 31 MSB - * .-+-+-+-+-+-+-+-|-+-+-+-|-+-|-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-. - * | HCI Handle |PB |BC | Data Total Length | HCI ACL Data Packet - * .-+-+-+-+-+-+-+-|-+-+-+-|-+-|-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-. - * - * buf[4] buf[5] buf[6] buf[7] - * 0 8 16 31 MSB - * .-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-. - * | Length | Channel ID | Basic L2CAP header - * .-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-. - * - * buf[8] buf[9] buf[10] buf[11] - * 0 8 16 31 MSB - * .-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-. - * | Code | Identifier | Length | Control frame (C-frame) - * .-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-. (signaling packet format) - */ + * + * buf[0] buf[1] buf[2] buf[3] + * 0 4 8 11 12 16 24 31 MSB + * .-+-+-+-+-+-+-+-|-+-+-+-|-+-|-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-. + * | HCI Handle |PB |BC | Data Total Length | HCI ACL Data Packet + * .-+-+-+-+-+-+-+-|-+-+-+-|-+-|-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-. + * + * buf[4] buf[5] buf[6] buf[7] + * 0 8 16 31 MSB + * .-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-. + * | Length | Channel ID | Basic L2CAP header + * .-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-. + * + * buf[8] buf[9] buf[10] buf[11] + * 0 8 16 31 MSB + * .-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-. + * | Code | Identifier | Length | Control frame (C-frame) + * .-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-. (signaling packet format) + */ // }}} }; diff --git a/modules/pademu/ds34usb.c b/modules/pademu/ds34usb.c index b1cf74aa3..85b25af51 100644 --- a/modules/pademu/ds34usb.c +++ b/modules/pademu/ds34usb.c @@ -201,7 +201,7 @@ static void usb_data_cb(int resultCode, int bytes, void *arg) { int pad = (int)arg; - //DPRINTF("DS34USB: usb_data_cb: res %d, bytes %d, arg %p \n", resultCode, bytes, arg); + // DPRINTF("DS34USB: usb_data_cb: res %d, bytes %d, arg %p \n", resultCode, bytes, arg); usb_resulCode = resultCode; @@ -212,7 +212,7 @@ static void usb_cmd_cb(int resultCode, int bytes, void *arg) { int pad = (int)arg; - //DPRINTF("DS34USB: usb_cmd_cb: res %d, bytes %d, arg %p \n", resultCode, bytes, arg); + // DPRINTF("DS34USB: usb_cmd_cb: res %d, bytes %d, arg %p \n", resultCode, bytes, arg); SignalSema(ds34pad[pad].cmd_sema); } @@ -272,29 +272,29 @@ static void readReport(u8 *data, int pad) ds34pad[pad].data[0] = ~report->ButtonStateL; ds34pad[pad].data[1] = ~report->ButtonStateH; - ds34pad[pad].data[2] = report->RightStickX; //rx - ds34pad[pad].data[3] = report->RightStickY; //ry - ds34pad[pad].data[4] = report->LeftStickX; //lx - ds34pad[pad].data[5] = report->LeftStickY; //ly - - ds34pad[pad].data[6] = report->PressureRight; //right - ds34pad[pad].data[7] = report->PressureLeft; //left - ds34pad[pad].data[8] = report->PressureUp; //up - ds34pad[pad].data[9] = report->PressureDown; //down - - ds34pad[pad].data[10] = report->PressureTriangle; //triangle - ds34pad[pad].data[11] = report->PressureCircle; //circle - ds34pad[pad].data[12] = report->PressureCross; //cross - ds34pad[pad].data[13] = report->PressureSquare; //square - - ds34pad[pad].data[14] = report->PressureL1; //L1 - ds34pad[pad].data[15] = report->PressureR1; //R1 - ds34pad[pad].data[16] = report->PressureL2; //L2 - ds34pad[pad].data[17] = report->PressureR2; //R2 - - if (report->PSButtonState) { //display battery level - if (report->Select && (ds34pad[pad].btn_delay == MAX_DELAY)) { //PS + SELECT - if (ds34pad[pad].analog_btn < 2) //unlocked mode + ds34pad[pad].data[2] = report->RightStickX; // rx + ds34pad[pad].data[3] = report->RightStickY; // ry + ds34pad[pad].data[4] = report->LeftStickX; // lx + ds34pad[pad].data[5] = report->LeftStickY; // ly + + ds34pad[pad].data[6] = report->PressureRight; // right + ds34pad[pad].data[7] = report->PressureLeft; // left + ds34pad[pad].data[8] = report->PressureUp; // up + ds34pad[pad].data[9] = report->PressureDown; // down + + ds34pad[pad].data[10] = report->PressureTriangle; // triangle + ds34pad[pad].data[11] = report->PressureCircle; // circle + ds34pad[pad].data[12] = report->PressureCross; // cross + ds34pad[pad].data[13] = report->PressureSquare; // square + + ds34pad[pad].data[14] = report->PressureL1; // L1 + ds34pad[pad].data[15] = report->PressureR1; // R1 + ds34pad[pad].data[16] = report->PressureL2; // L2 + ds34pad[pad].data[17] = report->PressureR2; // R2 + + if (report->PSButtonState) { // display battery level + if (report->Select && (ds34pad[pad].btn_delay == MAX_DELAY)) { // PS + SELECT + if (ds34pad[pad].analog_btn < 2) // unlocked mode ds34pad[pad].analog_btn = !ds34pad[pad].analog_btn; ds34pad[pad].oldled[0] = led_patterns[pad][(ds34pad[pad].analog_btn & 1)]; @@ -313,7 +313,7 @@ static void readReport(u8 *data, int pad) ds34pad[pad].btn_delay--; } - if (report->Power == 0xEE) //charging + if (report->Power == 0xEE) // charging ds34pad[pad].oldled[3] = 1; else ds34pad[pad].oldled[3] = 0; @@ -380,29 +380,29 @@ static void readReport(u8 *data, int pad) ds34pad[pad].data[0] = ~(report->Share | report->L3 << 1 | report->R3 << 2 | report->Option << 3 | up << 4 | right << 5 | down << 6 | left << 7); ds34pad[pad].data[1] = ~(report->L2 | report->R2 << 1 | report->L1 << 2 | report->R1 << 3 | report->Triangle << 4 | report->Circle << 5 | report->Cross << 6 | report->Square << 7); - ds34pad[pad].data[2] = report->RightStickX; //rx - ds34pad[pad].data[3] = report->RightStickY; //ry - ds34pad[pad].data[4] = report->LeftStickX; //lx - ds34pad[pad].data[5] = report->LeftStickY; //ly - - ds34pad[pad].data[6] = right * 255; //right - ds34pad[pad].data[7] = left * 255; //left - ds34pad[pad].data[8] = up * 255; //up - ds34pad[pad].data[9] = down * 255; //down - - ds34pad[pad].data[10] = report->Triangle * 255; //triangle - ds34pad[pad].data[11] = report->Circle * 255; //circle - ds34pad[pad].data[12] = report->Cross * 255; //cross - ds34pad[pad].data[13] = report->Square * 255; //square - - ds34pad[pad].data[14] = report->L1 * 255; //L1 - ds34pad[pad].data[15] = report->R1 * 255; //R1 - ds34pad[pad].data[16] = report->PressureL2; //L2 - ds34pad[pad].data[17] = report->PressureR2; //R2 - - if (report->PSButton) { //display battery level - if (report->Share && (ds34pad[pad].btn_delay == MAX_DELAY)) { //PS + Share - if (ds34pad[pad].analog_btn < 2) //unlocked mode + ds34pad[pad].data[2] = report->RightStickX; // rx + ds34pad[pad].data[3] = report->RightStickY; // ry + ds34pad[pad].data[4] = report->LeftStickX; // lx + ds34pad[pad].data[5] = report->LeftStickY; // ly + + ds34pad[pad].data[6] = right * 255; // right + ds34pad[pad].data[7] = left * 255; // left + ds34pad[pad].data[8] = up * 255; // up + ds34pad[pad].data[9] = down * 255; // down + + ds34pad[pad].data[10] = report->Triangle * 255; // triangle + ds34pad[pad].data[11] = report->Circle * 255; // circle + ds34pad[pad].data[12] = report->Cross * 255; // cross + ds34pad[pad].data[13] = report->Square * 255; // square + + ds34pad[pad].data[14] = report->L1 * 255; // L1 + ds34pad[pad].data[15] = report->R1 * 255; // R1 + ds34pad[pad].data[16] = report->PressureL2; // L2 + ds34pad[pad].data[17] = report->PressureR2; // R2 + + if (report->PSButton) { // display battery level + if (report->Share && (ds34pad[pad].btn_delay == MAX_DELAY)) { // PS + Share + if (ds34pad[pad].analog_btn < 2) // unlocked mode ds34pad[pad].analog_btn = !ds34pad[pad].analog_btn; ds34pad[pad].oldled[0] = rgbled_patterns[pad][(ds34pad[pad].analog_btn & 1)][0]; @@ -426,7 +426,7 @@ static void readReport(u8 *data, int pad) ds34pad[pad].btn_delay--; } - if (report->Power != 0xB && report->Usb_plugged) //charging + if (report->Power != 0xB && report->Usb_plugged) // charging ds34pad[pad].oldled[3] = 1; else ds34pad[pad].oldled[3] = 0; @@ -448,14 +448,14 @@ static int LEDRumble(u8 *led, u8 lrum, u8 rrum, int pad) if (ds34pad[pad].type == DS3) { mips_memcpy(usb_buf, output_01_report, sizeof(output_01_report)); - usb_buf[1] = 0xFE; //rt - usb_buf[2] = rrum; //rp - usb_buf[3] = 0xFE; //lt - usb_buf[4] = lrum; //lp + usb_buf[1] = 0xFE; // rt + usb_buf[2] = rrum; // rp + usb_buf[3] = 0xFE; // lt + usb_buf[4] = lrum; // lp - usb_buf[9] = led[0] & 0x7F; //LED Conf + usb_buf[9] = led[0] & 0x7F; // LED Conf - if (led[3]) //means charging, so blink + if (led[3]) // means charging, so blink { usb_buf[13] = 0x32; usb_buf[18] = 0x32; @@ -468,14 +468,14 @@ static int LEDRumble(u8 *led, u8 lrum, u8 rrum, int pad) usb_buf[0] = 0x05; usb_buf[1] = 0xFF; - usb_buf[4] = rrum * 255; //ds4 has full control + usb_buf[4] = rrum * 255; // ds4 has full control usb_buf[5] = lrum; - usb_buf[6] = led[0]; //r - usb_buf[7] = led[1]; //g - usb_buf[8] = led[2]; //b + usb_buf[6] = led[0]; // r + usb_buf[7] = led[1]; // g + usb_buf[8] = led[2]; // b - if (led[3]) //means charging, so blink + if (led[3]) // means charging, so blink { usb_buf[9] = 0x80; // Time to flash bright (255 = 2.5 seconds) usb_buf[10] = 0x80; // Time to flash dark (255 = 2.5 seconds) diff --git a/modules/pademu/ds34usb.h b/modules/pademu/ds34usb.h index 595b84300..bf8792c66 100644 --- a/modules/pademu/ds34usb.h +++ b/modules/pademu/ds34usb.h @@ -23,8 +23,8 @@ typedef struct _usb_ds34 int outEndp; u8 enabled; u8 status; - u8 type; //0 - ds3, 1 - ds4 - u8 oldled[4]; //rgb for ds4 and blink + u8 type; // 0 - ds3, 1 - ds4 + u8 oldled[4]; // rgb for ds4 and blink u8 lrum; u8 rrum; u8 update_rum; diff --git a/modules/pademu/pademu.c b/modules/pademu/pademu.c index cf36a0850..4728c8ac3 100644 --- a/modules/pademu/pademu.c +++ b/modules/pademu/pademu.c @@ -1,4 +1,4 @@ -//sio2man hook code taken from opl mcemu: +// sio2man hook code taken from opl mcemu: /* Copyright 2006-2008, Romz Copyright 2010, Polo @@ -102,7 +102,7 @@ int _start(int argc, char *argv[]) pad_vibration = argv[1][1]; mtap_enabled = argv[1][2] & 1; mtap_port = (argv[1][2] >> 1) & 1; - pad_options = (argv[1][2] >> 2) & 1; //disable workaround for fake ds3 + pad_options = (argv[1][2] >> 2) & 1; // disable workaround for fake ds3 } if (RegisterLibraryEntries(&_exp_pademu) != 0) { @@ -211,7 +211,7 @@ void pademu_hookSio2man(sio2_transfer_data_t *td, Sio2McProc sio2proc) if (td->port_ctrl2[port1] == 0x00030064 && td->in[0] == 0x21 && mtap_enabled) { sio2proc = pademu_mtap; } else if (td->in[0] == 0x01) { - if (port2 == 1) { //2 sio cmds + if (port2 == 1) { // 2 sio cmds if (mtap_inited) { if (pad[0].enabled) { td->in[0] = 0x00; @@ -219,9 +219,9 @@ void pademu_hookSio2man(sio2_transfer_data_t *td, Sio2McProc sio2proc) sio2proc = pademu; } } else { - if (pad[0].enabled && pad[1].enabled) { //emulating 2 pads + if (pad[0].enabled && pad[1].enabled) { // emulating 2 pads sio2proc = pademu; - } else if (pad[0].enabled || pad[1].enabled) { //only one + } else if (pad[0].enabled || pad[1].enabled) { // only one if (pad[0].enabled) { ctrl = 0; } else if (pad[1].enabled) { @@ -249,7 +249,7 @@ void pademu_hookSio2man(sio2_transfer_data_t *td, Sio2McProc sio2proc) sio2proc = pademu; } } else { - if (pad[port1].enabled) { //emulating this port + if (pad[port1].enabled) { // emulating this port sio2proc = pademu; } } @@ -310,7 +310,7 @@ void pademu(sio2_transfer_data_t *td) } if (port2 == 1) { - //find next cmd + // find next cmd for (cmd_size = 5; cmd_size < td->in_size - 3; cmd_size++) { if (td->in[cmd_size] == 0x01 && (td->in[cmd_size + 1] & 0xF0) == 0x40 && td->in[cmd_size + 2] == 0x00) { if (cmd_size != 5 && cmd_size != 9 && cmd_size != 21) @@ -342,10 +342,10 @@ void pademu(sio2_transfer_data_t *td) out = td->out; port = 0; - if (pad[1].enabled) { //emulating ports 0 & 1 + if (pad[1].enabled) { // emulating ports 0 & 1 pademu_cmd(1, (u8 *)&td->in[cmd_size], (u8 *)&td->out[cmd_size], td->in_size - cmd_size); } - } else { //emulating only port 1 + } else { // emulating only port 1 in = (u8 *)&td->in[cmd_size]; out = (u8 *)&td->out[cmd_size]; port = 1; @@ -383,11 +383,11 @@ void pademu_cmd(int port, u8 *in, u8 *out, u8 out_size) out[2] = 0x5A; switch (in[1]) { - case 0x40: //set vref param + case 0x40: // set vref param mips_memcpy(&out[3], &pademu_data[0], 6); break; - case 0x41: //query button mask + case 0x41: // query button mask if (pad[port].mode_id != DIGITAL_MODE) { out[3] = pad[port].mask[0]; out[4] = pad[port].mask[1]; @@ -398,23 +398,23 @@ void pademu_cmd(int port, u8 *in, u8 *out, u8 out_size) } break; - case 0x43: //enter/exit config mode + case 0x43: // enter/exit config mode if (pad[port].mode_cfg) { pad[port].mode_cfg = in[3]; break; } pad[port].mode_cfg = in[3]; - case 0x42: //read data + case 0x42: // read data if (in[1] == 0x42) { - if (pad[port].vibration) { //disable/enable vibration + if (pad[port].vibration) { // disable/enable vibration PAD_SET_RUMBLE(in[pad[port].lrum], in[pad[port].rrum], port); } } i = PAD_GET_DATA(&out[3], out_size - 3, port); - if (pad[port].mode_lock == 0) { //mode unlocked + if (pad[port].mode_lock == 0) { // mode unlocked if (pad[port].mode != i) { pad[port].mode = i; @@ -428,7 +428,7 @@ void pademu_cmd(int port, u8 *in, u8 *out, u8 out_size) out[1] = pad[port].mode_id; break; - case 0x44: //set mode and lock + case 0x44: // set mode and lock pad[port].mode = in[3]; pad[port].mode_lock = in[4]; if (pad[port].mode) { @@ -443,12 +443,12 @@ void pademu_cmd(int port, u8 *in, u8 *out, u8 out_size) PAD_SET_MODE(pad[port].mode, pad[port].mode_lock, port); break; - case 0x45: //query model and mode + case 0x45: // query model and mode mips_memcpy(&out[3], &pademu_data[1], 6); out[5] = pad[port].mode; break; - case 0x46: //query act + case 0x46: // query act if (in[3] == 0x00) mips_memcpy(&out[3], &pademu_data[2], 6); else @@ -456,11 +456,11 @@ void pademu_cmd(int port, u8 *in, u8 *out, u8 out_size) break; - case 0x47: //query comb + case 0x47: // query comb mips_memcpy(&out[3], &pademu_data[4], 6); break; - case 0x4C: //query mode + case 0x4C: // query mode if (in[3] == 0x00) out[6] = 0x04; else @@ -468,10 +468,10 @@ void pademu_cmd(int port, u8 *in, u8 *out, u8 out_size) break; - case 0x4D: //set act align + case 0x4D: // set act align mips_memcpy(&out[3], &pademu_data[5], 6); - for (i = 0; i < 6; i++) { //vibration + for (i = 0; i < 6; i++) { // vibration if (in[3 + i] == 0x00) pad[port].rrum = i + 3; @@ -480,7 +480,7 @@ void pademu_cmd(int port, u8 *in, u8 *out, u8 out_size) } break; - case 0x4F: //set button info + case 0x4F: // set button info pad[port].mode_id = ANALOGP_MODE; pad[port].mode_p = 1; @@ -513,24 +513,24 @@ void pademu_mtap(sio2_transfer_data_t *td) } switch (td->in[1]) { - case 0x12: //returns slot number for pad + case 0x12: // returns slot number for pad mips_memcpy(td->out, &mtap_data, sizeof(mtap_data)); td->out[3] = MAX_SLOT; td->stat6c = 0x00001100; mtap_inited = 1; break; - case 0x13: //returns slot number for mc + case 0x13: // returns slot number for mc break; - case 0x21: //changes slot for pad + case 0x21: // changes slot for pad mips_memcpy(td->out, &mtap_data, sizeof(mtap_data)); - mtap_slot = td->out[5] = td->in[2]; //slot + mtap_slot = td->out[5] = td->in[2]; // slot td->out[6] = 0x5a; td->stat6c = 0x00001100; break; - case 0x22: //changes slot for mc + case 0x22: // changes slot for mc break; } } diff --git a/modules/pademu/sys_utils.c b/modules/pademu/sys_utils.c index 6fb76d10c..31cbf66c5 100644 --- a/modules/pademu/sys_utils.c +++ b/modules/pademu/sys_utils.c @@ -1,4 +1,4 @@ -//sio2man hook code taken from opl mcemu: +// sio2man hook code taken from opl mcemu: /* Copyright 2006-2008, Romz Copyright 2010, Polo @@ -32,7 +32,7 @@ void *GetExportTable(char *libname, int version) return NULL; } //------------------------------ -//endfunc +// endfunc //--------------------------------------------------------------------------- /* Returns number of entries in the export table */ u32 GetExportTableSize(void *table) @@ -50,7 +50,7 @@ u32 GetExportTableSize(void *table) return size; } //------------------------------ -//endfunc +// endfunc //--------------------------------------------------------------------------- /* Returns an entry from the export table */ void *GetExportEntry(void *table, u32 entry) @@ -66,7 +66,7 @@ void *GetExportEntry(void *table, u32 entry) return NULL; } //------------------------------ -//endfunc +// endfunc //--------------------------------------------------------------------------- /* Replaces an entry in the export table */ void *HookExportEntry(void *table, u32 entry, void *func) @@ -90,5 +90,5 @@ void *HookExportEntry(void *table, u32 entry, void *func) return NULL; } //------------------------------ -//endfunc +// endfunc //--------------------------------------------------------------------------- diff --git a/modules/vmc/genvmc/genvmc.c b/modules/vmc/genvmc/genvmc.c index 5f7327d1e..ef9c34097 100644 --- a/modules/vmc/genvmc/genvmc.c +++ b/modules/vmc/genvmc/genvmc.c @@ -180,7 +180,7 @@ static int mc_getmcrtime(sceMcStDateTime *time) time->Hour = btoi(cdtime.hour); time->Day = btoi(cdtime.day); - if ((cdtime.month & 0x10) != 0) //Keep only valid bits: 0x1f (for month values 1-12 in BCD) + if ((cdtime.month & 0x10) != 0) // Keep only valid bits: 0x1f (for month values 1-12 in BCD) time->Month = (cdtime.month & 0xf) + 0xa; else time->Month = cdtime.month & 0xf; diff --git a/pc/genvmc/src/genvmc.c b/pc/genvmc/src/genvmc.c index 46454f1ac..108078e54 100644 --- a/pc/genvmc/src/genvmc.c +++ b/pc/genvmc/src/genvmc.c @@ -405,10 +405,10 @@ int main(int argc, char **argv, char **env) return EXIT_FAILURE; } - //if ((size_MB != 1) && (size_MB % 8)) { - // printf("Error: VMC size_in_MB not multiple of 8...\n"); - // return EXIT_FAILURE; - //} + // if ((size_MB != 1) && (size_MB % 8)) { + // printf("Error: VMC size_in_MB not multiple of 8...\n"); + // return EXIT_FAILURE; + // } int r = vmc_mcformat(argv[2], size_MB * 1024, 16); if (r != 0) { diff --git a/pc/iso2opl/src/iso2opl.c b/pc/iso2opl/src/iso2opl.c index 1b031bd21..3ad3e1d56 100644 --- a/pc/iso2opl/src/iso2opl.c +++ b/pc/iso2opl/src/iso2opl.c @@ -1,6 +1,6 @@ /* Copyright 2009, jimmikaelkael - Copyright (c) 2002, A.Lee & Nicholas Van Veen + Copyright (c) 2002, A.Lee & Nicholas Van Veen Licenced under Academic Free License version 3.0 Review OpenUsbLd README & LICENSE files for further details. @@ -73,7 +73,7 @@ u32 crc32(const char *string) int check_cfg(const char *drive, const char *game_name, const char *game_id) { int r; - //int fh_cfg; + // int fh_cfg; FILE *fh_cfg; cfg_t cfg; char cfg_path[256]; @@ -90,24 +90,26 @@ int check_cfg(const char *drive, const char *game_name, const char *game_id) #endif sprintf(cfg_image, "ul.%s", game_id); - /*fh_cfg = open(cfg_path, O_RDONLY); - if (fh_cfg >= 0) { - while ((r = read(fh_cfg, &cfg, sizeof(cfg_t))) != 0) { - if (r != sizeof(cfg_t)) { - close(fh_cfg); - return -3; - } - if (!strcmp(cfg.name, game_name)) { - close(fh_cfg); - return -1; - } - if (!strcmp(cfg.image, cfg_image)) { - close(fh_cfg); - return -2; - } - } - close(fh_cfg); - }*/ + + /* fh_cfg = open(cfg_path, O_RDONLY); + if (fh_cfg >= 0) { + while ((r = read(fh_cfg, &cfg, sizeof(cfg_t))) != 0) { + if (r != sizeof(cfg_t)) { + close(fh_cfg); + return -3; + } + if (!strcmp(cfg.name, game_name)) { + close(fh_cfg); + return -1; + } + if (!strcmp(cfg.image, cfg_image)) { + close(fh_cfg); + return -2; + } + } + close(fh_cfg); + } */ + fh_cfg = fopen(cfg_path, "rb"); if (fh_cfg) { while ((r = fread(&cfg, 1, sizeof(cfg_t), fh_cfg)) != 0) { @@ -133,7 +135,7 @@ int check_cfg(const char *drive, const char *game_name, const char *game_id) //----------------------------------------------------------------------- int write_cfg(const char *drive, const char *game_name, const char *game_id, const char *media, int parts) { - //int fh_cfg; + // int fh_cfg; FILE *fh_cfg; cfg_t cfg; char cfg_path[256]; @@ -163,19 +165,18 @@ int write_cfg(const char *drive, const char *game_name, const char *game_id, con else if (!strcmp(media, "DVD")) cfg.media = 0x14; - /* - fh_cfg = open(cfg_path, O_WRONLY|O_CREAT|O_APPEND); - if (fh_cfg < 0) - return -1; + /* fh_cfg = open(cfg_path, O_WRONLY | O_CREAT | O_APPEND); + if (fh_cfg < 0) + return -1; - r = write(fh_cfg, &cfg, sizeof(cfg_t)); - if (r != sizeof(cfg_t)) { - close(fh_cfg); - return -2; - } + r = write(fh_cfg, &cfg, sizeof(cfg_t)); + if (r != sizeof(cfg_t)) { + close(fh_cfg); + return -2; + } + + close(fh_cfg); */ - close(fh_cfg); - */ fh_cfg = fopen(cfg_path, "ab"); if (!fh_cfg) return -1; @@ -194,7 +195,7 @@ int write_cfg(const char *drive, const char *game_name, const char *game_id, con //---------------------------------------------------------------- int write_parts(const char *drive, const char *game_name, const char *game_id, s64 filesize, int parts) { - //int fh_part; + // int fh_part; FILE *fh_part; char part_path[256]; int i, r; @@ -221,52 +222,52 @@ int write_parts(const char *drive, const char *game_name, const char *game_id, s sprintf(part_path, "%s/ul.%08X.%s.%02d", drive, crc32(game_name), game_id, i); #endif /* - fh_part = open(part_path, O_WRONLY|O_TRUNC|O_CREAT); - if (fh_part < 0) { - free(buf); - return -2; - } - - nbytes = filesize; - if (nbytes > 1073741824) - nbytes = 1073741824; - - rpos = 0; - if (nbytes) { - do { - if (nbytes > WR_SIZE) - size = WR_SIZE; - else - size = nbytes; - - r = isofs_ReadISO(iso_pos, size, buf); - if (r != size) { - free(buf); - close(fh_part); - return -3; - } - - printf("Writing %d sectors to %s - LBA: %d\n", WR_SIZE >> 11, part_path, (int)(iso_pos >> 11)); - - // write to file - r = write(fh_part, buf, size); - if (r != size) { - free(buf); - close(fh_part); - return -4; - } - - size = r; - rpos += size; - iso_pos += size; - nbytes -= size; - - } while (nbytes); - } - filesize -= rpos; - close(fh_part); - } -*/ + fh_part = open(part_path, O_WRONLY | O_TRUNC | O_CREAT); + if (fh_part < 0) { + free(buf); + return -2; + } + + nbytes = filesize; + if (nbytes > 1073741824) + nbytes = 1073741824; + + rpos = 0; + if (nbytes) { + do { + if (nbytes > WR_SIZE) + size = WR_SIZE; + else + size = nbytes; + + r = isofs_ReadISO(iso_pos, size, buf); + if (r != size) { + free(buf); + close(fh_part); + return -3; + } + + printf("Writing %d sectors to %s - LBA: %d\n", WR_SIZE >> 11, part_path, (int)(iso_pos >> 11)); + + // write to file + r = write(fh_part, buf, size); + if (r != size) { + free(buf); + close(fh_part); + return -4; + } + + size = r; + rpos += size; + iso_pos += size; + nbytes -= size; + + } while (nbytes); + } + filesize -= rpos; + close(fh_part); + } + */ fh_part = fopen(part_path, "wb"); if (!fh_part) { free(buf); @@ -557,7 +558,7 @@ int main(int argc, char **argv, char **env) #ifdef DEBUG printf("ISO filesize: 0x%llx\n", filesize); printf("Number of parts: %d\n", num_parts); -//return 0; +// return 0; #endif // write ISO parts to drive diff --git a/pc/iso2opl/src/iso2opl.h b/pc/iso2opl/src/iso2opl.h index d451fc2ff..791cdea10 100644 --- a/pc/iso2opl/src/iso2opl.h +++ b/pc/iso2opl/src/iso2opl.h @@ -1,6 +1,6 @@ /* Copyright 2009, jimmikaelkael - Copyright (c) 2002, A.Lee & Nicholas Van Veen + Copyright (c) 2002, A.Lee & Nicholas Van Veen Licenced under Academic Free License version 3.0 Review OpenUsbLd README & LICENSE files for further details. diff --git a/pc/iso2opl/src/isofs.c b/pc/iso2opl/src/isofs.c index fcf71d71d..daacce8df 100644 --- a/pc/iso2opl/src/isofs.c +++ b/pc/iso2opl/src/isofs.c @@ -1,6 +1,6 @@ /* Copyright 2009, jimmikaelkael - Copyright (c) 2002, A.Lee & Nicholas Van Veen + Copyright (c) 2002, A.Lee & Nicholas Van Veen Licenced under Academic Free License version 3.0 Review OpenUsbLd README & LICENSE files for further details. @@ -15,7 +15,7 @@ static int gIsBigEnd = 0; #define MAX_DIR_CACHE_SECTORS 32 -//int g_fh_iso; +// int g_fh_iso; FILE *g_fh_iso; typedef struct @@ -163,21 +163,21 @@ int isofs_ReadISO(s64 offset, u32 nbytes, void *buf) printf("isofs_ReadISO: offset = %lld nbytes = %d\n", offset, nbytes); #endif - //lseek64(g_fh_iso, offset, SEEK_SET); - //r = read(g_fh_iso, buf, nbytes); + // lseek64(g_fh_iso, offset, SEEK_SET); + // r = read(g_fh_iso, buf, nbytes); fseeko64(g_fh_iso, offset, SEEK_SET); r = fread(buf, 1, nbytes, g_fh_iso); - /* - int i; - u8 *p = (u8 *)buf; - for (i=0; ifileProperties & 0x02) == 0) { - // It's a file + // if ((tocEntryPointer->fileProperties & 0x02) == 0) { + // It's a file TocEntryCopy(tocEntry, tocEntryPointer); if (strcasecmp(tocEntry->filename, filename) == 0) { @@ -1048,16 +1048,16 @@ s64 isofs_Init(const char *iso_path, int isBigEndian) CachedDirInfo.cache = (u8 *)isofs_dircache; isofs_FlushCache(); - //g_fh_iso = open(iso_path, O_RDONLY); - //if (g_fh_iso < 0) - // return 0; + // g_fh_iso = open(iso_path, O_RDONLY); + // if (g_fh_iso < 0) + // return 0; g_fh_iso = fopen(iso_path, "rb"); if (!g_fh_iso) return 0; } - //r = lseek64(g_fh_iso, 0, SEEK_END); - //lseek64(g_fh_iso, 0, SEEK_SET); + // r = lseek64(g_fh_iso, 0, SEEK_END); + // lseek64(g_fh_iso, 0, SEEK_SET); fseeko64(g_fh_iso, 0, SEEK_END); r = ftello64(g_fh_iso); fseeko64(g_fh_iso, 0, SEEK_SET); @@ -1077,11 +1077,11 @@ int isofs_Reset(void) if (isofs_inited) { isofs_FlushCache(); - //close(g_fh_iso); + // close(g_fh_iso); fclose(g_fh_iso); } - //g_fh_iso = -1; + // g_fh_iso = -1; g_fh_iso = NULL; isofs_inited = 0; diff --git a/pc/opl2iso/src/opl2iso.c b/pc/opl2iso/src/opl2iso.c index d4bdbbc39..944d6b6f0 100644 --- a/pc/opl2iso/src/opl2iso.c +++ b/pc/opl2iso/src/opl2iso.c @@ -1,7 +1,7 @@ /* Copyright 2010, volca Parts Copyright 2009, jimmikaelkael - Copyright (c) 2002, A.Lee & Nicholas Van Veen + Copyright (c) 2002, A.Lee & Nicholas Van Veen Licenced under Academic Free License version 3.0 Review OpenUsbLd README & LICENSE files for further details. @@ -168,7 +168,7 @@ int findGame(const char *gameid, cfg_t *item) temp = (char *)gameid; else temp++; - if ((strlen(temp) >= 23) //Minimum part file name length is really 26 + if ((strlen(temp) >= 23) // Minimum part file name length is really 26 && (strncmp("ul.", temp, 3) == 0) //"ul." at start && (strncmp(&item->image[2], &(temp[11]), 12) == 0) //.game_ID after CRC ) diff --git a/pc/opl2iso/src/opl2iso.h b/pc/opl2iso/src/opl2iso.h index bea672e16..d278b3ab8 100644 --- a/pc/opl2iso/src/opl2iso.h +++ b/pc/opl2iso/src/opl2iso.h @@ -1,7 +1,7 @@ /* Copyright 2010, volca Parts Copyright 2009, jimmikaelkael - Copyright (c) 2002, A.Lee & Nicholas Van Veen + Copyright (c) 2002, A.Lee & Nicholas Van Veen Licenced under Academic Free License version 3.0 Review OpenUsbLd README & LICENSE files for further details. diff --git a/src/OSDHistory.c b/src/OSDHistory.c index 0e555320e..956eed4c8 100644 --- a/src/OSDHistory.c +++ b/src/OSDHistory.c @@ -1,11 +1,11 @@ -/* Play history management functions - Note: while the code for updating the data itself was a copy of the original, - the code that reads/writes the history file was written with general know-how, - for simplicity. - The original code used libmc and was also designed to allow the host software (the browser) access the history. - (the browser's boot animation would vary according to the user's play history) +/* Play history management functions + Note: while the code for updating the data itself was a copy of the original, + the code that reads/writes the history file was written with general know-how, + for simplicity. + The original code used libmc and was also designed to allow the host software (the browser) access the history. + (the browser's boot animation would vary according to the user's play history) - However, OPL does not need any of that, so it can be made simpler. */ + However, OPL does not need any of that, so it can be made simpler. */ #include #include @@ -20,8 +20,8 @@ #include "include/util.h" #include "include/OSDHistory.h" -/* The OSDs have this weird bug whereby the size of the icon file is hardcoded to 1776 bytes... even though that is way too long! - Unfortunately, using the right size will cause the icon to be deemed as corrupted data by the HDDOSD. */ +/* The OSDs have this weird bug whereby the size of the icon file is hardcoded to 1776 bytes... even though that is way too long! + Unfortunately, using the right size will cause the icon to be deemed as corrupted data by the HDDOSD. */ #define SONY_SYSDATA_ICON_SYS_SIZE 1776 extern unsigned char icon_sys_A[]; @@ -49,12 +49,12 @@ int CreateSystemDataFolder(const char *path, char FolderRegionLetter) icon = icon_sys_C; size = SONY_SYSDATA_ICON_SYS_SIZE; break; - default: //case 'A': + default: // case 'A': icon = icon_sys_A; size = SONY_SYSDATA_ICON_SYS_SIZE; break; } - result = write(fd, icon, size) == size ? 0 : -EIO; //Yes, just let it write past the end of the icon. Read the comment above. + result = write(fd, icon, size) == size ? 0 : -EIO; // Yes, just let it write past the end of the icon. Read the comment above. close(fd); } else result = fd; @@ -114,8 +114,8 @@ int AddOldHistoryFileRecord(const char *path, const struct HistoryEntry *OldHist static u16 GetTimestamp(void) { - //The original obtained the time and date from globals. - //return OSD_HISTORY_SET_DATE(currentYear, currentMonth, currentDate); + // The original obtained the time and date from globals. + // return OSD_HISTORY_SET_DATE(currentYear, currentMonth, currentDate); sceCdCLOCK time; sceCdReadClock(&time); return OSD_HISTORY_SET_DATE(btoi(time.year), btoi(time.month & 0x7F), btoi(time.day)); @@ -132,7 +132,7 @@ int AddHistoryRecord(const char *name) DEBUG_PRINTF("Adding history record: %s\n", name); - //For simplicity, create the data folder immediately if the history file does not exist (unlike the original). + // For simplicity, create the data folder immediately if the history file does not exist (unlike the original). sprintf(path, "mc0:/%s", GetSystemDataPath()); if ((result = LoadHistoryFile(path, HistoryEntries)) != 0) { path[2] = '1'; @@ -171,7 +171,7 @@ int AddHistoryRecord(const char *name) } } - //In v1.0x, this was strcmp + // In v1.0x, this was strcmp if (!strncmp(HistoryEntries[i].name, name, sizeof(HistoryEntries[i].name))) { IsNewRecord = 0; @@ -193,7 +193,7 @@ int AddHistoryRecord(const char *name) HistoryEntries[i].LaunchCount = NewLaunchCount; } else { - //Was a check against 0x40 in v1.0x + // Was a check against 0x40 in v1.0x if (HistoryEntries[i].LaunchCount < 0x3F) { HistoryEntries[i].LaunchCount++; } else { @@ -203,15 +203,15 @@ int AddHistoryRecord(const char *name) } } } - - /* i = 0; - do { //Original does this. I guess, it is used to ensure that the next random value is truly random? - rand(); - i++; - } while(i < (currentMinute * 60 + currentSecond)); */ - + /* + i = 0; + do { //Original does this. I guess, it is used to ensure that the next random value is truly random? + rand(); + i++; + } while (i < (currentMinute * 60 + currentSecond)); + */ if (IsNewRecord) { - //Count and consolidate a list of blank slots. + // Count and consolidate a list of blank slots. NumBlankSlots = 0; NumSlotsUsed = 0; for (i = 0; i < MAX_HISTORY_ENTRIES; i++) { @@ -219,7 +219,7 @@ int AddHistoryRecord(const char *name) BlankSlotList[NumBlankSlots] = i; NumBlankSlots++; } else { - //Not present in v1.0x. + // Not present in v1.0x. if (HistoryEntries[i].ShiftAmount == 0x7) { NumSlotsUsed++; } @@ -228,18 +228,18 @@ int AddHistoryRecord(const char *name) if (NumSlotsUsed != MAX_HISTORY_ENTRIES) { if (NumBlankSlots > 0) { - //Randomly choose an empty slot. + // Randomly choose an empty slot. NewEntry = &HistoryEntries[result = BlankSlotList[rand() % NumBlankSlots]]; } else { - //Copy out the victim record + // Copy out the victim record NewEntry = &HistoryEntries[LeastUsedRecord]; memcpy(&OldHistoryEntry, NewEntry, sizeof(OldHistoryEntry)); - //Unlike the original, add the old history record here. + // Unlike the original, add the old history record here. AddOldHistoryFileRecord(path, &OldHistoryEntry); } - //Initialize the new entry. + // Initialize the new entry. strncpy(NewEntry->name, name, sizeof(NewEntry->name) - 1); NewEntry->LaunchCount = 1; NewEntry->bitmask = 1; @@ -248,12 +248,12 @@ int AddHistoryRecord(const char *name) } } - //Unlike the original, save here. + // Unlike the original, save here. return SaveHistoryFile(path, HistoryEntries); } static void GetBootFilename(const char *bootpath, char *filename) -{ //Extract filename from the full path to the file on the CD/DVD. +{ // Extract filename from the full path to the file on the CD/DVD. int i, length; filename[0] = '\0'; @@ -268,7 +268,7 @@ static void GetBootFilename(const char *bootpath, char *filename) } } - if (i == 0) { //The boot path contains only the filename. + if (i == 0) { // The boot path contains only the filename. strcpy(filename, bootpath); } } diff --git a/src/appsupport.c b/src/appsupport.c index 221d3a5c7..125a888a7 100644 --- a/src/appsupport.c +++ b/src/appsupport.c @@ -163,21 +163,21 @@ static int addAppsLegacyList(struct app_info_linked **appsLinkedList) strncpy(app->app.title, cur->key, APP_TITLE_MAX + 1); app->app.title[APP_TITLE_MAX] = '\0'; - //Split the boot filename from the path. + // Split the boot filename from the path. const char *elfname = appGetELFName(cur->val); if (elfname != cur->val) { strncpy(app->app.boot, elfname, APP_BOOT_MAX + 1); app->app.boot[APP_BOOT_MAX] = '\0'; int pathlen = (int)(elfname - cur->val) - 1; - if (cur->val[pathlen] == ':') //Discard only '/'. + if (cur->val[pathlen] == ':') // Discard only '/'. pathlen++; if (pathlen > APP_PATH_MAX) pathlen = APP_PATH_MAX; strncpy(app->app.path, cur->val, pathlen); app->app.path[pathlen] = '\0'; } else { - //Cannot split boot filename from the path, somehow. + // Cannot split boot filename from the path, somehow. strncpy(app->app.boot, cur->val, APP_BOOT_MAX + 1); app->app.boot[APP_BOOT_MAX] = '\0'; strncpy(app->app.path, cur->val, APP_PATH_MAX + 1); @@ -241,10 +241,10 @@ static int appUpdateItemList(void) appsLinkedList = NULL; - //Get legacy apps list first, so it is possible to use appGetConfigValue(id). + // Get legacy apps list first, so it is possible to use appGetConfigValue(id). appItemCount += addAppsLegacyList(&appsLinkedList); - //Scan devices for apps. + // Scan devices for apps. appItemCount += oplScanApps(&appScanCallback, &appsLinkedList); // Generate apps list @@ -252,7 +252,7 @@ static int appUpdateItemList(void) appsList = malloc(appItemCount * sizeof(app_info_t)); if (appsList != NULL) { - for (i = 0; appsLinkedList != NULL; i++) { //appsLinkedList contains items in reverse order. + for (i = 0; appsLinkedList != NULL; i++) { // appsLinkedList contains items in reverse order. memcpy(&appsList[appItemCount - i - 1], &appsLinkedList->app, sizeof(app_info_t)); appNext = appsLinkedList->next; @@ -354,17 +354,17 @@ static void appLaunchItem(int id, config_set_t *configSet) int mode, fd; const char *filename; - //Retrieve configuration set by appGetConfig() + // Retrieve configuration set by appGetConfig() configGetStr(configSet, CONFIG_ITEM_STARTUP, &filename); fd = open(filename, O_RDONLY); if (fd >= 0) { close(fd); - //To keep the necessary device accessible, we will assume the mode that owns the device which contains the file to boot. + // To keep the necessary device accessible, we will assume the mode that owns the device which contains the file to boot. mode = oplPath2Mode(filename); if (mode < 0) - mode = APP_MODE; //Legacy apps mode on memory card (mc?:/*) + mode = APP_MODE; // Legacy apps mode on memory card (mc?:/*) deinit(UNMOUNT_EXCEPTION, mode); // CAREFUL: deinit will call appCleanUp, so configApps/cur will be freed sysExecElf(filename); @@ -393,7 +393,7 @@ static config_set_t *appGetConfig(int id) snprintf(path, sizeof(path), "%s/%s", appsList[id].path, APP_TITLE_CONFIG_FILE); config = configAlloc(0, NULL, path); - configRead(config); //Does not matter if the config file could be loaded or not. + configRead(config); // Does not matter if the config file could be loaded or not. configSetStr(config, CONFIG_ITEM_NAME, appsList[id].boot); configSetStr(config, CONFIG_ITEM_LONGNAME, appsList[id].title); @@ -415,7 +415,7 @@ static int appGetImage(char *folder, int isRelative, char *value, char *suffix, return oplGetAppImage(device, folder, isRelative, startup, suffix, resultTex, psm); } -//This may be called, even if appInit() was not. +// This may be called, even if appInit() was not. static void appCleanUp(int exception) { if (appItemList.enabled) { @@ -425,7 +425,7 @@ static void appCleanUp(int exception) } } -//This may be called, even if appInit() was not. +// This may be called, even if appInit() was not. static void appShutdown(void) { if (appItemList.enabled) { diff --git a/src/bdmsupport.c b/src/bdmsupport.c index 22d1c80ee..99fa6eec3 100644 --- a/src/bdmsupport.c +++ b/src/bdmsupport.c @@ -15,7 +15,7 @@ #define NEWLIB_PORT_AWARE #include // fileXioIoctl, fileXioDevctl -static char bdmPrefix[40]; //Contains the full path to the folder where all the games are. +static char bdmPrefix[40]; // Contains the full path to the folder where all the games are. static int bdmULSizePrev = -2; static time_t bdmModifiedCDPrev; static time_t bdmModifiedDVDPrev; @@ -28,7 +28,7 @@ static int fireWireModLoaded = 0; // forward declaration static item_list_t bdmGameList; -//Identifies the partition that the specified file is stored on and generates a full path to it. +// Identifies the partition that the specified file is stored on and generates a full path to it. int bdmFindPartition(char *target, const char *name, int write) { int i, fd; @@ -276,7 +276,7 @@ static void bdmLaunchGame(int id, config_set_t *configSet) if (have_error) { char error[256]; - if (have_error == 2) //VMC file is fragmented + if (have_error == 2) // VMC file is fragmented snprintf(error, sizeof(error), _l(_STR_ERR_VMC_FRAGMENTED_CONTINUE), vmc_name, (vmc_id + 1)); else snprintf(error, sizeof(error), _l(_STR_ERR_VMC_CONTINUE), vmc_name, (vmc_id + 1)); @@ -310,7 +310,7 @@ static void bdmLaunchGame(int id, config_set_t *configSet) settings->LBAs[i] = fileXioIoctl(fd, USBMASS_IOCTL_GET_LBA, ""); if (fileXioIoctl(fd, USBMASS_IOCTL_CHECK_CHAIN, "") != 1) { close(fd); - //Game is fragmented. Do not continue. + // Game is fragmented. Do not continue. if (settings != NULL) sbUnprepare(&settings->common); @@ -323,7 +323,7 @@ static void bdmLaunchGame(int id, config_set_t *configSet) close(fd); } else { - //Unable to open part of the game. Do not continue. + // Unable to open part of the game. Do not continue. if (settings != NULL) sbUnprepare(&settings->common); guiMsgBox(_l(_STR_ERR_FILE_INVALID), 0, NULL); @@ -331,7 +331,7 @@ static void bdmLaunchGame(int id, config_set_t *configSet) } } - //Initialize layer 1 information. + // Initialize layer 1 information. sbCreatePath(game, partname, bdmPrefix, "/", 0); layer1_start = sbGetISO9660MaxLBA(partname); @@ -341,7 +341,7 @@ static void bdmLaunchGame(int id, config_set_t *configSet) layer1_offset = layer1_start % 0x80000; sbCreatePath(game, partname, bdmPrefix, "/", layer1_part); break; - default: //Raw ISO9660 disc image; one part. + default: // Raw ISO9660 disc image; one part. layer1_part = 0; layer1_offset = layer1_start; } @@ -395,7 +395,7 @@ static int bdmGetImage(char *folder, int isRelative, char *value, char *suffix, return texDiscoverLoad(resultTex, path, -1, psm); } -//This may be called, even if bdmInit() was not. +// This may be called, even if bdmInit() was not. static void bdmCleanUp(int exception) { if (bdmGameList.enabled) { @@ -408,7 +408,7 @@ static void bdmCleanUp(int exception) } } -//This may be called, even if bdmInit() was not. +// This may be called, even if bdmInit() was not. static void bdmShutdown(void) { if (bdmGameList.enabled) { diff --git a/src/cheatman.c b/src/cheatman.c index 26858865a..3239a62b2 100644 --- a/src/cheatman.c +++ b/src/cheatman.c @@ -29,20 +29,20 @@ static int gEnableCheat; // Enables PS2RD Cheat Engine - 0 for Off, 1 for On static int gCheatMode; // Cheat Mode - 0 Enable all cheats, 1 Cheats selected by user -static int gCheatList[MAX_CHEATLIST]; //Store hooks/codes addr+val pairs +static int gCheatList[MAX_CHEATLIST]; // Store hooks/codes addr+val pairs void InitCheatsConfig(config_set_t *configSet) { config_set_t *configGame = configGetByType(CONFIG_GAME); - //Default values. + // Default values. gCheatSource = 0; gEnableCheat = 0; gCheatMode = 0; memset(gCheatList, 0, sizeof(gCheatList)); if (configGetInt(configSet, CONFIG_ITEM_CHEATSSOURCE, &gCheatSource)) { - //Load the rest of the per-game CHEAT configuration if CHEAT is enabled. + // Load the rest of the per-game CHEAT configuration if CHEAT is enabled. if (configGetInt(configSet, CONFIG_ITEM_ENABLECHEAT, &gEnableCheat) && gEnableCheat) { configGetInt(configSet, CONFIG_ITEM_CHEATMODE, &gCheatMode); } @@ -82,7 +82,7 @@ static code_t make_code(const char *s) sscanf(digits, "%08X %08X", &address, &value); - //Return Code Address and Value + // Return Code Address and Value code.addr = address; code.val = value; return code; diff --git a/src/config.c b/src/config.c index 81c30b1ee..98b3ee252 100644 --- a/src/config.c +++ b/src/config.c @@ -429,7 +429,7 @@ static int configReadLegacyIP(void) configSetStr(configSet, CONFIG_NET_PS2_NETM, temp); snprintf(temp, sizeof(temp), "%d.%d.%d.%d", ps2_gateway[0], ps2_gateway[1], ps2_gateway[2], ps2_gateway[3]); configSetStr(configSet, CONFIG_NET_PS2_GATEW, temp); - //The legacy format has no setting for the DNS server, so duplicate the gateway address. + // The legacy format has no setting for the DNS server, so duplicate the gateway address. configSetStr(configSet, CONFIG_NET_PS2_DNS, temp); return 1; @@ -481,8 +481,8 @@ static int configReadFileBuffer(file_buffer_t *fileBuffer, config_set_t *configS if (splitAssignment(line, key, sizeof(key), val, sizeof(val))) { /* if the line does not start with whitespace, - * the prefix ends and we have to reset it - */ + * the prefix ends and we have to reset it + */ if (!isWS(line[0])) memset(prefix, 0, sizeof(prefix)); @@ -597,7 +597,7 @@ int configReadMulti(int types) } } - //If the network configuration is to be loaded and one cannot be loaded, attempt to load from the legacy network config file. + // If the network configuration is to be loaded and one cannot be loaded, attempt to load from the legacy network config file. if ((types & CONFIG_NETWORK) && !(result & CONFIG_NETWORK)) if (configReadLegacyIP()) result |= CONFIG_NETWORK; diff --git a/src/dia.c b/src/dia.c index 001dcbe5f..36cc84440 100644 --- a/src/dia.c +++ b/src/dia.c @@ -91,14 +91,14 @@ int diaShowKeyb(char *text, int maxLen, int hide_text, const char *title) guiDrawBGPlasma(); rmDrawRect(0, 0, screenWidth, screenHeight, gColDarker); - //Title + // Title if (title != NULL) { fntRenderString(gTheme->fonts[0], 25, 20, ALIGN_NONE, 0, 0, title, gTheme->textColor); // separating line rmDrawLine(25, 38, 615, 38, gColWhite); } - //Text + // Text fntRenderString(gTheme->fonts[0], 50, 120, ALIGN_NONE, 0, 0, hide_text ? mask_buffer : text, gTheme->textColor); // separating line for simpler orientation @@ -206,7 +206,7 @@ int diaShowKeyb(char *text, int maxLen, int hide_text, const char *title) sfxPlay(SFX_CONFIRM); if (mask_buffer != NULL) free(mask_buffer); - return 1; //ENTER + return 1; // ENTER } else if (selcommand == 3) { sfxPlay(SFX_CONFIRM); selkeyb = (selkeyb + 1) % KEYB_MODE; // MODE @@ -239,7 +239,7 @@ int diaShowKeyb(char *text, int maxLen, int hide_text, const char *title) sfxPlay(SFX_CONFIRM); if (mask_buffer != NULL) free(mask_buffer); - return 1; //ENTER + return 1; // ENTER } else if (getKeyOn(KEY_SELECT)) { selkeyb = (selkeyb + 1) % KEYB_MODE; // MODE sfxPlay(SFX_CONFIRM); @@ -670,7 +670,7 @@ static int diaHandleInput(struct UIItem *item, int *modified) if (item->intvalue.current < item->intvalue.max) { item->intvalue.current++; } else { - item->intvalue.current = item->intvalue.min; //was "= 0;" + item->intvalue.current = item->intvalue.min; // was "= 0;" } } else if (getKey(KEY_DOWN)) { sfxPlay(SFX_CURSOR); diff --git a/src/ethsupport.c b/src/ethsupport.c index d6abd3df0..4411ace80 100644 --- a/src/ethsupport.c +++ b/src/ethsupport.c @@ -19,7 +19,7 @@ #include "include/nbns.h" #include "httpclient.h" -static char ethPrefix[40]; //Contains the full path to the folder where all the games are. +static char ethPrefix[40]; // Contains the full path to the folder where all the games are. static char *ethBase; static int ethULSizePrev = -2; static time_t ethModifiedCDPrev; @@ -43,7 +43,7 @@ static int ethReadNetConfig(void); static int ethInitSemaID = -1; -//Initializes locking semaphore for network support (not for just SMB support, but for the network subsystem). +// Initializes locking semaphore for network support (not for just SMB support, but for the network subsystem). static int ethInitSema(void) { if (ethInitSemaID < 0) { @@ -179,7 +179,7 @@ static int WaitValidNetState(int (*checkingFunction)(void)) SetAlarm(1000 * rmGetHsync(), &EthStatusCheckCb, &SemaID); WaitSema(SemaID); - if (retry_cycles >= 30) //30s = 30*1000ms + if (retry_cycles >= 30) // 30s = 30*1000ms { DeleteSema(SemaID); return -1; @@ -211,7 +211,7 @@ static int ethInitApplyConfig(void) } } while (ethApplyNetIFConfig() != 0); - //Before the network configuration is applied, wait for a valid link status. + // Before the network configuration is applied, wait for a valid link status. if (ethWaitValidNetIFLinkState() != 0) { gNetworkStartup = ERROR_ETH_LINK_FAIL; return ERROR_ETH_LINK_FAIL; @@ -219,7 +219,7 @@ static int ethInitApplyConfig(void) ethApplyIPConfig(); - //Wait for DHCP to initialize, if DHCP is enabled. + // Wait for DHCP to initialize, if DHCP is enabled. if (ps2_ip_use_dhcp && (ethWaitValidDHCPState() != 0)) { gNetworkStartup = ERROR_ETH_DHCP_FAIL; return ERROR_ETH_DHCP_FAIL; @@ -284,8 +284,8 @@ static int ethLoadModules(void) sysLoadModuleBuffer(&smsutils_irx, size_smsutils_irx, 0, NULL); if (sysLoadModuleBuffer(&smap_irx, size_smap_irx, 0, NULL) >= 0) { - //Before the network stack is loaded, attempt to set the link settings in order to avoid needing double-initialization of the IF. - //But do not fail here because there is currently no way to re-start initialization. + // Before the network stack is loaded, attempt to set the link settings in order to avoid needing double-initialization of the IF. + // But do not fail here because there is currently no way to re-start initialization. ethApplyNetIFConfig(); if (sysLoadModuleBuffer(&ps2ip_irx, size_ps2ip_irx, 0, NULL) >= 0) { @@ -324,7 +324,7 @@ void ethDeinitModules(void) ethInitSemaID = -1; } - //To allow the configuration to be read later on, read the latest version now. + // To allow the configuration to be read later on, read the latest version now. ethReadNetConfig(); ps2ip_deinit(); } @@ -351,7 +351,7 @@ int ethLoadInitModules(void) void ethDisplayErrorStatus(void) { switch (gNetworkStartup) { - case 0: //No error + case 0: // No error break; case ERROR_ETH_MODULE_NETIF_FAILURE: setErrorMessageWithCode(_STR_NETWORK_STARTUP_ERROR_NETIF, gNetworkStartup); @@ -652,7 +652,7 @@ static void ethLaunchGame(int id, config_set_t *configSet) case GAME_FORMAT_ISO: sprintf(settings->filename, "%s%s", game->name, game->extension); break; - default: //USBExtreme format. + default: // USBExtreme format. sprintf(settings->filename, "ul.%08X.%s", USBA_crc32(game->name), game->startup); settings->common.flags |= IOPCORE_SMB_FORMAT_USBLD; } @@ -664,7 +664,7 @@ static void ethLaunchGame(int id, config_set_t *configSet) strcpy(settings->smb_user, gPCUserName); strcpy(settings->smb_password, gPCPassword); - //Initialize layer 1 information. + // Initialize layer 1 information. sbCreatePath(game, partname, ethPrefix, "\\", 0); if (gPS2Logo) { @@ -683,7 +683,7 @@ static void ethLaunchGame(int id, config_set_t *configSet) layer1_offset = layer1_start % 0x80000; sbCreatePath(game, partname, ethPrefix, "\\", layer1_part); break; - default: //Raw ISO9660 disc image; one part. + default: // Raw ISO9660 disc image; one part. layer1_part = 0; layer1_offset = layer1_start; } @@ -719,7 +719,7 @@ static int ethGetImage(char *folder, int isRelative, char *value, char *suffix, return texDiscoverLoad(resultTex, path, -1, psm); } -//This may be called, even if ethInit() was not. +// This may be called, even if ethInit() was not. static void ethCleanUp(int exception) { if (ethGameList.enabled) { @@ -732,11 +732,11 @@ static void ethCleanUp(int exception) ethSMBDisconnect(); } - //UI may have initialized modules outside of ETH mode, so deinitialize regardless of the enabled status. + // UI may have initialized modules outside of ETH mode, so deinitialize regardless of the enabled status. ethDeinitModules(); } -//This may be called, even if ethInit() was not. +// This may be called, even if ethInit() was not. static void ethShutdown(void) { if (ethGameList.enabled) { @@ -748,10 +748,10 @@ static void ethShutdown(void) ethSMBDisconnect(); } - //UI may have initialized modules outside of ETH mode, so deinitialize regardless of the enabled status. + // UI may have initialized modules outside of ETH mode, so deinitialize regardless of the enabled status. ethDeinitModules(); - //Only shut down dev9 from here, if it was initialized from here before. + // Only shut down dev9 from here, if it was initialized from here before. if (ethModulesLoaded) sysShutdownDev9(); } @@ -803,7 +803,7 @@ int ethGetNetConfig(u8 *ip_address, u8 *netmask, u8 *gateway) { int result; - //Read a cached copy of the settings, if this is read after deinitialization. + // Read a cached copy of the settings, if this is read after deinitialization. result = ethModulesLoaded ? ethReadNetConfig() : -1; ip_address[0] = ip4_addr1(&lastIP); ip_address[1] = ip4_addr2(&lastIP); @@ -877,7 +877,7 @@ static int ethApplyIPConfig(void) IP4_ADDR(&dns, ps2_dns[0], ps2_dns[1], ps2_dns[2], ps2_dns[3]); dns_curr = dns_getserver(0); - //Check if it's the same. Otherwise, apply the new configuration. + // Check if it's the same. Otherwise, apply the new configuration. if ((ps2_ip_use_dhcp != ip_info.dhcp_enabled) || (!ps2_ip_use_dhcp && (!ip_addr_cmp(&ipaddr, &ip_info_ipaddr) || !ip_addr_cmp(&netmask, &ip_info_netmask) || diff --git a/src/fntsys.c b/src/fntsys.c index b749be089..0e55a10c3 100644 --- a/src/fntsys.c +++ b/src/fntsys.c @@ -62,9 +62,9 @@ typedef struct typedef struct { /** GLYPH CACHE. Every glyph in the ASCII range is cached when first used - * this means no additional memory aside from the one needed to render the - * character set is used. - */ + * this means no additional memory aside from the one needed to render the + * character set is used. + */ fnt_glyph_cache_entry_t **glyphCache; /// Maximal font cache page index @@ -353,7 +353,7 @@ static int fntGlyphAtlasPlace(font_t *font, fnt_glyph_cache_entry_t *glyph) { FT_GlyphSlot slot = font->face->glyph; - //LOG("FNTSYS GlyphAtlasPlace: Placing the glyph... %d x %d\n", slot->bitmap.width, slot->bitmap.rows); + // LOG("FNTSYS GlyphAtlasPlace: Placing the glyph... %d x %d\n", slot->bitmap.width, slot->bitmap.rows); if (slot->bitmap.width == 0 || slot->bitmap.rows == 0) { // no bitmap glyph, just skip @@ -362,16 +362,16 @@ static int fntGlyphAtlasPlace(font_t *font, fnt_glyph_cache_entry_t *glyph) int aid = 0; for (; aid < ATLAS_MAX; aid++) { - //LOG("FNTSYS Placing aid %d...\n", aid); + // LOG("FNTSYS Placing aid %d...\n", aid); atlas_t **atl = &font->atlases[aid]; if (!*atl) { // atlas slot not yet used - //LOG("FNTSYS aid %d is new...\n", aid); + // LOG("FNTSYS aid %d is new...\n", aid); *atl = fntNewAtlas(); } glyph->allocation = atlasPlace(*atl, slot->bitmap.width, slot->bitmap.rows, slot->bitmap.buffer); if (glyph->allocation) { - //LOG("FNTSYS Found placement\n", aid); + // LOG("FNTSYS Found placement\n", aid); glyph->atlas = *atl; return 1; @@ -396,9 +396,9 @@ static fnt_glyph_cache_entry_t *fntCacheGlyph(font_t *font, uint32_t gid) fnt_glyph_cache_entry_t *page = font->glyphCache[pageid]; /* Should never happen. - if (!page) // safeguard - return NULL; - */ + if (!page) // safeguard + return NULL; + */ fnt_glyph_cache_entry_t *glyph = &page[idx]; if (glyph->isValid) @@ -453,7 +453,7 @@ void fntUpdateAspectRatio() for (i = 0; i < FNT_MAX_COUNT; i++) { if (fonts[i].isValid) { fntCacheFlush(&fonts[i]); - //TODO: this seems correct, but the rest of the OPL UI (i.e. spacers) doesn't seem to be correctly scaled. + // TODO: this seems correct, but the rest of the OPL UI (i.e. spacers) doesn't seem to be correctly scaled. FT_Set_Char_Size(fonts[i].face, FNTSYS_CHAR_SIZE * 64, FNTSYS_CHAR_SIZE * 64, fDPI * ws, fDPI * hs); } } @@ -464,14 +464,14 @@ static void fntRenderGlyph(fnt_glyph_cache_entry_t *glyph, int pen_x, int pen_y) // only if glyph has atlas placement if (glyph->allocation) { /* TODO: Ineffective on many parts: - * 1. Usage of floats for UV - fixed point should suffice (and is used internally by GS for UV) - * - * 2. GS_SETREG_TEX0 for every quad - why? gsKit should only set texture if demanded - * We should prepare a special fnt render method that would step over most of the - * performance problems under - beginning with rmSetupQuad and continuing into gsKit - * - this method would handle the preparation of the quads and GS upload itself, - * without the use of prim_quad_texture and rmSetupQuad... - */ + * 1. Usage of floats for UV - fixed point should suffice (and is used internally by GS for UV) + * + * 2. GS_SETREG_TEX0 for every quad - why? gsKit should only set texture if demanded + * We should prepare a special fnt render method that would step over most of the + * performance problems under - beginning with rmSetupQuad and continuing into gsKit + * - this method would handle the preparation of the quads and GS upload itself, + * without the use of prim_quad_texture and rmSetupQuad... + */ quad.ul.x = pen_x + glyph->ox; if (rmGetInterlacedFrameMode() == 0) quad.ul.y = pen_y + glyph->oy; diff --git a/src/gsm.c b/src/gsm.c index edf598ce3..464482adc 100644 --- a/src/gsm.c +++ b/src/gsm.c @@ -30,7 +30,7 @@ void InitGSMConfig(config_set_t *configSet) { config_set_t *configGame = configGetByType(CONFIG_GAME); - //Default values. + // Default values. gGSMSource = 0; gEnableGSM = 0; gGSMVMode = 0; @@ -39,7 +39,7 @@ void InitGSMConfig(config_set_t *configSet) gGSMFIELDFix = 0; if (configGetInt(configSet, CONFIG_ITEM_GSMSOURCE, &gGSMSource)) { - //Load the rest of the per-game GSM configuration, only if GSM is enabled. + // Load the rest of the per-game GSM configuration, only if GSM is enabled. if (configGetInt(configSet, CONFIG_ITEM_ENABLEGSM, &gEnableGSM) && gEnableGSM) { configGetInt(configSet, CONFIG_ITEM_GSMVMODE, &gGSMVMode); configGetInt(configSet, CONFIG_ITEM_GSMXOFFSET, &gGSMXOffset); @@ -106,21 +106,21 @@ void PrepareGSM(char *cmdline) char romver[16], romverNum[5], *pROMDate; #ifdef _DTL_T10000 - if (predef_vmode[gGSMVMode].mode == GS_MODE_DTV_576P) //There is no 576P code implemented for development TOOLs. - gGSMVMode = 2; //Change to PAL instead. + if (predef_vmode[gGSMVMode].mode == GS_MODE_DTV_576P) // There is no 576P code implemented for development TOOLs. + gGSMVMode = 2; // Change to PAL instead. #endif k576p_fix = 0; kGsDxDyOffsetSupported = 0; if ((fd = open("rom0:ROMVER", O_RDONLY)) >= 0) { - //Read ROM version + // Read ROM version read(fd, romver, sizeof(romver)); close(fd); strncpy(romverNum, romver, 4); romverNum[4] = '\0'; - //ROMVER string format: VVVVRTYYYYMMDD\n + // ROMVER string format: VVVVRTYYYYMMDD\n pROMDate = &romver[strlen(romver) - 9]; /* Enable 576P add-on code for v2.00 and earlier. Note that the earlier PSX models already seem to support the 576P mode, despite being older than the SCPH-70000 series. @@ -132,7 +132,7 @@ void PrepareGSM(char *cmdline) Note that there are also PSX sets with v2.10, hence this check should only include v2.00 and earlier. */ k576p_fix = (strtoul(romverNum, NULL, 10) < 210); - //Record if the _GetGsDxDyOffset syscall is supported. + // Record if the _GetGsDxDyOffset syscall is supported. kGsDxDyOffsetSupported = (strtoul(pROMDate, NULL, 10) > 20010608); } diff --git a/src/gui.c b/src/gui.c index b4e8f900f..00e453fd0 100644 --- a/src/gui.c +++ b/src/gui.c @@ -214,7 +214,7 @@ void guiShowAbout() #ifdef PADEMU " - PADEMU" #endif - //Version numbers + // Version numbers , GSM_VERSION #ifdef IGS @@ -314,19 +314,19 @@ static void guiShowNetCompatUpdateResult(int result) { switch (result) { case OPL_COMPAT_UPDATE_STAT_DONE: - //Completed with no errors. + // Completed with no errors. guiMsgBox(_l(_STR_NET_UPDATE_DONE), 0, NULL); break; case OPL_COMPAT_UPDATE_STAT_ERROR: - //Completed with errors. + // Completed with errors. guiMsgBox(_l(_STR_NET_UPDATE_FAILED), 0, NULL); break; case OPL_COMPAT_UPDATE_STAT_CONN_ERROR: - //Completed with errors. + // Completed with errors. guiMsgBox(_l(_STR_NET_UPDATE_CONN_FAILED), 0, NULL); break; case OPL_COMPAT_UPDATE_STAT_ABORTED: - //User-aborted. + // User-aborted. guiMsgBox(_l(_STR_NET_UPDATE_CANCELLED), 0, NULL); break; } @@ -373,13 +373,13 @@ void guiShowNetCompatUpdate(void) } } break; - case UIID_BTN_CANCEL: //If the user pressed the cancel button. + case UIID_BTN_CANCEL: // If the user pressed the cancel button. case NETUPD_BTN_CANCEL: if (started) { if (guiMsgBox(_l(_STR_CONFIRMATION_CANCEL_UPDATE), 1, NULL)) { guiRenderTextScreen(_l(_STR_PLEASE_WAIT)); oplAbortUpdateGameCompat(); - //The process truly ends when the UI callback gets the update from the worker thread that the process has ended. + // The process truly ends when the UI callback gets the update from the worker thread that the process has ended. } } else { done = 1; @@ -482,7 +482,7 @@ void guiShowConfig() diaGetString(diaConfig, CFG_ETHPREFIX, gETHPrefix, sizeof(gETHPrefix)); diaGetInt(diaConfig, CFG_LASTPLAYED, &gRememberLastPlayed); diaGetInt(diaConfig, CFG_AUTOSTARTLAST, &gAutoStartLastPlayed); - DisableCron = 1; //Disable Auto Start Last Played counter (we don't want to call it right after enable it on GUI) + DisableCron = 1; // Disable Auto Start Last Played counter (we don't want to call it right after enable it on GUI) if (diaGetInt(diaConfig, CFG_SELECTBUTTON, &value)) gSelectButton = value == 0 ? KEY_CIRCLE : KEY_CROSS; else @@ -509,7 +509,7 @@ static int guiUIUpdater(int modified) if (temp != curTheme) { curTheme = temp; if (temp == 0) { - //Display the default theme's colours. + // Display the default theme's colours. diaSetItemType(diaUIConfig, UICFG_BGCOL, UI_COLOUR); // Must be correctly set before doing the diaS/GetColor !! diaSetItemType(diaUIConfig, UICFG_UICOL, UI_COLOUR); diaSetItemType(diaUIConfig, UICFG_TXTCOL, UI_COLOUR); @@ -519,7 +519,7 @@ static int guiUIUpdater(int modified) diaSetColor(diaUIConfig, UICFG_TXTCOL, gDefaultTextColor); diaSetColor(diaUIConfig, UICFG_SELCOL, gDefaultSelTextColor); } else if (temp == thmGetGuiValue()) { - //Display the current theme's colours. + // Display the current theme's colours. diaSetItemType(diaUIConfig, UICFG_BGCOL, UI_COLOUR); diaSetItemType(diaUIConfig, UICFG_UICOL, UI_COLOUR); diaSetItemType(diaUIConfig, UICFG_TXTCOL, UI_COLOUR); @@ -529,14 +529,14 @@ static int guiUIUpdater(int modified) diaSetU64Color(diaUIConfig, UICFG_TXTCOL, gTheme->textColor); diaSetU64Color(diaUIConfig, UICFG_SELCOL, gTheme->selTextColor); } else { - //When another theme is highlighted in the list, its colours are not known. Don't show any colours. + // When another theme is highlighted in the list, its colours are not known. Don't show any colours. diaSetItemType(diaUIConfig, UICFG_BGCOL, UI_SPACER); diaSetItemType(diaUIConfig, UICFG_UICOL, UI_SPACER); diaSetItemType(diaUIConfig, UICFG_TXTCOL, UI_SPACER); diaSetItemType(diaUIConfig, UICFG_SELCOL, UI_SPACER); } - //The user cannot adjust the current theme's colours. + // The user cannot adjust the current theme's colours. temp = !temp; diaSetEnabled(diaUIConfig, UICFG_BGCOL, temp); diaSetEnabled(diaUIConfig, UICFG_UICOL, temp); @@ -645,7 +645,7 @@ void guiShowUIConfig(void) if (previousVMode != gVMode) { if (guiConfirmVideoMode() == 0) { - //Restore previous video mode, without changing the theme & language settings. + // Restore previous video mode, without changing the theme & language settings. gVMode = previousVMode; applyConfig(themeID, langID); goto reselect_video_mode; @@ -727,7 +727,7 @@ void guiShowNetConfig(void) diaSetString(diaNetConfig, NETCFG_SHARE_PASSWORD, gPCPassword); diaSetInt(diaNetConfig, NETCFG_ETHOPMODE, gETHOpMode); - //Update the spacer item between the OK and reconnect buttons (See dialogs.c). + // Update the spacer item between the OK and reconnect buttons (See dialogs.c). if (gNetworkStartup == 0) { diaSetLabel(diaNetConfig, NETCFG_OK, _l(_STR_OK)); diaSetVisible(diaNetConfig, NETCFG_RECONNECT, 1); @@ -774,7 +774,7 @@ void guiShowParentalLockConfig(void) config_set_t *configOPL = configGetByType(CONFIG_OPL); // Set current values - configGetStrCopy(configOPL, CONFIG_OPL_PARENTAL_LOCK_PWD, password, CONFIG_KEY_VALUE_LEN); //This will return the current password, or a blank string if it is not set. + configGetStrCopy(configOPL, CONFIG_OPL_PARENTAL_LOCK_PWD, password, CONFIG_KEY_VALUE_LEN); // This will return the current password, or a blank string if it is not set. diaSetString(diaParentalLockConfig, CFG_PARENLOCK_PASSWORD, password); result = diaExecuteDialog(diaParentalLockConfig, -1, 1, NULL); @@ -895,7 +895,7 @@ static void guiHandleOp(struct gui_update_t *item) // Last Played Auto Start if ((gAutoStartLastPlayed) && !(KeyPressedOnce)) - DisableCron = 0; //Release Auto Start Last Played counter + DisableCron = 0; // Release Auto Start Last Played counter } break; @@ -954,7 +954,7 @@ static void guiHandleDeferredOps(void) void guiExecDeferredOps(void) { - //Clears deferred operations list by executing them. + // Clears deferred operations list by executing them. guiHandleDeferredOps(); } @@ -996,23 +996,23 @@ static void VU0MixVec(VU_VECTOR *a, VU_VECTOR *b, float mix, VU_VECTOR *res) { asm volatile( #if __GNUC__ > 3 - "lqc2 $vf1, (%[a])\n" // load the first vector - "lqc2 $vf2, (%[b])\n" // load the second vector - "qmtc2 %[mix], $vf3\n" // move the mix value from reg to VU - "vaddw.x $vf5, $vf0, $vf0\n" // vf5.x = 1 - "vsub.x $vf4x, $vf5x, $vf3x\n" // subtract 1 - vf3,x, store the result in vf4.x - "vmulax.xyzw $ACC, $vf1, $vf3x\n" // multiply vf1 by vf3.x, store the result in ACC - "vmaddx.xyzw $vf1, $vf2, $vf4x\n" // multiply vf2 by vf4.x add ACC, store the result in vf1 - "sqc2 $vf1, (%[res])\n" // transfer the result in acc to the ee + "lqc2 $vf1, (%[a])\n" // load the first vector + "lqc2 $vf2, (%[b])\n" // load the second vector + "qmtc2 %[mix], $vf3\n" // move the mix value from reg to VU + "vaddw.x $vf5, $vf0, $vf0\n" // vf5.x = 1 + "vsub.x $vf4x, $vf5x, $vf3x\n" // subtract 1 - vf3,x, store the result in vf4.x + "vmulax.xyzw $ACC, $vf1, $vf3x\n" // multiply vf1 by vf3.x, store the result in ACC + "vmaddx.xyzw $vf1, $vf2, $vf4x\n" // multiply vf2 by vf4.x add ACC, store the result in vf1 + "sqc2 $vf1, (%[res])\n" // transfer the result in acc to the ee #else - "lqc2 vf1, (%[a])\n" // load the first vector - "lqc2 vf2, (%[b])\n" // load the second vector - "qmtc2 %[mix], vf3\n" // move the mix value from reg to VU - "vaddw.x vf5, vf00, vf00\n" // vf5.x = 1 - "vsub.x vf4x, vf5x, vf3x\n" // subtract 1 - vf3,x, store the result in vf4.x - "vmulax.xyzw ACC, vf1, vf3x\n" // multiply vf1 by vf3.x, store the result in ACC - "vmaddx.xyzw vf1, vf2, vf4x\n" // multiply vf2 by vf4.x add ACC, store the result in vf1 - "sqc2 vf1, (%[res])\n" // transfer the result in acc to the ee + "lqc2 vf1, (%[a])\n" // load the first vector + "lqc2 vf2, (%[b])\n" // load the second vector + "qmtc2 %[mix], vf3\n" // move the mix value from reg to VU + "vaddw.x vf5, vf00, vf00\n" // vf5.x = 1 + "vsub.x vf4x, vf5x, vf3x\n" // subtract 1 - vf3,x, store the result in vf4.x + "vmulax.xyzw ACC, vf1, vf3x\n" // multiply vf1 by vf3.x, store the result in ACC + "vmaddx.xyzw vf1, vf2, vf4x\n" // multiply vf2 by vf4.x add ACC, store the result in vf1 + "sqc2 vf1, (%[res])\n" // transfer the result in acc to the ee #endif : [res] "+r"(res), "=m"(*res) : [a] "r"(a), [b] "r"(b), [mix] "r"(mix), "m"(*a), "m"(*b)); @@ -1076,7 +1076,7 @@ static float guiCalcPerlin(float x, float y, float z) vec.x -= 1; - //float n110 + // float n110 b.z = Vu0DotProduct(&pgrad3[gi110], &vec); vec.y += 1; @@ -1334,8 +1334,8 @@ static void guiDrawOverlays() } // BLURT output - // if (!gDisableDebug) - // fntRenderString(gTheme->fonts[0], 0, screenHeight - 24, ALIGN_NONE, 0, 0, blurttext, GS_SETREG_RGBA(255, 255, 0, 128)); + // if (!gDisableDebug) + // fntRenderString(gTheme->fonts[0], 0, screenHeight - 24, ALIGN_NONE, 0, 0, blurttext, GS_SETREG_RGBA(255, 255, 0, 128)); } static void guiReadPads() @@ -1616,7 +1616,7 @@ int guiConfirmVideoMode(void) else if (getKeyOn(gSelectButton)) terminate = 2; - //If the user fails to respond within the timeout period, deem it as a cancel operation. + // If the user fails to respond within the timeout period, deem it as a cancel operation. if (clock() > timeEnd) terminate = 1; diff --git a/src/guigame.c b/src/guigame.c index 4f78becee..cbf3833bf 100644 --- a/src/guigame.c +++ b/src/guigame.c @@ -75,7 +75,7 @@ char *gameConfigSource(void) return source; } -//VMC +// VMC typedef struct { // size = 76 int VMC_status; // 0=available, 1=busy @@ -306,7 +306,7 @@ void guiGameShowVMCMenu(int id, item_list_t *support) guiGameShowVMCConfig(id, support, vmc2, 1, 1); } -//GSM +// GSM static void guiGameSetGSMSettingsState(void) { int previousSource = gGSMSource; @@ -389,7 +389,7 @@ void guiGameShowGSConfig(void) diaExecuteDialog(diaGSConfig, -1, 1, &guiGameGSMUpdater); } -//CHEATS +// CHEATS static void guiGameSetCheatSettingsState(void) { int previousSource = gCheatSource; @@ -434,9 +434,9 @@ void guiGameShowCheatConfig(void) diaExecuteDialog(diaCheatConfig, -1, 1, &guiGameCheatUpdater); } -//PADEMU +// PADEMU #ifdef PADEMU -//from https://www.bluetooth.com/specifications/assigned-numbers/host-controller-interface +// from https://www.bluetooth.com/specifications/assigned-numbers/host-controller-interface static char *bt_ver_str[] = { "1.0b", "1.1", diff --git a/src/hdd.c b/src/hdd.c index bac9fa552..51595460f 100644 --- a/src/hdd.c +++ b/src/hdd.c @@ -39,7 +39,7 @@ int hddCheck(void) ret = fileXioDevctl("hdd0:", HDIOC_STATUS, NULL, 0, NULL, 0); - //0 = HDD connected and formatted, 1 = not formatted, 2 = HDD not usable, 3 = HDD not connected. + // 0 = HDD connected and formatted, 1 = not formatted, 2 = HDD not usable, 3 = HDD not connected. if ((ret >= 3) || (ret < 0)) return -1; @@ -113,11 +113,11 @@ int hddReadSectors(u32 lba, u32 nsectors, void *buf) //------------------------------------------------------------------------- static int hddWriteSectors(u32 lba, u32 nsectors, const void *buf) { - static u8 WriteBuffer[2 * 512 + sizeof(hddAtaTransfer_t)] ALIGNED(64); //Has to be a different buffer from IOBuffer (input can be in IOBuffer). + static u8 WriteBuffer[2 * 512 + sizeof(hddAtaTransfer_t)] ALIGNED(64); // Has to be a different buffer from IOBuffer (input can be in IOBuffer). int argsz; hddAtaTransfer_t *args = (hddAtaTransfer_t *)WriteBuffer; - if (nsectors > 2) //Sanity check + if (nsectors > 2) // Sanity check return -ENOMEM; args->lba = lba; @@ -160,7 +160,7 @@ static int hddGetHDLGameInfo(struct GameDataEntry *game, hdl_game_info_t *ginfo) ginfo->layer_break = hdl_header->layer1_start; ginfo->disctype = (u8)hdl_header->discType; ginfo->start_sector = game->lba; - ginfo->total_size_in_kb = game->size * 2; //size * 2048 / 1024 = 2x + ginfo->total_size_in_kb = game->size * 2; // size * 2048 / 1024 = 2x } else ret = -1; @@ -219,7 +219,7 @@ int hddGetHDLGamelist(hdl_games_list_t *game_list) pGameEntry->lba = dirent.stat.private_5 + (HDL_GAME_DATA_OFFSET + 4096) / 512; } - pGameEntry->size += (dirent.stat.size / 4); //size in HDD sectors * (512 / 2048) = 0.25x + pGameEntry->size += (dirent.stat.size / 4); // size in HDD sectors * (512 / 2048) = 0.25x } } @@ -277,7 +277,7 @@ int hddSetHDLGameInfo(hdl_game_info_t *ginfo) // just change game name and compat flags !!! strncpy(hdl_header->gamename, ginfo->name, sizeof(hdl_header->gamename)); hdl_header->gamename[sizeof(hdl_header->gamename) - 1] = '\0'; - //hdl_header->hdl_compat_flags = ginfo->hdl_compat_flags; + // hdl_header->hdl_compat_flags = ginfo->hdl_compat_flags; hdl_header->ops2l_compat_flags = ginfo->ops2l_compat_flags; hdl_header->dma_type = ginfo->dma_type; hdl_header->dma_mode = ginfo->dma_mode; diff --git a/src/hddsupport.c b/src/hddsupport.c index 5924e9780..0ff87f7c4 100644 --- a/src/hddsupport.c +++ b/src/hddsupport.c @@ -89,7 +89,7 @@ static int hddCheckHDProKit(void) return ret; } -//Taken from libhdd: +// Taken from libhdd: #define PFS_ZONE_SIZE 8192 #define PFS_FRAGMENT 0x00000000 @@ -186,7 +186,7 @@ void hddLoadModules(void) if (!hddModulesLoaded) { hddModulesLoaded = 1; - //DEV9 must be loaded, as HDD.IRX depends on it. Even if not required by the I/F (i.e. HDPro) + // DEV9 must be loaded, as HDD.IRX depends on it. Even if not required by the I/F (i.e. HDPro) sysInitDev9(); // try to detect HD Pro Kit (not the connected HDD), @@ -212,7 +212,7 @@ void hddLoadModules(void) return; } - //Check if a HDD unit is connected + // Check if a HDD unit is connected if (hddCheck() < 0) { LOG("HDD: No HardDisk Drive detected.\n"); setErrorMessageWithCode(_STR_HDD_NOT_CONNECTED_ERROR, ERROR_HDD_NOT_DETECTED); @@ -232,7 +232,7 @@ void hddLoadModules(void) ret = fileXioMount(hddPrefix, gOPLPart, FIO_MT_RDWR); if (ret == -ENOENT) { - //Attempt to create the partition. + // Attempt to create the partition. if ((hddCreateOPLPartition(gOPLPart)) >= 0) fileXioMount(hddPrefix, gOPLPart, FIO_MT_RDWR); } @@ -247,7 +247,7 @@ void hddLoadModules(void) void hddInit(void) { LOG("HDDSUPPORT Init\n"); - hddForceUpdate = 0; //Use cache at initial startup. + hddForceUpdate = 0; // Use cache at initial startup. configGetInt(configGetByType(CONFIG_OPL), "hdd_frames_delay", &hddGameList.delay); ioPutRequest(IO_CUSTOM_SIMPLEACTION, &hddInitModules); hddGameList.enabled = 1; @@ -282,7 +282,7 @@ static int hddUpdateGameList(void) } } - hddForceUpdate = 1; //Subsequent refresh operations will cause the HDD to be scanned. + hddForceUpdate = 1; // Subsequent refresh operations will cause the HDD to be scanned. return (ret == 0 ? hddGames.count : 0); } @@ -396,7 +396,7 @@ static void hddLaunchGame(int id, config_set_t *configSet) if (have_error) { char error[256]; - if (have_error == 2) //VMC file is fragmented + if (have_error == 2) // VMC file is fragmented snprintf(error, sizeof(error), _l(_STR_ERR_VMC_FRAGMENTED_CONTINUE), vmc_name[vmc_id], (vmc_id + 1)); else snprintf(error, sizeof(error), _l(_STR_ERR_VMC_CONTINUE), vmc_name[vmc_id], (vmc_id + 1)); @@ -483,7 +483,7 @@ static config_set_t *hddGetConfig(int id) snprintf(path, sizeof(path), "%sCFG/%s.cfg", gHDDPrefix, game->startup); config_set_t *config = configAlloc(0, NULL, path); - configRead(config); //Does not matter if the config file exists or not. + configRead(config); // Does not matter if the config file exists or not. configSetStr(config, CONFIG_ITEM_NAME, game->name); configSetInt(config, CONFIG_ITEM_SIZE, game->total_size_in_kb >> 10); @@ -504,7 +504,7 @@ static int hddGetImage(char *folder, int isRelative, char *value, char *suffix, return texDiscoverLoad(resultTex, path, -1, psm); } -//This may be called, even if hddInit() was not. +// This may be called, even if hddInit() was not. static void hddCleanUp(int exception) { LOG("HDDSUPPORT CleanUp\n"); @@ -516,7 +516,7 @@ static void hddCleanUp(int exception) fileXioUmount(hddPrefix); } - //UI may have loaded modules outside of HDD mode, so deinitialize regardless of the enabled status. + // UI may have loaded modules outside of HDD mode, so deinitialize regardless of the enabled status. if (hddModulesLoaded) { fileXioDevctl("pfs:", PDIOC_CLOSEALL, NULL, 0, NULL, 0); @@ -529,7 +529,7 @@ static int hddCheckVMC(char *name, int createSize) return sysCheckVMC(gHDDPrefix, "/", name, createSize, NULL); } -//This may be called, even if hddInit() was not. +// This may be called, even if hddInit() was not. static void hddShutdown(void) { LOG("HDDSUPPORT Shutdown\n"); @@ -539,16 +539,16 @@ static void hddShutdown(void) fileXioUmount(hddPrefix); } - //UI may have loaded modules outside of HDD mode, so deinitialize regardless of the enabled status. + // UI may have loaded modules outside of HDD mode, so deinitialize regardless of the enabled status. if (hddModulesLoaded) { /* Close all files */ fileXioDevctl("pfs:", PDIOC_CLOSEALL, NULL, 0, NULL, 0); - //DEV9 will remain active if ETH is in use, so put the HDD in IDLE state. - //The HDD should still enter standby state after 21 minutes & 15 seconds, as per the ATAD defaults. + // DEV9 will remain active if ETH is in use, so put the HDD in IDLE state. + // The HDD should still enter standby state after 21 minutes & 15 seconds, as per the ATAD defaults. hddSetIdleImmediate(); - //Only shut down dev9 from here, if it was initialized from here before. + // Only shut down dev9 from here, if it was initialized from here before. sysShutdownDev9(); hddModulesLoaded = 0; @@ -593,7 +593,7 @@ static int hddLoadGameListCache(hdl_games_list_t *cache) result = ENOMEM; } } else { - result = -1; //Empty file + result = -1; // Empty file } fclose(file); @@ -650,7 +650,7 @@ static int hddUpdateGameListCache(hdl_games_list_t *cache, hdl_games_list_t *gam result = EIO; } } else { - //Last game deleted. + // Last game deleted. remove(filename); result = 0; } diff --git a/src/ioprp.c b/src/ioprp.c index b84929cba..e89f5c6b9 100644 --- a/src/ioprp.c +++ b/src/ioprp.c @@ -27,7 +27,7 @@ static inline void patch_EESYNC(void *image_offset, struct romdir_entry *entryin static inline void Align_offsets(void *base_address, unsigned int *offset_in, struct romdir_entry *romdir_in, unsigned int *offset_out, struct romdir_entry *romdir_out); /*---------------------------------------------------------------------------------------- - Replace modules in a IOPRP image. + Replace modules in a IOPRP image. ------------------------------------------------------------------------------------------*/ unsigned int patch_IOPRP_image(void *ioprp_image, void *cdvdman_module, unsigned int size_cdvdman) { @@ -67,7 +67,7 @@ unsigned int patch_IOPRP_image(void *ioprp_image, void *cdvdman_module, unsigned } /*---------------------------------------------------------------------------------------- - Patch CDVDMAN in an IOPRP image + Patch CDVDMAN in an IOPRP image ------------------------------------------------------------------------------------------*/ static inline void patch_CDVDMAN(void *image_offset, struct romdir_entry *entryinfo, void *cdvdman, unsigned int size) { @@ -76,7 +76,7 @@ static inline void patch_CDVDMAN(void *image_offset, struct romdir_entry *entryi } /*---------------------------------------------------------------------------------------- - Patch CDVDFSV in an IOPRP image + Patch CDVDFSV in an IOPRP image ------------------------------------------------------------------------------------------*/ static inline void patch_CDVDFSV(void *image_offset, struct romdir_entry *entryinfo) { @@ -85,7 +85,7 @@ static inline void patch_CDVDFSV(void *image_offset, struct romdir_entry *entryi } /*---------------------------------------------------------------------------------------- - Patch EESYNC in an IOPRP image + Patch EESYNC in an IOPRP image ------------------------------------------------------------------------------------------*/ static inline void patch_EESYNC(void *image_offset, struct romdir_entry *entryinfo) { @@ -94,7 +94,7 @@ static inline void patch_EESYNC(void *image_offset, struct romdir_entry *entryin } /*---------------------------------------------------------------------------------------- - Align offsets to multiples of 16, filling the gaps created with 0s. + Align offsets to multiples of 16, filling the gaps created with 0s. ------------------------------------------------------------------------------------------*/ static inline void Align_offsets(void *base_address, unsigned int *offset_in, struct romdir_entry *romdir_in, unsigned int *offset_out, struct romdir_entry *romdir_out) { diff --git a/src/lang.c b/src/lang.c index c275dfdf2..b5834ff23 100644 --- a/src/lang.c +++ b/src/lang.c @@ -368,7 +368,7 @@ static int lngLoadFromFile(char *path, char *name) // remember how many entries were read from the file (for the free later) nValidEntries = newEntries; - int len = strlen(path) - strlen(name) - 9; //-4 for extension, -5 for prefix + int len = strlen(path) - strlen(name) - 9; // -4 for extension, -5 for prefix memcpy(dir, path, len); dir[len] = '\0'; diff --git a/src/menusys.c b/src/menusys.c index 1048e01a7..0a8a5d38c 100644 --- a/src/menusys.c +++ b/src/menusys.c @@ -628,7 +628,7 @@ static void menuNextV() cur = cur->next; selected_item->item->pagestart = selected_item->item->current; - } else { //wrap to start + } else { // wrap to start menuFirstPage(); } } @@ -647,7 +647,7 @@ static void menuPrevV() while (--itms && selected_item->item->pagestart->prev) selected_item->item->pagestart = selected_item->item->pagestart->prev; } - } else { //wrap to end + } else { // wrap to end menuLastPage(); } } @@ -665,7 +665,7 @@ static void menuNextPage() selected_item->item->current = cur; selected_item->item->pagestart = selected_item->item->current; - } else { //wrap to start + } else { // wrap to start menuFirstPage(); } } @@ -683,7 +683,7 @@ static void menuPrevPage() selected_item->item->current = cur; selected_item->item->pagestart = selected_item->item->current; - } else { //wrap to end + } else { // wrap to end menuLastPage(); } } @@ -739,7 +739,7 @@ void menuRenderMenu() } } - //hints + // hints guiDrawSubMenuHints(); } @@ -759,17 +759,17 @@ int menuCheckParentalLock(void) char password[CONFIG_KEY_VALUE_LEN]; int result; - result = 0; //Default to unlocked. + result = 0; // Default to unlocked. if (parentalLockCheckEnabled) { config_set_t *configOPL = configGetByType(CONFIG_OPL); - //Prompt for password, only if one was set. + // Prompt for password, only if one was set. if (configGetStr(configOPL, CONFIG_OPL_PARENTAL_LOCK_PWD, &parentalLockPassword) && (parentalLockPassword[0] != '\0')) { password[0] = '\0'; if (diaShowKeyb(password, CONFIG_KEY_VALUE_LEN, 1, _l(_STR_PARENLOCK_ENTER_PASSWORD_TITLE))) { if (strncmp(parentalLockPassword, password, CONFIG_KEY_VALUE_LEN) == 0) { result = 0; - parentalLockCheckEnabled = 0; //Stop asking for the password. + parentalLockCheckEnabled = 0; // Stop asking for the password. } else if (strncmp(OPL_PARENTAL_LOCK_MASTER_PASS, password, CONFIG_KEY_VALUE_LEN) == 0) { guiMsgBox(_l(_STR_PARENLOCK_DISABLE_WARNING), 0, NULL); @@ -777,12 +777,12 @@ int menuCheckParentalLock(void) saveConfig(CONFIG_OPL, 1); result = 0; - parentalLockCheckEnabled = 0; //Stop asking for the password. + parentalLockCheckEnabled = 0; // Stop asking for the password. } else { guiMsgBox(_l(_STR_PARENLOCK_PASSWORD_INCORRECT), 0, NULL); result = EACCES; } - } else //User aborted. + } else // User aborted. result = EACCES; } } @@ -847,7 +847,7 @@ void menuHandleInputMenu() } else if (id == MENU_SAVE_CHANGES) { if (menuCheckParentalLock() == 0) { saveConfig(CONFIG_OPL | CONFIG_NETWORK, 1); - menuSetParentalLockCheckState(1); //Re-enable parental lock check. + menuSetParentalLockCheckState(1); // Re-enable parental lock check. } } else if (id == MENU_EXIT) { if (guiMsgBox(_l(_STR_CONFIRMATION_EXIT), 1, NULL)) @@ -862,7 +862,7 @@ void menuHandleInputMenu() } if (getKeyOn(KEY_START) || getKeyOn(gSelectButton == KEY_CIRCLE ? KEY_CROSS : KEY_CIRCLE)) { - //Check if there is anything to show the user, at all. + // Check if there is anything to show the user, at all. if (gAPPStartMode || gETHStartMode || gBDMStartMode || gHDDStartMode) guiSwitchScreen(GUI_SCREEN_MAIN); } @@ -920,7 +920,7 @@ void menuHandleInputMain() // Last Played Auto Start if (RemainSecs < 0) { - DisableCron = 1; //Disable Counter + DisableCron = 1; // Disable Counter if (gSelectButton == KEY_CIRCLE) selected_item->item->execCircle(selected_item->item); else @@ -1017,7 +1017,7 @@ void menuRenderGameMenu() #endif } - //hints + // hints guiDrawSubMenuHints(); } @@ -1121,7 +1121,7 @@ void menuRenderAppMenu() y += spacing; } - //hints + // hints guiDrawSubMenuHints(); } diff --git a/src/opl.c b/src/opl.c index 4eadfd81c..f71eb2fad 100644 --- a/src/opl.c +++ b/src/opl.c @@ -81,10 +81,10 @@ typedef struct submenu_list_t *subMenu; } opl_io_module_t; -//App support stuff. +// App support stuff. static unsigned char shouldAppsUpdate; -//Network support stuff. +// Network support stuff. #define HTTP_IOBUF_SIZE 512 static unsigned int CompatUpdateComplete, CompatUpdateTotal; static unsigned char CompatUpdateStopFlag, CompatUpdateFlags; @@ -131,7 +131,7 @@ int ps2_ip[4]; int ps2_netmask[4]; int ps2_gateway[4]; int ps2_dns[4]; -int gETHOpMode; //See ETH_OP_MODES. +int gETHOpMode; // See ETH_OP_MODES. int gPCShareAddressIsNetBIOS; int pc_ip[4]; int gPCPort; @@ -387,7 +387,7 @@ static void deinitAllSupport(int exception, int modeSelected) moduleCleanup(&list_support[APP_MODE], exception, modeSelected); } -//For resolving the mode, given an app's path +// For resolving the mode, given an app's path int oplPath2Mode(const char *path) { char appsPath[64]; @@ -404,7 +404,7 @@ int oplPath2Mode(const char *path) blkdevnamelen = (int)(blkdevnameend - appsPath); while ((blkdevnamelen > 0) && isdigit((int)appsPath[blkdevnamelen - 1])) - blkdevnamelen--; //Ignore the unit number. + blkdevnamelen--; // Ignore the unit number. if (strncmp(path, appsPath, blkdevnamelen) == 0) return listSupport->mode; @@ -492,7 +492,7 @@ int oplScanApps(int (*callback)(const char *path, config_set_t *appConfig, void if (ret == 0) count++; - else if (ret < 0) { //Stopped because of unrecoverable error. + else if (ret < 0) { // Stopped because of unrecoverable error. break; } } @@ -613,7 +613,7 @@ static void updateMenuFromGameList(opl_io_module_t *mdl) gup->submenu.selected = 0; if (gRememberLastPlayed && temp && strcmp(temp, mdl->support->itemGetStartup(i)) == 0) { - gup->submenu.selected = 1; //Select Last Played Game + gup->submenu.selected = 1; // Select Last Played Game } guiDeferUpdate(gup); @@ -640,7 +640,7 @@ void menuDeferredUpdate(void *data) if (mod->support->itemNeedsUpdate()) { updateMenuFromGameList(mod); - //If other modes have been updated, then the apps list should be updated too. + // If other modes have been updated, then the apps list should be updated too. if (*mode != APP_MODE) shouldAppsUpdate = 1; } @@ -744,7 +744,7 @@ static int checkLoadConfigHDD(int types) return 0; } -//When this function is called, the current device for loading/saving config is the memory card. +// When this function is called, the current device for loading/saving config is the memory card. static int tryAlternateDevice(int types) { char pwd[8]; @@ -753,7 +753,7 @@ static int tryAlternateDevice(int types) getcwd(pwd, sizeof(pwd)); - //First, try the device that OPL booted from. + // First, try the device that OPL booted from. if (!strncmp(pwd, "mass", 4) && (pwd[4] == ':' || pwd[5] == ':')) { if ((value = checkLoadConfigBDM(types)) != 0) return value; @@ -762,8 +762,8 @@ static int tryAlternateDevice(int types) return value; } - //Config was not found on the boot device. Check all supported devices. - // Check USB device + // Config was not found on the boot device. Check all supported devices. + // Check USB device if ((value = checkLoadConfigBDM(types)) != 0) return value; // Check HDD @@ -916,7 +916,7 @@ static int trySaveConfigBDM(int types) static int trySaveConfigHDD(int types) { hddLoadModules(); - //Check that the formatted & usable HDD is connected. + // Check that the formatted & usable HDD is connected. if (hddCheck() == 0) { configSetMove(gHDDPrefix); return configWriteMulti(types); @@ -938,7 +938,7 @@ static int trySaveAlternateDevice(int types) getcwd(pwd, sizeof(pwd)); - //First, try the device that OPL booted from. + // First, try the device that OPL booted from. if (!strncmp(pwd, "mass", 4) && (pwd[4] == ':' || pwd[5] == ':')) { if ((value = trySaveConfigBDM(types)) > 0) return value; @@ -947,8 +947,8 @@ static int trySaveAlternateDevice(int types) return value; } - //Config was not saved to the boot device. Try all supported devices. - //Try memory cards + // Config was not saved to the boot device. Try all supported devices. + // Try memory cards if (sysCheckMC() >= 0) { if ((value = trySaveConfigMC(types)) > 0) return value; @@ -960,7 +960,7 @@ static int trySaveAlternateDevice(int types) if ((value = trySaveConfigHDD(types)) > 0) return value; - //We tried everything, but... + // We tried everything, but... return 0; } @@ -1112,11 +1112,11 @@ int saveConfig(int types, int showUI) return lscret; } -#define COMPAT_UPD_MODE_UPD_USR 1 //Update all records, even those that were modified by the user. -#define COMPAT_UPD_MODE_NO_MTIME 2 //Do not check the modified time-stamp. -#define COMPAT_UPD_MODE_MTIME_GMT 4 //Modified time-stamp is in GMT, not JST. +#define COMPAT_UPD_MODE_UPD_USR 1 // Update all records, even those that were modified by the user. +#define COMPAT_UPD_MODE_NO_MTIME 2 // Do not check the modified time-stamp. +#define COMPAT_UPD_MODE_MTIME_GMT 4 // Modified time-stamp is in GMT, not JST. -#define EOPLCONNERR 0x4000 //Special error code for connection errors. +#define EOPLCONNERR 0x4000 // Special error code for connection errors. static int CompatAttemptConnection(void) { @@ -1163,7 +1163,7 @@ static void compatUpdate(item_list_t *support, unsigned char mode, config_set_t if (device < 0) { LOG("CompatUpdate: unrecognized mode: %d\n", support->mode); CompatUpdateStatus = OPL_COMPAT_UPDATE_STAT_ERROR; - return; //Shouldn't happen, but what if? + return; // Shouldn't happen, but what if? } result = 0; @@ -1175,7 +1175,7 @@ static void compatUpdate(item_list_t *support, unsigned char mode, config_set_t if (count > 0) { ConnMode = HTTP_CMODE_PERSISTENT; if ((HttpSocket = CompatAttemptConnection()) >= 0) { - //Update compatibility list. + // Update compatibility list. for (i = 0; !CompatUpdateStopFlag && result >= 0 && i < count; i++, CompatUpdateComplete++) { startup = support->itemGetStartup(configSet != NULL ? id : i); @@ -1191,7 +1191,7 @@ static void compatUpdate(item_list_t *support, unsigned char mode, config_set_t if (itemConfig != NULL) { ConfigSource = CONFIG_SOURCE_DEFAULT; if ((mode & COMPAT_UPD_MODE_UPD_USR) || !configGetInt(itemConfig, CONFIG_ITEM_CONFIGSOURCE, &ConfigSource) || ConfigSource != CONFIG_SOURCE_USER) { - if (!(mode & COMPAT_UPD_MODE_NO_MTIME) && (ConfigSource == CONFIG_SOURCE_DLOAD) && configGetStat(itemConfig, &stat)) { //Only perform a stat operation for downloaded setting files. + if (!(mode & COMPAT_UPD_MODE_NO_MTIME) && (ConfigSource == CONFIG_SOURCE_DLOAD) && configGetStat(itemConfig, &stat)) { // Only perform a stat operation for downloaded setting files. if (!(mode & COMPAT_UPD_MODE_MTIME_GMT)) { clock.second = itob(stat.mtime[1]); clock.minute = itob(stat.mtime[2]); @@ -1201,19 +1201,19 @@ static void compatUpdate(item_list_t *support, unsigned char mode, config_set_t clock.year = itob((stat.mtime[6] | ((unsigned short int)stat.mtime[7] << 8)) - 2000); configConvertToGmtTime(&clock); - mtime[0] = btoi(clock.year); //Year - mtime[1] = btoi(clock.month) - 1; //Month - mtime[2] = btoi(clock.day) - 1; //Day - mtime[3] = btoi(clock.hour); //Hour - mtime[4] = btoi(clock.minute); //Minute - mtime[5] = btoi(clock.second); //Second + mtime[0] = btoi(clock.year); // Year + mtime[1] = btoi(clock.month) - 1; // Month + mtime[2] = btoi(clock.day) - 1; // Day + mtime[3] = btoi(clock.hour); // Hour + mtime[4] = btoi(clock.minute); // Minute + mtime[5] = btoi(clock.second); // Second } else { - mtime[0] = (stat.mtime[6] | ((unsigned short int)stat.mtime[7] << 8)) - 2000; //Year - mtime[1] = stat.mtime[5] - 1; //Month - mtime[2] = stat.mtime[4] - 1; //Day - mtime[3] = stat.mtime[3]; //Hour - mtime[4] = stat.mtime[2]; //Minute - mtime[5] = stat.mtime[1]; //Second + mtime[0] = (stat.mtime[6] | ((unsigned short int)stat.mtime[7] << 8)) - 2000; // Year + mtime[1] = stat.mtime[5] - 1; // Month + mtime[2] = stat.mtime[4] - 1; // Day + mtime[3] = stat.mtime[3]; // Hour + mtime[4] = stat.mtime[2]; // Minute + mtime[5] = stat.mtime[1]; // Second } hasMtime = 1; @@ -1247,7 +1247,7 @@ static void compatUpdate(item_list_t *support, unsigned char mode, config_set_t LOG("CompatUpdate: Connection lost. Retrying.\n"); - //Connection lost. Attempt to re-connect. + // Connection lost. Attempt to re-connect. ConnMode = HTTP_CMODE_PERSISTENT; if ((HttpSocket = CompatAttemptConnection()) < 0) { result = HttpSocket | EOPLCONNERR; @@ -1260,10 +1260,10 @@ static void compatUpdate(item_list_t *support, unsigned char mode, config_set_t LOG("CompatUpdate: skipping %s\n", startup); } - if (configSet == NULL) //Do not free what is not ours. + if (configSet == NULL) // Do not free what is not ours. configFree(itemConfig); } else { - //Can't do anything because the config file cannot be opened/created. + // Can't do anything because the config file cannot be opened/created. LOG("CompatUpdate: skipping %s (no config)\n", startup); } @@ -1336,7 +1336,7 @@ void oplUpdateGameCompat(int UpdateAll) } } - if (started < 1) //Nothing done + if (started < 1) // Nothing done CompatUpdateStatus = OPL_COMPAT_UPDATE_STAT_DONE; } @@ -1382,8 +1382,8 @@ static int loadLwnbdSvr(void) // Deinitialize all support without shutting down the HDD unit. deinitAllSupport(NO_EXCEPTION, IO_MODE_SELECTED_ALL); - clearErrorMessage(); /* At this point, an error might have been displayed (since background tasks were completed). - Clear it, otherwise it will get displayed after the server is closed. */ + clearErrorMessage(); /* At this point, an error might have been displayed (since background tasks were completed). + Clear it, otherwise it will get displayed after the server is closed. */ unloadPads(); sysReset(0); @@ -1469,7 +1469,7 @@ static void moduleCleanup(opl_io_module_t *mod, int exception, int modeSelected) if (!mod->support) return; - //Shutdown if not required anymore. + // Shutdown if not required anymore. if ((mod->support->mode != modeSelected) && (modeSelected != IO_MODE_SELECTED_ALL)) { if (mod->support->itemShutdown) mod->support->itemShutdown(); @@ -1575,7 +1575,7 @@ static void setDefaults(void) gEnableWrite = 0; gRememberLastPlayed = 0; gAutoStartLastPlayed = 9; - gSelectButton = KEY_CIRCLE; //Default to Japan. + gSelectButton = KEY_CIRCLE; // Default to Japan. gBDMPrefix[0] = '\0'; gETHPrefix[0] = '\0'; gEnableNotifications = 0; @@ -1604,7 +1604,7 @@ static void setDefaults(void) // Last Played Auto Start KeyPressedOnce = 0; - DisableCron = 1; //Auto Start Last Played counter disabled by default + DisableCron = 1; // Auto Start Last Played counter disabled by default CronStart = 0; RemainSecs = 0; } diff --git a/src/pad.c b/src/pad.c index 1316b5425..8f19fd519 100644 --- a/src/pad.c +++ b/src/pad.c @@ -188,7 +188,7 @@ static int initializePad(struct pad_data_t *pad) } static void updatePadState(struct pad_data_t *pad, int state) -{ //To simplify processing, monitor only Disconnected, FindCTP1 & Stable states. +{ // To simplify processing, monitor only Disconnected, FindCTP1 & Stable states. if ((state == PAD_STATE_DISCONN) || (state == PAD_STATE_STABLE) || (state == PAD_STATE_FINDCTP1)) pad->state = state; } @@ -203,17 +203,17 @@ static int readPad(struct pad_data_t *pad) newState = padGetState(pad->port, pad->slot); updatePadState(pad, newState); if ((oldState == PAD_STATE_DISCONN) && ((pad->state == PAD_STATE_STABLE) || (pad->state == PAD_STATE_FINDCTP1))) { - //Pad just connected. + // Pad just connected. LOG("PAD pad %d,%d connected\n", pad->port, pad->slot); initializePad(pad); } - //The pad may transit from any state to disconnected. So check only for the disconnected state. + // The pad may transit from any state to disconnected. So check only for the disconnected state. else if ((oldState != PAD_STATE_DISCONN) && (pad->state == PAD_STATE_DISCONN)) { LOG("PAD pad %d,%d disconnected\n", pad->port, pad->slot); } if ((pad->state == PAD_STATE_STABLE) || (pad->state == PAD_STATE_FINDCTP1)) { - //pad is connected. Read pad button information. + // pad is connected. Read pad button information. ret = padRead(pad->port, pad->slot, &pad->buttons); // port, slot, buttons if (ret != 0) { @@ -258,10 +258,10 @@ static int readPad(struct pad_data_t *pad) } /** Returns delay (in miliseconds) specified for the given key. -* @param id The button id -* @param repeat Boolean value specifying if we want initial key delay (0) or the repeat key delay (1) -* @return the delay to the next key event -*/ + * @param id The button id + * @param repeat Boolean value specifying if we want initial key delay (0) or the repeat key delay (1) + * @return the delay to the next key event + */ static int getKeyDelay(int id, int repeat) { int delay = paddelay[id - 1]; @@ -302,9 +302,9 @@ int readPads() } /** Key getter with key repeats. -* @param id The button ID -* @return nonzero if button is being pressed just now -*/ + * @param id The button ID + * @return nonzero if button is being pressed just now + */ int getKey(int id) { if ((id <= 0) || (id >= 17)) @@ -335,9 +335,9 @@ int getKey(int id) } /** Detects key-on event. Returns true if the button was not pressed the last frame but is pressed this frame. -* @param id The button ID -* @return nonzero if button is being pressed just now -*/ + * @param id The button ID + * @return nonzero if button is being pressed just now + */ int getKeyOn(int id) { if ((id <= 0) || (id >= 17)) @@ -350,9 +350,9 @@ int getKeyOn(int id) } /** Detects key-off event. Returns true if the button was pressed the last frame but is not pressed this frame. -* @param id The button ID -* @return nonzero if button is being released -*/ + * @param id The button ID + * @return nonzero if button is being released + */ int getKeyOff(int id) { if ((id <= 0) || (id >= 17)) @@ -365,9 +365,9 @@ int getKeyOff(int id) } /** Returns true (nonzero) if the button is currently pressed -* @param id The button ID -* @return nonzero if button is being held -*/ + * @param id The button ID + * @return nonzero if button is being held + */ int getKeyPressed(int id) { // old v.s. new pad data @@ -377,9 +377,9 @@ int getKeyPressed(int id) } /** Sets the delay to wait for button repetition event to occur. -* @param button The button ID -* @param btndelay The button delay (in query count) -*/ + * @param button The button ID + * @param btndelay The button delay (in query count) + */ void setButtonDelay(int button, int btndelay) { if ((button <= 0) || (button >= 17)) @@ -397,7 +397,7 @@ int getButtonDelay(int button) } /** Unloads a single pad. -* @see unloadPads */ + * @see unloadPads */ static void unloadPad(struct pad_data_t *pad) { padPortClose(pad->port, pad->slot); @@ -415,8 +415,8 @@ void unloadPads() } /** Tries to start a single pad. -* @param pad The pad data holding structure -* @return 0 Error, != 0 Ok */ + * @param pad The pad data holding structure + * @return 0 Error, != 0 Ok */ static int startPad(struct pad_data_t *pad) { int newState; @@ -435,7 +435,7 @@ static int startPad(struct pad_data_t *pad) } /** Starts all pads. -* @return Count of dual shock compatible pads. 0 if none present. */ + * @return Count of dual shock compatible pads. 0 if none present. */ int startPads() { // scan for pads that exist... at least one has to be present diff --git a/src/ps2cnf.c b/src/ps2cnf.c index bb2f97994..6ff37e7b7 100644 --- a/src/ps2cnf.c +++ b/src/ps2cnf.c @@ -19,12 +19,12 @@ static const char *CNFGetToken(const char *cnf, const char *key) } for (; *key != '\0'; key++, cnf++) { - //End of file + // End of file if (*cnf == '\0') return (const char *)-1; if (*cnf != *key) - return NULL; //Non-match + return NULL; // Non-match } return cnf; @@ -44,11 +44,11 @@ static const char *CNFGetKey(const char *line, char *key) { int i; - //Skip leading whitespace + // Skip leading whitespace for (; isspace((int)*line); line++) { } - if (*line == '\0') { //Unexpected end of file + if (*line == '\0') { // Unexpected end of file return (const char *)-1; } @@ -60,7 +60,7 @@ static const char *CNFGetKey(const char *line, char *key) } else if (isspace((int)*line)) { *key = '\0'; break; - } else if (*line == '\0') { //Unexpected end of file. This check exists, along with the other similar check above. + } else if (*line == '\0') { // Unexpected end of file. This check exists, along with the other similar check above. return (const char *)-1; } } @@ -97,7 +97,7 @@ int ps2cnfGetBootFile(const char *path, char *bootfile) system_cnf[size] = '\0'; cnf_end = &system_cnf[size]; - //Parse SYSTEM.CNF + // Parse SYSTEM.CNF cnf_start = system_cnf; while ((pChar = CNFGetToken(cnf_start, "BOOT2")) == NULL) { cnf_start = CNFAdvanceLine(cnf_start, cnf_end); @@ -105,15 +105,15 @@ int ps2cnfGetBootFile(const char *path, char *bootfile) return -1; } - if (pChar == (const char *)-1) { //Unexpected EOF + if (pChar == (const char *)-1) { // Unexpected EOF return -1; } - if ((pChar = CNFGetToken(pChar, "=")) == (const char *)-1) { //Unexpected EOF + if ((pChar = CNFGetToken(pChar, "=")) == (const char *)-1) { // Unexpected EOF return -1; } - if (CNFGetKey(pChar, bootfile) == (const char *)-1) { //Unexpected EOF + if (CNFGetKey(pChar, bootfile) == (const char *)-1) { // Unexpected EOF return -1; } diff --git a/src/renderman.c b/src/renderman.c index af1abfa81..3e86d4387 100644 --- a/src/renderman.c +++ b/src/renderman.c @@ -30,7 +30,7 @@ static int vsync_id = -1; struct rm_mode { char mode; - char hsync; //In KHz + char hsync; // In KHz short int width; short int height; short int passes; @@ -203,7 +203,7 @@ int rmSetMode(int force) gsGlobal->Dithering = GS_SETTING_ON; // Do not draw pixels if they are fully transparent - //gsGlobal->Test->ATE = GS_SETTING_ON; + // gsGlobal->Test->ATE = GS_SETTING_ON; gsGlobal->Test->ATST = 7; // NOTEQUAL to AREF passes gsGlobal->Test->AREF = 0x00; gsGlobal->Test->AFAIL = 0; // KEEP diff --git a/src/sound.c b/src/sound.c index 5c2b706ed..43cfb3a90 100644 --- a/src/sound.c +++ b/src/sound.c @@ -7,7 +7,7 @@ #include "include/ioman.h" #include "include/themes.h" -//default sfx +// default sfx extern unsigned char boot_adp[]; extern unsigned int size_boot_adp; @@ -47,7 +47,7 @@ static struct sfxEffect sfx_files[SFX_COUNT] = { static struct audsrv_adpcm_t sfx[SFX_COUNT]; static int sfx_initialized = 0; -//Returns 0 if the specified file was read. The sfxEffect structure will not be updated unless the file is successfully read. +// Returns 0 if the specified file was read. The sfxEffect structure will not be updated unless the file is successfully read. static int sfxRead(const char *full_path, struct sfxEffect *sfx) { int adpcm; @@ -118,7 +118,7 @@ static void sfxInitDefaults(void) sfx_files[SFX_TRANSITION].builtin = 1; } -//Returns 0 (AUDSRV_ERR_NOERROR) if the sound was loaded successfully. +// Returns 0 (AUDSRV_ERR_NOERROR) if the sound was loaded successfully. static int sfxLoad(struct sfxEffect *sfxData, audsrv_adpcm_t *sfx) { int ret; @@ -132,7 +132,7 @@ static int sfxLoad(struct sfxEffect *sfxData, audsrv_adpcm_t *sfx) ret = audsrv_load_adpcm(sfx, sfxData->buffer, sfxData->size); if (sfxData->builtin == 0) { free(sfxData->buffer); - sfxData->buffer = NULL; //Mark the buffer as freed. + sfxData->buffer = NULL; // Mark the buffer as freed. } return ret; @@ -154,7 +154,7 @@ void sfxVolume(void) audsrv_adpcm_set_volume(0, gBootSndVolume); } -//Returns number of audio files successfully loaded, < 0 if an unrecoverable error occurred. +// Returns number of audio files successfully loaded, < 0 if an unrecoverable error occurred. int sfxInit(int bootSnd) { char sound_path[256]; @@ -177,14 +177,14 @@ int sfxInit(int bootSnd) sfxInitDefaults(); sfxVolume(); - //Check default theme is not current theme + // Check default theme is not current theme int themeID = thmGetGuiValue(); if (themeID != 0) { - //Get theme path for sfx + // Get theme path for sfx char *thmPath = thmGetFilePath(themeID); snprintf(sound_path, sizeof(sound_path), "%ssound", thmPath); - //Check for custom sfx folder + // Check for custom sfx folder DIR *dir = opendir(sound_path); if (dir != NULL) { thmSfxEnabled = 1; diff --git a/src/supportbase.c b/src/supportbase.c index edaece166..2d0d82c45 100644 --- a/src/supportbase.c +++ b/src/supportbase.c @@ -54,7 +54,7 @@ int sbCreateSemaphore(void) return CreateSema(&sema); } -//0 = Not ISO disc image, GAME_FORMAT_OLD_ISO = legacy ISO disc image (filename follows old naming requirement), GAME_FORMAT_ISO = plain ISO image. +// 0 = Not ISO disc image, GAME_FORMAT_OLD_ISO = legacy ISO disc image (filename follows old naming requirement), GAME_FORMAT_ISO = plain ISO image. static int isValidIsoName(char *name, int *pNameLen) { // Old ISO image naming format: SCUS_XXX.XX.ABCDEFGHIJKLMNOP.iso @@ -142,7 +142,7 @@ static int loadISOGameListCache(const char *path, struct game_cache_list *cache) result = ENOMEM; } } else { - result = -1; //Empty file (should not happen) + result = -1; // Empty file (should not happen) } fclose(file); @@ -233,14 +233,14 @@ static int updateISOGameList(const char *path, const struct game_cache_list *cac } else result = ENOMEM; } else { - //Last game deleted. + // Last game deleted. remove(filename); } return result; } -//Queries for the game entry, based on filename. Only the new filename format is supported (filename.ext). +// Queries for the game entry, based on filename. Only the new filename format is supported (filename.ext). static int queryISOGameListCache(const struct game_cache_list *cache, base_game_info_t *ginfo, const char *filename) { char isoname[ISO_GAME_FNAME_MAX + 1]; @@ -277,7 +277,7 @@ static int scanForISO(char *path, char type, struct game_list_t **glist) base_game_info_t *game; if (NameLen > ISO_GAME_NAME_MAX) - continue; //Skip files that cannot be supported properly. + continue; // Skip files that cannot be supported properly. if (format == GAME_FORMAT_OLD_ISO) { struct game_list_t *next = (struct game_list_t *)malloc(sizeof(struct game_list_t)); @@ -296,7 +296,7 @@ static int scanForISO(char *path, char type, struct game_list_t **glist) strncpy(game->extension, &dirent->d_name[GAME_STARTUP_MAX + NameLen], sizeof(game->extension)); game->extension[sizeof(game->extension) - 1] = '\0'; } else { - //Out of memory. + // Out of memory. break; } } else { @@ -320,23 +320,23 @@ static int scanForISO(char *path, char type, struct game_list_t **glist) strncpy(game->extension, &dirent->d_name[NameLen], sizeof(game->extension)); game->extension[sizeof(game->extension) - 1] = '\0'; } else { - //Out of memory. + // Out of memory. fileXioUmount("iso:"); break; } } else { - //Unable to parse SYSTEM.CNF. + // Unable to parse SYSTEM.CNF. fileXioUmount("iso:"); continue; } fileXioUmount("iso:"); } else { - //Unable to mount game. + // Unable to mount game. continue; } } else { - //Entry was found in cache. + // Entry was found in cache. struct game_list_t *next = (struct game_list_t *)malloc(sizeof(struct game_list_t)); if (next != NULL) { @@ -346,7 +346,7 @@ static int scanForISO(char *path, char type, struct game_list_t **glist) game = &(*glist)->gameinfo; memcpy(game, &cachedGInfo, sizeof(base_game_info_t)); } else { - //Out of memory. + // Out of memory. break; } } @@ -482,7 +482,7 @@ int sbProbeISO9660(const char *path, base_game_info_t *game, u32 layer1_offset) char buffer[6]; result = -1; - if (game->media == SCECdPS2DVD) { //Only DVDs can have multiple layers. + if (game->media == SCECdPS2DVD) { // Only DVDs can have multiple layers. if ((file = fopen(path, "rb")) != NULL) { if (fseek(file, layer1_offset * 2048, SEEK_SET) == 0) { if ((fread(buffer, 1, sizeof(buffer), file) == sizeof(buffer)) && @@ -503,7 +503,7 @@ int sbProbeISO9660_64(const char *path, base_game_info_t *game, u32 layer1_offse char buffer[6]; result = -1; - if (game->media == SCECdPS2DVD) { //Only DVDs can have multiple layers. + if (game->media == SCECdPS2DVD) { // Only DVDs can have multiple layers. if ((fd = open(path, O_RDONLY, 0666)) >= 0) { if (lseek64(fd, (u64)layer1_offset * 2048, SEEK_SET) == (u64)layer1_offset * 2048) { if ((read(fd, buffer, sizeof(buffer)) == sizeof(buffer)) && @@ -699,7 +699,7 @@ config_set_t *sbPopulateConfig(base_game_info_t *game, const char *prefix, const char path[256]; snprintf(path, sizeof(path), "%sCFG%s%s.cfg", prefix, sep, game->startup); config_set_t *config = configAlloc(0, NULL, path); - configRead(config); //Does not matter if the config file could be loaded or not. + configRead(config); // Does not matter if the config file could be loaded or not. configSetStr(config, CONFIG_ITEM_NAME, game->name); if (game->sizeMB != -1) diff --git a/src/system.c b/src/system.c index 7253af2e6..016362988 100644 --- a/src/system.c +++ b/src/system.c @@ -143,7 +143,7 @@ void sysInitDev9(void) if (!dev9Initialized) { ret = sysLoadModuleBuffer(&ps2dev9_irx, size_ps2dev9_irx, 0, NULL); - dev9Loaded = (ret == 0); //DEV9.IRX must have successfully loaded and returned RESIDENT END. + dev9Loaded = (ret == 0); // DEV9.IRX must have successfully loaded and returned RESIDENT END. dev9Initialized = 1; } @@ -237,7 +237,7 @@ void sysReset(int modload_mask) sysLoadModuleBuffer(&audsrv_irx, size_audsrv_irx, 0, NULL); #ifdef PADEMU - int ds3pads = 1; //only one pad enabled + int ds3pads = 1; // only one pad enabled ds34usb_deinit(); ds34bt_deinit(); @@ -346,12 +346,12 @@ int sysGetDiscID(char *hexDiscID) void sysExecExit(void) { - //Deinitialize without shutting down active devices. + // Deinitialize without shutting down active devices. deinit(NO_EXCEPTION, IO_MODE_SELECTED_ALL); Exit(0); } -//Module bits +// Module bits #define CORE_IRX_USB 0x01 #define CORE_IRX_ETH 0x02 #define CORE_IRX_SMB 0x04 @@ -369,16 +369,16 @@ typedef struct int *module_size; } patchlist_t; -//Blank string for mode = all modes. +// Blank string for mode = all modes. static const patchlist_t iop_patch_list[] = { - {"SLUS_205.61", "", &iremsndpatch_irx, &size_iremsndpatch_irx}, //Disaster Report - {"SLES_513.01", "", &iremsndpatch_irx, &size_iremsndpatch_irx}, //SOS: The Final Escape - {"SLPS_251.13", "", &iremsndpatch_irx, &size_iremsndpatch_irx}, //Zettai Zetsumei Toshi - {"SLES_535.08", "", &apemodpatch_irx, &size_apemodpatch_irx}, //Ultimate Pro Pinball - {"SLUS_204.13", "", &f2techioppatch_irx, &size_f2techioppatch_irx}, //Shadow Man: 2econd Coming (NTSC-U/C) - {"SLES_504.46", "", &f2techioppatch_irx, &size_f2techioppatch_irx}, //Shadow Man: 2econd Coming (PAL) - {"SLES_506.08", "", &f2techioppatch_irx, &size_f2techioppatch_irx}, //Shadow Man: 2econd Coming (PAL German) - {NULL, NULL, NULL, NULL}, //Terminator + {"SLUS_205.61", "", &iremsndpatch_irx, &size_iremsndpatch_irx}, // Disaster Report + {"SLES_513.01", "", &iremsndpatch_irx, &size_iremsndpatch_irx}, // SOS: The Final Escape + {"SLPS_251.13", "", &iremsndpatch_irx, &size_iremsndpatch_irx}, // Zettai Zetsumei Toshi + {"SLES_535.08", "", &apemodpatch_irx, &size_apemodpatch_irx}, // Ultimate Pro Pinball + {"SLUS_204.13", "", &f2techioppatch_irx, &size_f2techioppatch_irx}, // Shadow Man: 2econd Coming (NTSC-U/C) + {"SLES_504.46", "", &f2techioppatch_irx, &size_f2techioppatch_irx}, // Shadow Man: 2econd Coming (PAL) + {"SLES_506.08", "", &f2techioppatch_irx, &size_f2techioppatch_irx}, // Shadow Man: 2econd Coming (PAL German) + {NULL, NULL, NULL, NULL}, // Terminator }; static unsigned int addIopPatch(const char *mode_str, const char *startup, irxptr_t *tab) @@ -406,9 +406,9 @@ typedef struct } modStorageSetting_t; static const modStorageSetting_t mod_storage_location_list[] = { - {"SLUS_209.77", (void *)0x01fc7000}, //Virtua Quest - {"SLPM_656.32", (void *)0x01fc7000}, //Virtua Fighter Cyber Generation: Judgment Six No Yabou - {NULL, NULL}, //Terminator + {"SLUS_209.77", (void *)0x01fc7000}, // Virtua Quest + {"SLPM_656.32", (void *)0x01fc7000}, // Virtua Fighter Cyber Generation: Judgment Six No Yabou + {NULL, NULL}, // Terminator }; static void *GetModStorageLocation(const char *startup, unsigned compatFlags) @@ -453,7 +453,7 @@ static unsigned int sendIrxKernelRAM(const char *startup, const char *mode_str, LOG("IOPRP image size actual: %d\n", size_ioprp_image); modcount = 0; - //Basic modules + // Basic modules irxptr_tab[modcount].info = size_udnl_irx | SET_OPL_MOD_ID(OPL_MODULE_ID_UDNL); irxptr_tab[modcount++].ptr = (void *)&udnl_irx; irxptr_tab[modcount].info = size_ioprp_image | SET_OPL_MOD_ID(OPL_MODULE_ID_IOPRP); @@ -534,8 +534,8 @@ static unsigned int sendIrxKernelRAM(const char *startup, const char *mode_str, irxtable->count = modcount; #ifdef __DECI2_DEBUG - //For DECI2 debugging mode, the UDNL module will have to be stored within kernel RAM because there isn't enough space below user RAM. - //total_size will hence not include the IOPRP image, but it's okay because the EE core is interested in protecting the module storage within user RAM. + // For DECI2 debugging mode, the UDNL module will have to be stored within kernel RAM because there isn't enough space below user RAM. + // total_size will hence not include the IOPRP image, but it's okay because the EE core is interested in protecting the module storage within user RAM. irxptr = (void *)0x00033000; LOG("SYSTEM DECI2 UDNL address start: %p end: %p\n", irxptr, irxptr + GET_OPL_MOD_SIZE(irxptr_tab[0].info)); DI(); @@ -544,7 +544,7 @@ static unsigned int sendIrxKernelRAM(const char *startup, const char *mode_str, ee_kmode_exit(); EI(); - irxptr_tab[0].ptr = irxptr; //UDNL is the first module. + irxptr_tab[0].ptr = irxptr; // UDNL is the first module. #endif total_size = (sizeof(irxtab_t) + sizeof(irxptr_t) * modcount + 0xF) & ~0xF; @@ -578,14 +578,14 @@ static unsigned int sendIrxKernelRAM(const char *startup, const char *mode_str, #ifdef __DECI2_DEBUG /* - Look for the start of the EE DECI2 manager initialization function. + Look for the start of the EE DECI2 manager initialization function. - The stock EE kernel has no reset function, but the EE kernel is most likely already primed to self-destruct and in need of a good reset. - What happens is that the OSD initializes the EE DECI2 TTY protocol at startup, but the EE DECI2 manager is never aware that the OSDSYS ever loads other programs. + The stock EE kernel has no reset function, but the EE kernel is most likely already primed to self-destruct and in need of a good reset. + What happens is that the OSD initializes the EE DECI2 TTY protocol at startup, but the EE DECI2 manager is never aware that the OSDSYS ever loads other programs. - As a result, the EE kernel crashes immediately when the EE TTY gets used (when the IOP side of DECI2 comes up), when it invokes whatever that exists at the OSD's old ETTY handler's location. :( + As a result, the EE kernel crashes immediately when the EE TTY gets used (when the IOP side of DECI2 comes up), when it invokes whatever that exists at the OSD's old ETTY handler's location. :( - Must be run in kernel mode. + Must be run in kernel mode. */ static int ResetDECI2(void) { @@ -593,10 +593,10 @@ static int ResetDECI2(void) unsigned int i, *ptr; void (*pDeci2ManagerInit)(void); static const unsigned int Deci2ManagerInitPattern[] = { - 0x3c02bf80, //lui v0, $bf80 - 0x3c04bfc0, //lui a0, $bfc0 - 0x34423800, //ori v0, v0, $3800 - 0x34840102 //ori a0, a0, $0102 + 0x3c02bf80, // lui v0, $bf80 + 0x3c04bfc0, // lui a0, $bfc0 + 0x34423800, // ori v0, v0, $3800 + 0x34840102 // ori a0, a0, $0102 }; result = -1; @@ -737,11 +737,11 @@ void sysLaunchLoaderElf(const char *filename, const char *mode_str, int size_cdv if (gExitPath[0] == '\0') strncpy(gExitPath, "Browser", sizeof(gExitPath)); - //Disable sound effects via libsd, to prevent some games with improper initialization from inadvertently using digital effect settings from other software. + // Disable sound effects via libsd, to prevent some games with improper initialization from inadvertently using digital effect settings from other software. sysLoadModuleBuffer(&cleareffects_irx, size_cleareffects_irx, 0, NULL); - //Wipe the low user memory region, since this region might not be wiped after OPL's EE core is installed. - //Start wiping from 0x00084000 instead (as the HDD Browser does), as the alarm patch is installed at 0x00082000. + // Wipe the low user memory region, since this region might not be wiped after OPL's EE core is installed. + // Start wiping from 0x00084000 instead (as the HDD Browser does), as the alarm patch is installed at 0x00082000. memset((void *)0x00084000, 0, 0x00100000 - 0x00084000); modules = 0; @@ -779,8 +779,8 @@ void sysLaunchLoaderElf(const char *filename, const char *mode_str, int size_cdv memset(eph[i].vaddr + eph[i].filesz, 0, eph[i].memsz - eph[i].filesz); } - //Get the kernel to use our EELOAD module and to begin erasure after module storage. EE core will erase any memory before the module storage (if any). - if (initKernel((void *)eh->entry, ModuleStorageEnd, &eeloadCopy, &initUserMemory) != 0) { //Should not happen, but... + // Get the kernel to use our EELOAD module and to begin erasure after module storage. EE core will erase any memory before the module storage (if any). + if (initKernel((void *)eh->entry, ModuleStorageEnd, &eeloadCopy, &initUserMemory) != 0) { // Should not happen, but... LOG("Error - kernel is unsupported.\n"); asm volatile("break\n"); } @@ -824,8 +824,8 @@ void sysLaunchLoaderElf(const char *filename, const char *mode_str, int size_cdv argv[argc] = gsm_config_str; argc++; - //PS2LOGO Caller, based on l_oliveira & SP193 tips - //Don't call LoadExecPS2 here because it will wipe all memory above the EE core, making it impossible to pass data via pointers. + // PS2LOGO Caller, based on l_oliveira & SP193 tips + // Don't call LoadExecPS2 here because it will wipe all memory above the EE core, making it impossible to pass data via pointers. if (EnablePS2Logo) { argv[argc] = "rom0:PS2LOGO"; argc++; diff --git a/src/textures.c b/src/textures.c index 91005372e..4f94b61cb 100644 --- a/src/textures.c +++ b/src/textures.c @@ -217,7 +217,7 @@ void texPrepare(GSTEXTURE *texture, short psm) texture->Vram = 0; texture->VramClut = 0; texture->Clut = NULL; - //gsKit_setup_tbw(texture); already done in gsKit_texture_upload + // gsKit_setup_tbw(texture); already done in gsKit_texture_upload } int texDiscoverLoad(GSTEXTURE *texture, const char *path, int texId, short psm) @@ -428,7 +428,7 @@ int texPngLoad(GSTEXTURE *texture, const char *path, int texId, short psm) if (file == NULL) return ERR_BAD_FILE; - readFunction = NULL; //Use default reading function. + readFunction = NULL; // Use default reading function. } else { if (!internalDefault[texId].texture) return ERR_BAD_FILE; diff --git a/src/themes.c b/src/themes.c index e977cb38a..e683cb1de 100644 --- a/src/themes.c +++ b/src/themes.c @@ -36,7 +36,7 @@ enum ELEM_ATTRIBUTE_TYPE { ELEM_TYPE_ATTRIBUTE_IMAGE, ELEM_TYPE_GAME_IMAGE, ELEM_TYPE_STATIC_IMAGE, - ELEM_TYPE_BACKGROUND, //A static image can be specified as the background. Otherwise, the plasma background will be drawn. + ELEM_TYPE_BACKGROUND, // A static image can be specified as the background. Otherwise, the plasma background will be drawn. ELEM_TYPE_MENU_ICON, ELEM_TYPE_MENU_TEXT, ELEM_TYPE_ITEMS_LIST, @@ -1159,7 +1159,7 @@ static void thmLoad(const char *themePath) config_set_t *themeConfig = NULL; if (!themePath) { - //No theme specified. Prepare and load the default theme. + // No theme specified. Prepare and load the default theme. themeConfig = configAlloc(0, NULL, NULL); configReadBuffer(themeConfig, &conf_theme_OPL_cfg, size_conf_theme_OPL_cfg); } else { diff --git a/src/util.c b/src/util.c index d2be996d7..3bb80201d 100644 --- a/src/util.c +++ b/src/util.c @@ -267,10 +267,10 @@ file_buffer_t *openFileBuffer(char *fpath, int mode, short allocResult, unsigned if (mode == O_RDONLY) { fileBuffer->lastPtr = NULL; - //Check for and skip the UTF-8 BOM sequence. + // Check for and skip the UTF-8 BOM sequence. if ((read(fd, bom, sizeof(bom)) != 3) || (bom[0] != 0xEF || bom[1] != 0xBB || bom[2] != 0xBF)) { - //Not BOM, so rewind. + // Not BOM, so rewind. lseek(fd, 0, SEEK_SET); } } else @@ -292,7 +292,7 @@ file_buffer_t *openFileBufferBuffer(short allocResult, const void *buffer, unsig fileBuffer->size = size; fileBuffer->available = size; fileBuffer->buffer = (char *)malloc((size + 1) * sizeof(char)); - fileBuffer->lastPtr = fileBuffer->buffer; //O_RDONLY, but with the data in the buffer. + fileBuffer->lastPtr = fileBuffer->buffer; // O_RDONLY, but with the data in the buffer. fileBuffer->allocResult = allocResult; fileBuffer->fd = -1; fileBuffer->mode = O_RDONLY; @@ -313,8 +313,8 @@ int readFileBuffer(file_buffer_t *fileBuffer, char **outBuf) if (fileBuffer->lastPtr) { // Calculate the remaining chars to the right of lastPtr lineSize = fileBuffer->available - (fileBuffer->lastPtr - fileBuffer->buffer); - /*LOG("##### Continue read, position: %X (total: %d) line size (\\0 not inc.): %d end: %x\n", - fileBuffer->lastPtr - fileBuffer->buffer, fileBuffer->available, lineSize, fileBuffer->lastPtr[lineSize]);*/ + /* LOG("##### Continue read, position: %X (total: %d) line size (\\0 not inc.): %d end: %x\n", + fileBuffer->lastPtr - fileBuffer->buffer, fileBuffer->available, lineSize, fileBuffer->lastPtr[lineSize]); */ posLF = strchr(fileBuffer->lastPtr, '\n'); } @@ -322,7 +322,7 @@ int readFileBuffer(file_buffer_t *fileBuffer, char **outBuf) // if available, we shift the remaining chars to the left ... if (lineSize) { - //LOG("##### LF not found, Shift %d characters from end to beginning\n", lineSize); + // LOG("##### LF not found, Shift %d characters from end to beginning\n", lineSize); memmove(fileBuffer->buffer, fileBuffer->lastPtr, lineSize); } @@ -331,7 +331,7 @@ int readFileBuffer(file_buffer_t *fileBuffer, char **outBuf) // Load as many characters necessary to fill the buffer length = fileBuffer->size - lineSize - 1; - //LOG("##### Asking for %d characters to complete buffer\n", length); + // LOG("##### Asking for %d characters to complete buffer\n", length); readSize = read(fileBuffer->fd, fileBuffer->buffer + lineSize, length); fileBuffer->buffer[lineSize + readSize] = '\0'; @@ -340,11 +340,11 @@ int readFileBuffer(file_buffer_t *fileBuffer, char **outBuf) // Now update read context info lineSize = lineSize + readSize; - //LOG("##### %d characters really read, line size now (\\0 not inc.): %d\n", read, lineSize); + // LOG("##### %d characters really read, line size now (\\0 not inc.): %d\n", read, lineSize); // If buffer not full it means we are at EOF if (fileBuffer->size != lineSize + 1) { - //LOG("##### Reached EOF\n"); + // LOG("##### Reached EOF\n"); close(fileBuffer->fd); fileBuffer->fd = -1; } @@ -365,7 +365,7 @@ int readFileBuffer(file_buffer_t *fileBuffer, char **outBuf) fileBuffer->lastPtr[lineSize] = '\0'; *outBuf = fileBuffer->lastPtr; - //LOG("##### Result line is \"%s\" size: %d avail: %d pos: %d\n", fileBuffer->lastPtr, lineSize, fileBuffer->available, fileBuffer->lastPtr - fileBuffer->buffer); + // LOG("##### Result line is \"%s\" size: %d avail: %d pos: %d\n", fileBuffer->lastPtr, lineSize, fileBuffer->available, fileBuffer->lastPtr - fileBuffer->buffer); // If we are at EOF and no more chars available to scan, then we are finished if (!lineSize && !fileBuffer->available && fileBuffer->fd == -1) @@ -397,23 +397,23 @@ int readFileBuffer(file_buffer_t *fileBuffer, char **outBuf) void writeFileBuffer(file_buffer_t *fileBuffer, char *inBuf, int size) { - //LOG("writeFileBuffer avail: %d size: %d\n", fileBuffer->available, size); + // LOG("writeFileBuffer avail: %d size: %d\n", fileBuffer->available, size); if (fileBuffer->available && fileBuffer->available + size > fileBuffer->size) { - //LOG("writeFileBuffer flushing: %d\n", fileBuffer->available); + // LOG("writeFileBuffer flushing: %d\n", fileBuffer->available); write(fileBuffer->fd, fileBuffer->buffer, fileBuffer->available); fileBuffer->lastPtr = fileBuffer->buffer; fileBuffer->available = 0; } if (size > fileBuffer->size) { - //LOG("writeFileBuffer direct write: %d\n", size); + // LOG("writeFileBuffer direct write: %d\n", size); write(fileBuffer->fd, inBuf, size); } else { memcpy(fileBuffer->lastPtr, inBuf, size); fileBuffer->lastPtr += size; fileBuffer->available += size; - //LOG("writeFileBuffer lastPrt: %d\n", (fileBuffer->lastPtr - fileBuffer->buffer)); + // LOG("writeFileBuffer lastPrt: %d\n", (fileBuffer->lastPtr - fileBuffer->buffer)); } } @@ -421,7 +421,7 @@ void closeFileBuffer(file_buffer_t *fileBuffer) { if (fileBuffer->fd >= 0) { if (fileBuffer->mode != O_RDONLY && fileBuffer->available) { - //LOG("writeFileBuffer final write: %d\n", fileBuffer->available); + // LOG("writeFileBuffer final write: %d\n", fileBuffer->available); write(fileBuffer->fd, fileBuffer->buffer, fileBuffer->available); } close(fileBuffer->fd); @@ -493,7 +493,7 @@ int InitConsoleRegionData(void) case 'A': ConsoleRegion = CONSOLE_REGION_USA; break; - default: //For Japanese and unidentified consoles. + default: // For Japanese and unidentified consoles. ConsoleRegion = CONSOLE_REGION_JAPAN; }