11#include "menu/memc.h"
2+ #include "sifdev.h"
23
34#include <stdio.h>
45#include <string.h>
@@ -31,9 +32,7 @@ void memc_setDirName(char *name) {
3132}
3233
3334void memc_setSaveTitle (char * name , int nLFPos ) {
34- int length ;
35-
36- length = strlen (name );
35+ int length = strlen (name );
3736 if (length > 64 ) {
3837 length = 64 ;
3938 }
@@ -52,7 +51,7 @@ void memc_setIconSysHed(void *pIhData, int IhSize) {
5251 }
5352
5453 nLF = memc_iconsys .OffsLF ;
55-
54+
5655 memcpy (& memc_iconsys , pIhData , IhSize );
5756 memc_iconsys .OffsLF = nLF ;
5857}
@@ -64,7 +63,7 @@ void memc_setSaveIcon(int no, void *pIconData, int nIconSize) {
6463 case 0 :
6564 pmw -> iconData1 = pIconData ;
6665 pmw -> iconSize1 = nIconSize ;
67-
66+
6867 strcpy (memc_iconsys .FnameView , "icon1.ico" );
6968 break ;
7069 case 1 :
@@ -113,10 +112,12 @@ char* memc_getfilename(int no) {
113112 if (memc_stat .iconData2 == NULL ) {
114113 return NULL ;
115114 }
115+ /* fallthrough */
116116 case -4 :
117117 if (memc_stat .iconData3 == NULL ) {
118118 return NULL ;
119119 }
120+ /* fallthrough */
120121 default :
121122 if (no >= 2 ) {
122123 return NULL ;
@@ -128,6 +129,7 @@ char* memc_getfilename(int no) {
128129 sprintf (tmps0 , "SAVE%03d" , no );
129130 fbody = tmps0 ;
130131 }
132+
131133 break ;
132134 }
133135
@@ -248,7 +250,7 @@ int memc_port_info(int port, MEMC_INFO *info) {
248250 strcpy (pmw -> filename , pmw -> saveDir );
249251 strcat (pmw -> filename , "/*" );
250252
251- pmw -> bChkSys = 1 ;
253+ pmw -> bChkSys = TRUE ;
252254 pmw -> filename [63 ] = '\0' ;
253255
254256 memc_clearMEMCINFO (info );
@@ -257,7 +259,7 @@ int memc_port_info(int port, MEMC_INFO *info) {
257259 if (re == sceMcResSucceed ) {
258260 pmw -> func = MEMC_FUNC_GETINFO ;
259261 }
260-
262+
261263 return re ;
262264}
263265
@@ -544,7 +546,6 @@ static int memc_mansub_ErrChk(int result) {
544546 case -2 :
545547 pmw -> func = 0 ;
546548 return 3 ;
547- /* (pmw->func==1||pmw->cmd==sceMcFuncNoFileInfo) -- sceMcResNoFormat */
548549 case -2000 :
549550 pmw -> func = 0 ;
550551 pmw -> isChange = 1 ;
@@ -641,7 +642,7 @@ static int memc_mansub_GetInfo(int result) {
641642
642643 return memc_mansub_ErrChk (re );
643644 } else {
644- if (pmw -> format == 0 ) {
645+ if (! pmw -> format ) {
645646 pmw -> func = 0 ;
646647 return 3 ;
647648 } else {
@@ -711,7 +712,7 @@ static int memc_mansub_load(int result) {
711712 return 2 ;
712713 }
713714
714- if (!memc_mansub_Open (pmw -> filename , 1 )) {
715+ if (!memc_mansub_Open (pmw -> filename , SCE_RDONLY )) {
715716 pmw -> func = 3 ;
716717 break ;
717718 }
@@ -768,7 +769,7 @@ static int memc_manager_save(int result) {
768769 switch (pmw -> cmd ) {
769770 case 0xe :
770771 if (result == 0 ) {
771- if (pmw -> format == 0 ) {
772+ if (! pmw -> format ) {
772773 result = -2 ;
773774 }
774775 }
@@ -796,7 +797,7 @@ static int memc_manager_save(int result) {
796797
797798 case 0xd :
798799 if (result == 0 ) {
799- if (pmw -> format == 0 ) {
800+ if (! pmw -> format ) {
800801 result = -2 ;
801802 }
802803 }
@@ -851,7 +852,7 @@ static int memc_manager_save(int result) {
851852 if (isSysOWrite ) {
852853 pmw -> func = 4 ;
853854 pmw -> stat |= 0x3 ;
854- memc_mansub_Open (memc_getfilepath (-1 ), 0x202 );
855+ memc_mansub_Open (memc_getfilepath (-1 ), SCE_CREAT | SCE_WRONLY );
855856 break ;
856857 }
857858
@@ -860,7 +861,7 @@ static int memc_manager_save(int result) {
860861 pmw -> func = 0 ;
861862 return 4 ;
862863 } else {
863- if (memc_mansub_Open (pmw -> filename , 0x202 ) == 1 ) {
864+ if (memc_mansub_Open (pmw -> filename , SCE_CREAT | SCE_WRONLY ) == 1 ) {
864865 pmw -> func = 0 ;
865866 return 4 ;
866867 }
@@ -887,7 +888,7 @@ static int memc_manager_save(int result) {
887888 break ;
888889 case 0xb :
889890 if (result == 0 ) {
890- if (pmw -> format == 0 ) {
891+ if (! pmw -> format ) {
891892 result = -2 ;
892893 }
893894 }
@@ -907,11 +908,11 @@ static int memc_manager_save(int result) {
907908
908909 pmw -> func = 4 ;
909910 pmw -> stat |= 0x2 ;
910- memc_mansub_Open (memc_getfilepath (-1 ), 0x202 );
911+ memc_mansub_Open (memc_getfilepath (-1 ), SCE_CREAT | SCE_WRONLY );
911912 break ;
912913 case 2 :
913914 if (result == 0 ) {
914- if (pmw -> format == 0 ) {
915+ if (! pmw -> format ) {
915916 result = -2 ;
916917 }
917918 }
@@ -971,7 +972,7 @@ static int memc_manager_save(int result) {
971972
972973 case 0x1000e :
973974 if (result == 0 ) {
974- if (pmw -> format == 0 ) {
975+ if (! pmw -> format ) {
975976 result = -2 ;
976977 }
977978 }
@@ -990,7 +991,7 @@ static int memc_manager_save(int result) {
990991 break ;
991992 case 0x1000f :
992993 if (result == 0 ) {
993- if (pmw -> format == 0 ) {
994+ if (! pmw -> format ) {
994995 result = -2 ;
995996 }
996997 }
@@ -1011,7 +1012,7 @@ static int memc_manager_save(int result) {
10111012 break ;
10121013 case 6 :
10131014 if (result == 0 ) {
1014- if (pmw -> format == 0 ) {
1015+ if (! pmw -> format ) {
10151016 result = -2 ;
10161017 }
10171018 }
@@ -1045,28 +1046,28 @@ static int memc_manager_save(int result) {
10451046
10461047 if (!(pmw -> stat & 0x4 )) {
10471048 pmw -> stat |= 0x4 ;
1048- memc_mansub_Open (memc_getfilepath (-2 ), 0x202 );
1049+ memc_mansub_Open (memc_getfilepath (-2 ), SCE_CREAT | SCE_WRONLY );
10491050 break ;
10501051 }
10511052
10521053 if (!(pmw -> stat & 0x8 )) {
10531054 if ((fname = memc_getfilepath (-3 )) != NULL ) {
10541055 pmw -> stat |= 0x8 ;
1055- memc_mansub_Open (fname , 0x202 );
1056+ memc_mansub_Open (fname , SCE_CREAT | SCE_WRONLY );
10561057 break ;
10571058 }
10581059 }
10591060
10601061 if (!(pmw -> stat & 0x10 )) {
10611062 if ((fname = memc_getfilepath (-4 )) != NULL ) {
10621063 pmw -> stat |= 0x10 ;
1063- memc_mansub_Open (fname , 0x202 );
1064+ memc_mansub_Open (fname , SCE_CREAT | SCE_WRONLY );
10641065 break ;
10651066 }
10661067 }
10671068
10681069 pmw -> stat &= ~0x1f ;
1069- memc_mansub_Open (pmw -> filename , 0x202 );
1070+ memc_mansub_Open (pmw -> filename , SCE_CREAT | SCE_WRONLY );
10701071 } else {
10711072 pmw -> func = 0 ;
10721073 return 1 ;
@@ -1107,11 +1108,11 @@ static int memc_manager_overwrite(int result) {
11071108 memc_searchDirTbl (fname , pmw -> curDir , 0 , 1 , pmw -> iconSize3 , NULL ) == NULL )) {
11081109 pmw -> func = 4 ;
11091110 pmw -> stat |= 0x3 ;
1110- memc_mansub_Open (memc_getfilepath (-1 ), 0x202 );
1111+ memc_mansub_Open (memc_getfilepath (-1 ), SCE_CREAT | SCE_WRONLY );
11111112 return 0x10 ;
11121113 }
11131114
1114- if (memc_mansub_Open (pmw -> filename , 0x202 ) == 1 ) {
1115+ if (memc_mansub_Open (pmw -> filename , SCE_CREAT | SCE_WRONLY ) == 1 ) {
11151116 pmw -> func = 0 ;
11161117 return 4 ;
11171118 } else {
@@ -1130,7 +1131,7 @@ static int memc_manager_chk(int mode) {
11301131
11311132 pmw = & memc_stat ;
11321133
1133- re = sceMcSync (mode , 0 , & result );
1134+ re = sceMcSync (mode , NULL , & result );
11341135 if (re == sceMcExecFinish ) {
11351136 switch (pmw -> func ) {
11361137 case 3 :
0 commit comments