Split game_128f30.c into crc.c and game_1291b0.c

This commit is contained in:
Ryan Dwyer
2021-09-18 13:17:44 +10:00
parent 53bb78d630
commit 1552b5bb9f
10 changed files with 71 additions and 54 deletions
+2 -1
View File
@@ -143,7 +143,8 @@
build/ROMID/game/data/data_020df0.o (section); \
build/ROMID/game/game_11f000.o (section); \
build/ROMID/game/game_127910.o (section); \
build/ROMID/game/game_128f30.o (section); \
build/ROMID/game/crc.o (section); \
build/ROMID/game/game_1291b0.o (section); \
build/ROMID/game/game_129210.o (section); \
build/ROMID/game/explosions/explosions.o (section); \
build/ROMID/game/smoke/smoke.o (section); \
+2 -1
View File
@@ -142,7 +142,8 @@
build/ROMID/game/data/data_020df0.o (section); \
build/ROMID/game/game_11f000.o (section); \
build/ROMID/game/game_127910.o (section); \
build/ROMID/game/game_128f30.o (section); \
build/ROMID/game/crc.o (section); \
build/ROMID/game/game_1291b0.o (section); \
build/ROMID/game/game_129210.o (section); \
build/ROMID/game/explosions/explosions.o (section); \
build/ROMID/game/smoke/smoke.o (section); \
+2 -1
View File
@@ -142,7 +142,8 @@
build/ROMID/game/data/data_020df0.o (section); \
build/ROMID/game/game_11f000.o (section); \
build/ROMID/game/game_127910.o (section); \
build/ROMID/game/game_128f30.o (section); \
build/ROMID/game/crc.o (section); \
build/ROMID/game/game_1291b0.o (section); \
build/ROMID/game/game_129210.o (section); \
build/ROMID/game/explosions/explosions.o (section); \
build/ROMID/game/smoke/smoke.o (section); \
+1 -1
View File
@@ -19,7 +19,7 @@
#include "game/game_0b69d0.h"
#include "game/game_0c33f0.h"
#include "game/game_127910.h"
#include "game/game_128f30.h"
#include "game/game_1291b0.h"
#include "game/game_129210.h"
#include "game/explosions/explosions.h"
#include "game/smoke/smoke.h"
+50
View File
@@ -0,0 +1,50 @@
#include <ultra64.h>
#include "constants.h"
#include "bss.h"
#include "lib/rng.h"
#include "data.h"
#include "types.h"
void crcCalculateU32Pair(u8 *start, u8 *end, u32 *checksum)
{
u8 *ptr;
u32 salt = 0;
u64 seed = 0x8f809f473108b3c1;
u32 sum1 = 0;
u32 sum2 = 0;
for (ptr = start; ptr < end; ptr++, salt += 7) {
seed += *ptr << (salt & 0x0f);
sum1 ^= rngRotateSeed(&seed);
}
for (ptr = end - 1; ptr >= start; ptr--, salt += 3) {
seed += *ptr << (salt & 0x0f);
sum2 ^= rngRotateSeed(&seed);
}
checksum[0] = sum1;
checksum[1] = sum2;
}
void crcCalculateU16Pair(u8 *start, u8 *end, u16 *checksum)
{
u8 *ptr;
u32 salt = 0;
u64 seed = 0x8f809f473108b3c1;
u32 sum1 = 0;
u32 sum2 = 0;
for (ptr = start; ptr < end; ptr++, salt += 7) {
seed += *ptr << (salt & 0x0f);
sum1 ^= rngRotateSeed(&seed);
}
for (ptr = end - 1; ptr >= start; ptr--, salt += 3) {
seed += *ptr << (salt & 0x0f);
sum2 ^= rngRotateSeed(&seed);
}
checksum[0] = sum1 & 0xffff;
checksum[1] = sum2 & 0xffff;
}
@@ -8,50 +8,6 @@
u32 var8007e3c0 = 0xab8d9f77;
u32 var8007e3c4 = 0x81280783;
void crcCalculateU32Pair(u8 *start, u8 *end, u32 *checksum)
{
u8 *ptr;
u32 salt = 0;
u64 seed = 0x8f809f473108b3c1;
u32 sum1 = 0;
u32 sum2 = 0;
for (ptr = start; ptr < end; ptr++, salt += 7) {
seed += *ptr << (salt & 0x0f);
sum1 ^= rngRotateSeed(&seed);
}
for (ptr = end - 1; ptr >= start; ptr--, salt += 3) {
seed += *ptr << (salt & 0x0f);
sum2 ^= rngRotateSeed(&seed);
}
checksum[0] = sum1;
checksum[1] = sum2;
}
void crcCalculateU16Pair(u8 *start, u8 *end, u16 *checksum)
{
u8 *ptr;
u32 salt = 0;
u64 seed = 0x8f809f473108b3c1;
u32 sum1 = 0;
u32 sum2 = 0;
for (ptr = start; ptr < end; ptr++, salt += 7) {
seed += *ptr << (salt & 0x0f);
sum1 ^= rngRotateSeed(&seed);
}
for (ptr = end - 1; ptr >= start; ptr--, salt += 3) {
seed += *ptr << (salt & 0x0f);
sum2 ^= rngRotateSeed(&seed);
}
checksum[0] = sum1 & 0xffff;
checksum[1] = sum2 & 0xffff;
}
GLOBAL_ASM(
glabel func0f1291b0
/* f1291b0: 3c048008 */ lui $a0,%hi(var8007e3c0)
+1 -1
View File
@@ -2,7 +2,7 @@
#include "constants.h"
#include "game/camdraw.h"
#include "game/game_0f09f0.h"
#include "game/game_128f30.h"
#include "game/crc.h"
#include "game/gamefile.h"
#include "game/pak/pak.h"
#include "game/utils.h"
+1 -1
View File
@@ -33,7 +33,7 @@
#include "game/game_0f09f0.h"
#include "game/inventory/inventory.h"
#include "game/game_127910.h"
#include "game/game_128f30.h"
#include "game/game_1291b0.h"
#include "game/game_129210.h"
#include "game/explosions/explosions.h"
#include "game/smoke/smoke.h"
@@ -1,12 +1,10 @@
#ifndef IN_GAME_GAME_128F30_H
#define IN_GAME_GAME_128F30_H
#ifndef IN_GAME_CRC_H
#define IN_GAME_CRC_H
#include <ultra64.h>
#include "data.h"
#include "types.h"
void crcCalculateU32Pair(u8 *start, u8 *end, u32 *checksum);
void crcCalculateU16Pair(u8 *start, u8 *end, u16 *checksum);
u32 func0f1291b0(void);
u32 func0f1291f8(void);
#endif
+10
View File
@@ -0,0 +1,10 @@
#ifndef IN_GAME_GAME_1291B0_H
#define IN_GAME_GAME_1291B0_H
#include <ultra64.h>
#include "data.h"
#include "types.h"
u32 func0f1291b0(void);
u32 func0f1291f8(void);
#endif