Skip to content

Commit

Permalink
Add missing bytes to KELFHeader
Browse files Browse the repository at this point in the history
thanks to krHACKen for that info
  • Loading branch information
balika011 committed Nov 26, 2019
1 parent 2424d5c commit 6b9b471
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/kelf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,9 @@ int Kelf::SaveKelf(std::string filename)
memcpy(header.UserDefined, PSX_USER, 16);
header.ContentSize = Content.size();
header.HeaderSize = sizeof(KELFHeader) + 8 + 16 + 16 + 8 + 16 + 16 + 8 + 8; // header + header signature + kbit + kc + bittable + bittable signature + root signature
header.unk = 0x0101; // PSX
header.Flags = 0x22C; // PSX
header.SystemType = SYSTEM_TYPE_PSX;
header.ApplicationType = 1; // 1 = xosdmain, 5 = dvdplayer kirx 7 = dvdplayer kelf
header.Flags = 0x22C;
header.BitCount = 0;
header.MGZones = 1; // Japan

Expand Down
6 changes: 5 additions & 1 deletion src/kelf.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,17 @@
#define KELF_ERROR_INVALID_CONTENT_SIGNATURE -6
#define KELF_ERROR_UNSUPPORTED_FILE -6

#define SYSTEM_TYPE_PS2 0 // same for COH (arcade)
#define SYSTEM_TYPE_PSX 1

#pragma pack(push, 1)
struct KELFHeader
{
uint8_t UserDefined[16];
uint32_t ContentSize; // Sometimes not...
uint16_t HeaderSize;
uint16_t unk;
uint8_t SystemType;
uint8_t ApplicationType;
uint16_t Flags;
uint16_t BitCount;
uint32_t MGZones;
Expand Down

0 comments on commit 6b9b471

Please sign in to comment.