forked from PMStanley/PSV-Exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPSVFormat.pas
149 lines (133 loc) · 4.5 KB
/
PSVFormat.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
unit PSVFormat;
//////////////////////////////////////////////////////////
//
// Copyright Peter Stanley
// https://github.com/PMStanley
//
//////////////////////////////////////////////////////////
// If you make any changes to this file be sure to send update to gothi at PS2Savetools.
interface
type
titleArray = array[0..19] of AnsiChar;
THeader = record
magic : array[0..3] of AnsiChar;
padding1 : integer; //always 0x00000000
salt : array [0..19] of byte;
signature : array [0..19] of byte; //digital sig
padding2 : integer; //always 0x00000000
padding3 : integer; //always 0x00000000
headerSize : integer; //always 0x0000002C in PS2, 0x00000014 in PS1.
saveType : integer; //0x00000002 PS2, 0x00000001 PS1
end;
PTHeader = ^THeader;
TPS2Header = record
displaySize : integer; //PS3 will just round this up to the neaest 1024 boundry so just make it as good as possible
sysPos : integer; //location in file of icon.sys
sysSize : integer; //icon.sys size
icon1Pos : integer; //position of 1st icon
icon1Size : integer; //size of 1st icon
icon2Pos : integer; //position of 2nd icon
icon2Size : integer; //size of 2nd icon
icon3Pos : integer; //position of 3rd icon
icon3Size : integer; //size of 3rd icon
numberOfFiles : integer;
end;
PTPS2Header = ^TPS2Header;
TPS2MainDirInfo = record
CreateReserved: byte;
CreateSecond : byte;
CreateMinute : byte;
CreateHour : byte;
CreateDay : byte;
CreateMonth: byte;
CreateYear : word;
ModReserved: byte;
ModSecond : byte;
ModMinute : byte;
ModHour : byte;
ModDays : byte;
ModMonth: byte;
ModYear : word;
numberOfFilesInDir : integer; //this is likely to be number of files in dir + 2 ("." and "..")
attribute : integer; //(8427 dir)
filename : array[0..31] of AnsiChar;
end;
PTPS2MainDirInfo = ^TPS2MainDirInfo;
TPS2FileInfo = record
CreateReserved: byte;
CreateSecond : byte;
CreateMinute : byte;
CreateHour : byte;
CreateDay : byte;
CreateMonth: byte;
CreateYear : word;
ModReserved: byte;
ModSecond : byte;
ModMinute : byte;
ModHour : byte;
ModDay : byte;
ModMonth: byte;
ModYear : word;
filesize : integer;
attribute : integer; //(8497 file)
filename : array[0..31] of AnsiChar; // 'Real' PSV files have junk in this after text.
positionInFile : integer;
end;
PTPS2FileInfo = ^TPS2FileInfo;
TPS1Header = record
saveSize : integer;
startOfSaveData : integer;
blockSize : integer; //always 0x00020000 (512). Block size?
padding1 : integer; //always 0x00000000?
padding2 : integer; //always 0x00000000?
padding3 : integer; //always 0x00000000?
padding4 : integer; //always 0x00000000?
dataSize : integer; //save size repeated?
unknown1 : integer; //always 0x03900000 (36867)?
prodCode : array[0..19] of AnsiChar; //20 bytes, 0x00 filled & terminated
padding6 : integer; //always 0x00000000?
padding7 : integer; //always 0x00000000?
padding8 : integer; //always 0x00000000?
end;
PTPS1Header = ^TPS1Header;
TPS1MCSHeader = packed record
magic : integer; // = 81;
dataSize : integer;
positionInCard : word; // = $FFFF;
prodCode : array[0..19] of AnsiChar;
filler : array[0..96] of byte;
end;
PTPS1MCSHeader = ^TPS1MCSHeader;
TPS1FileInfo = record
magic : array [0..1] of AnsiChar;
iconDisplay : byte;
blocksUsed : byte;
title : array [0..31] of wideChar;
end;
PTPS1FileInfo = ^TPS1FileInfo;
TIconSys = record
magic : array[0..3] of AnsiChar;
padding1 : word; // 0000
secondLineOffset : word;
padding2 : integer; // 00000000
transparencyVal : integer; // 0x00 (clear) to 0x80 (opaque)
bgColourUpperLeft : array [0..15] of byte;
bgColourUpperRight : array [0..15] of byte;
bgColourLowerLeft : array [0..15] of byte;
bgColourLowerRight : array [0..15] of byte;
light1Direction : array [0..15] of byte;
light2Direction : array [0..15] of byte;
light3Direction : array [0..15] of byte;
light1RGB : array [0..15] of byte;
light2RGB : array [0..15] of byte;
light3RGB : array [0..15] of byte;
ambientLightRGB : array [0..15] of byte;
title : array [0..67] of byte; // null terminated, S-JIS
IconName : array [0..63] of AnsiChar; // null terminated, S-JIS
copyIconName : array [0..63] of AnsiChar; // null terminated, S-JIS
deleteIconName : array [0..63] of AnsiChar; // null terminated, S-JIS
padding3 : array[0..511] of byte;
end;
PTIconSys = ^TIconSys;
implementation
end.