-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6c7f557
commit c4cf8ed
Showing
12 changed files
with
225 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#ifndef IPL3CHECKSUM_H | ||
#define IPL3CHECKSUM_H | ||
#pragma once | ||
|
||
#include "ipl3checksum/error.h" | ||
#include "ipl3checksum/cickinds.h" | ||
#include "ipl3checksum/checksum.h" | ||
#include "ipl3checksum/detect.h" | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#ifndef IPL3CHECKSUM_CHECKSUM_H | ||
#define IPL3CHECKSUM_CHECKSUM_H | ||
#pragma once | ||
|
||
#include <stddef.h> | ||
#include <stdint.h> | ||
|
||
#include "error.h" | ||
#include "cickinds.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" | ||
{ | ||
#endif | ||
|
||
Ipl3Checksum_Error ipl3checksum_calculate_checksum( | ||
uint32_t *dst_checksum0, | ||
uint32_t *dst_checksum1, | ||
size_t rom_bytes_len, | ||
const uint8_t *rom_bytes, | ||
Ipl3Checksum_CICKind kind | ||
); | ||
|
||
Ipl3Checksum_Error ipl3checksum_calculate_checksum_autodetect( | ||
uint32_t *dst_checksum0, | ||
uint32_t *dst_checksum1, | ||
size_t rom_bytes_len, | ||
const uint8_t *rom_bytes | ||
); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#ifndef IPL3CHECKSUM_CICKINDS_H | ||
#define IPL3CHECKSUM_CICKINDS_H | ||
#pragma once | ||
|
||
#ifdef __cplusplus | ||
extern "C" | ||
{ | ||
#endif | ||
|
||
/* This needs to be synced with the Rust equivalent in `src/rs/cickinds.rs` */ | ||
typedef enum Ipl3Checksum_CICKind { | ||
Ipl3Checksum_CICKind_CIC_6101, | ||
Ipl3Checksum_CICKind_CIC_6102_7101, | ||
Ipl3Checksum_CICKind_CIC_7102, | ||
Ipl3Checksum_CICKind_CIC_X103, // Both 6103 and 7103 | ||
// 6104/7104 does not exist | ||
Ipl3Checksum_CICKind_CIC_X105, // Both 6105 and 7105 | ||
Ipl3Checksum_CICKind_CIC_X106, // Both 6106 and 7106 | ||
} Ipl3Checksum_CICKind; | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#ifndef IPL3CHECKSUM_DETECT_H | ||
#define IPL3CHECKSUM_DETECT_H | ||
#pragma once | ||
|
||
#ifdef __cplusplus | ||
extern "C" | ||
{ | ||
#endif | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#ifndef IPL3CHECKSUM_ERROR_H | ||
#define IPL3CHECKSUM_ERROR_H | ||
#pragma once | ||
|
||
#ifdef __cplusplus | ||
extern "C" | ||
{ | ||
#endif | ||
|
||
/* This needs to be synced with the Rust equivalent in `src/rs/error.rs` */ | ||
typedef enum Ipl3Checksum_Error_Tag { | ||
Ipl3Checksum_Error_Okay, | ||
Ipl3Checksum_Error_UnalignedRead, | ||
Ipl3Checksum_Error_ByteConversion, | ||
Ipl3Checksum_Error_OutOfBounds, | ||
Ipl3Checksum_Error_NullPointer, | ||
Ipl3Checksum_Error_BufferNotBigEnough, | ||
Ipl3Checksum_Error_BufferSizeIsWrong, | ||
Ipl3Checksum_Error_UnableToDetectCIC, | ||
} Ipl3Checksum_Error_Tag; | ||
|
||
typedef struct Ipl3Checksum_Error { | ||
Ipl3Checksum_Error_Tag tag; | ||
union Ipl3Checksum_Error_Payload { | ||
struct Ipl3Checksum_Error_Payload_UnalignedRead { | ||
size_t offset; | ||
} UnalignedRead; | ||
struct Ipl3Checksum_Error_Payload_ByteConversion { | ||
size_t offset; | ||
} ByteConversion; | ||
struct Ipl3Checksum_Error_Payload_OutOfBounds { | ||
size_t offset; | ||
size_t requested_bytes; | ||
size_t buffer_len; | ||
} OutOfBounds; | ||
struct Ipl3Checksum_Error_Payload_BufferNotBigEnough { | ||
size_t buffer_len; | ||
size_t expected_len; | ||
} BufferNotBigEnough; | ||
struct Ipl3Checksum_Error_Payload_BufferSizeIsWrong { | ||
size_t buffer_len; | ||
size_t expected_len; | ||
} BufferSizeIsWrong; | ||
} payload; | ||
} Ipl3Checksum_Error; | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters