aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CRC32.cpp4
-rw-r--r--src/NDSCart.cpp5
2 files changed, 8 insertions, 1 deletions
diff --git a/src/CRC32.cpp b/src/CRC32.cpp
index aa31fb6..62e334f 100644
--- a/src/CRC32.cpp
+++ b/src/CRC32.cpp
@@ -18,6 +18,8 @@
#include "CRC32.h"
+// http://www.codeproject.com/KB/recipes/crc32_large.aspx
+
u32 crctable[256];
bool tableinited = false;
@@ -35,7 +37,7 @@ u32 _reflect(u32 refl, char ch)
return value;
}
-void inittable()
+void _inittable()
{
u32 polynomial = 0x04C11DB7;
diff --git a/src/NDSCart.cpp b/src/NDSCart.cpp
index 03dfe4c..5be1fff 100644
--- a/src/NDSCart.cpp
+++ b/src/NDSCart.cpp
@@ -21,6 +21,7 @@
#include "NDS.h"
#include "NDSCart.h"
#include "ARM.h"
+#include "CRC32.h"
#include "melon_fopen.h"
@@ -733,6 +734,7 @@ u32 DataOutLen;
bool CartInserted;
u8* CartROM;
u32 CartROMSize;
+u32 CartCRC;
u32 CartID;
bool CartIsHomebrew;
@@ -1094,6 +1096,9 @@ bool LoadROM(const char* path, const char* sram, bool direct)
fclose(f);
//CartROM = f;
+ CartCRC = CRC32(CartROM, CartROMSize);
+ printf("ROM CRC32: %08X\n", CartCRC);
+
// generate a ROM ID
// note: most games don't check the actual value
// it just has to stay the same throughout gameplay