diff --git a/include/game/sLib/s_crc.hpp b/include/game/sLib/s_crc.hpp new file mode 100644 index 000000000..dbd850ccf --- /dev/null +++ b/include/game/sLib/s_crc.hpp @@ -0,0 +1,16 @@ +#pragma once +#include + +/// @brief Wrapper around the runtime's CRC32 calculation function. +/// @ingroup slib +class sCrc { +public: + /** + * @brief Calculates the CRC32 checksum of a buffer. + * + * @param data The buffer to checksum. + * @param size The size of the buffer, in bytes. + * @return The CRC32 checksum. + */ + static ulong calcCRC32(const void *data, ulong size); +}; diff --git a/include/lib/revolution/OS.h b/include/lib/revolution/OS.h index ee337e7ac..83fafd41f 100644 --- a/include/lib/revolution/OS.h +++ b/include/lib/revolution/OS.h @@ -16,6 +16,7 @@ extern "C" { #include #include #include +#include #include #include #include diff --git a/include/lib/revolution/OS/OSCrc.h b/include/lib/revolution/OS/OSCrc.h new file mode 100644 index 000000000..4b0dceba3 --- /dev/null +++ b/include/lib/revolution/OS/OSCrc.h @@ -0,0 +1,13 @@ +#ifndef RVL_SDK_OS_CRC_H +#define RVL_SDK_OS_CRC_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +ulong OSCalcCRC32(const void *, ulong); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/slices/wiimj2d.json b/slices/wiimj2d.json index aa394c969..2a53a48dc 100644 --- a/slices/wiimj2d.json +++ b/slices/wiimj2d.json @@ -675,6 +675,12 @@ ".sdata2": "0x2b70-0x2b78" } }, + { + "source": "dol/sLib/s_crc.cpp", + "memoryRanges": { + ".text": "0x158af0-0x158b00" + } + }, { "source": "dol/sLib/s_lib.cpp", "memoryRanges": { diff --git a/source/dol/sLib/s_crc.cpp b/source/dol/sLib/s_crc.cpp new file mode 100644 index 000000000..cdf96e55c --- /dev/null +++ b/source/dol/sLib/s_crc.cpp @@ -0,0 +1,6 @@ +#include +#include + +ulong sCrc::calcCRC32(const void *data, ulong size) { + return OSCalcCRC32(data, size); +} diff --git a/syms.txt b/syms.txt index 9d078a2da..90fbdbec9 100644 --- a/syms.txt +++ b/syms.txt @@ -491,6 +491,7 @@ OSSuspendThread=0x801B5C40 OSSetThreadPriority=0x801B5FC0 OSGetThreadPriority=0x801B60B0 OSGetTime=0x801B60C0 +OSCalcCRC32=0x801B8760 VIWaitForRetrace=0x801BCE30 VIEnableDimming=0x801BE430 PSMTXIdentity=0x801C0610