@@ -767,7 +767,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
767
767
}
768
768
769
769
statGet->sysSizeKB = 35 ; // always reported as 35 regardless of actual file sizes
770
- statGet->sizeKB = size_kbytes ? size_kbytes + statGet->sysSizeKB : 0 ;
770
+ statGet->sizeKB = !save_entry. isNew ? size_kbytes + statGet->sysSizeKB : 0 ;
771
771
772
772
// Stat Callback
773
773
funcStat (ppu, result, statGet, statSet);
@@ -797,6 +797,30 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
797
797
798
798
if (statSet->setParam )
799
799
{
800
+ if (statSet->setParam ->attribute > CELL_SAVEDATA_ATTR_NODUPLICATE)
801
+ {
802
+ // ****** sysutil savedata parameter error : 57 ******
803
+ return CELL_SAVEDATA_ERROR_PARAM;
804
+ }
805
+
806
+ for (u8 resv : statSet->setParam ->reserved2 )
807
+ {
808
+ if (resv)
809
+ {
810
+ // ****** sysutil savedata parameter error : 58 ******
811
+ return CELL_SAVEDATA_ERROR_PARAM;
812
+ }
813
+ }
814
+
815
+ for (u8 resv : statSet->setParam ->reserved )
816
+ {
817
+ if (resv)
818
+ {
819
+ // ****** sysutil savedata parameter error : 59 ******
820
+ return CELL_SAVEDATA_ERROR_PARAM;
821
+ }
822
+ }
823
+
800
824
// Update PARAM.SFO
801
825
psf.clear ();
802
826
psf.insert (
@@ -816,14 +840,13 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
816
840
817
841
has_modified = true ;
818
842
}
819
- // else if (psf.empty())
820
- // {
821
- // // setParam is specified if something required updating.
822
- // // Do not exit. Recreate mode will handle the rest
823
- // //return CELL_OK;
824
- // }
825
-
826
- switch (const u32 mode = statSet->reCreateMode & 0xffff )
843
+ else if (save_entry.isNew )
844
+ {
845
+ // ****** sysutil savedata parameter error : 50 ******
846
+ return CELL_SAVEDATA_ERROR_PARAM;
847
+ }
848
+
849
+ switch (const u32 mode = statSet->reCreateMode & CELL_SAVEDATA_RECREATE_MASK)
827
850
{
828
851
case CELL_SAVEDATA_RECREATE_NO:
829
852
{
@@ -841,6 +864,11 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
841
864
case CELL_SAVEDATA_RECREATE_YES:
842
865
case CELL_SAVEDATA_RECREATE_YES_RESET_OWNER:
843
866
{
867
+ if (!statSet->setParam )
868
+ {
869
+ // ****** sysutil savedata parameter error : 50 ******
870
+ return CELL_SAVEDATA_ERROR_PARAM;
871
+ }
844
872
845
873
// TODO: Only delete data, not owner info
846
874
for (const auto & entry : fs::dir (dir_path))
@@ -851,15 +879,6 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
851
879
}
852
880
}
853
881
854
- // TODO: probably not deleting owner info
855
- if (!statSet->setParam )
856
- {
857
- // Savedata deleted and setParam is NULL: delete directory and abort operation
858
- if (fs::remove_dir (dir_path)) cellSaveData.error (" savedata_op(): savedata directory %s deleted" , save_entry.dirName );
859
-
860
- // return CELL_OK;
861
- }
862
-
863
882
break ;
864
883
}
865
884
0 commit comments