decompile rng functions (#25)

This commit is contained in:
camthesaxman 2016-07-25 00:56:03 -05:00 committed by YamaArashi
parent 3acf71df20
commit 8459f924d1
7 changed files with 35477 additions and 35482 deletions

View File

@ -36,7 +36,7 @@ PREPROC := tools/preproc/preproc
C_SRCS := $(wildcard src/*.c)
C_OBJS := $(C_SRCS:%.c=%.o)
ASM_OBJS := asm/crt0.o asm/rom3.o asm/rom4.o asm/rom_8074BAC.o asm/rom5.o \
ASM_OBJS := asm/crt0.o asm/rom3.o asm/rom_8040EB4.o asm/rom4.o asm/rom_8074BAC.o asm/rom5.o \
asm/libgcnmultiboot.o asm/m4a_1.o asm/m4a_3.o asm/libagbsyscall.o
DATA_ASM_OBJS := data/data1.o data/data2.o data/graphics.o data/sound_data.o \

35476
asm/rom3.s

File diff suppressed because it is too large Load Diff

View File

@ -99345,7 +99345,7 @@ _080AB6F2:
_080AB6F8: .4byte 0x03004b20
_080AB6FC: .4byte 0x02019204
_080AB700: .4byte sub_80AB960
_080AB704: .4byte 0x03004818
_080AB704: .4byte gRngValue
_080AB708: .4byte 0x03005d28
thumb_func_end sub_80AB6B4
@ -100742,7 +100742,7 @@ _080AC2B6:
.align 2, 0
_080AC2BC: .4byte 0x03004b20
_080AC2C0: .4byte 0x02019204
_080AC2C4: .4byte 0x03004818
_080AC2C4: .4byte gRngValue
_080AC2C8: .4byte sub_80AC2CC
thumb_func_end sub_80AC284
@ -104063,7 +104063,7 @@ _080ADE2C: .4byte 0x02019260
_080ADE30: .4byte 0x02038680
_080ADE34: .4byte 0x02038695
_080ADE38: .4byte 0x03005d28
_080ADE3C: .4byte 0x03004818
_080ADE3C: .4byte gRngValue
_080ADE40: .4byte 0x020234cc
_080ADE44: .4byte gUnknown_083CB02C
_080ADE48: .4byte 0x0202e908
@ -159120,7 +159120,7 @@ _080C88D8:
bl sub_80C857C
b _080C891E
.align 2, 0
_080C88F8: .4byte 0x03004818
_080C88F8: .4byte gRngValue
_080C88FC:
movs r0, 0
bl sub_80C85AC
@ -159145,7 +159145,7 @@ _080C8924:
pop {r0}
bx r0
.align 2, 0
_080C892C: .4byte 0x03004818
_080C892C: .4byte gRngValue
_080C8930: .4byte 0x03002b80
_080C8934: .4byte 0x03005d28
thumb_func_end sub_80C88AC

35453
asm/rom_8040EB4.s Normal file

File diff suppressed because it is too large Load Diff

View File

@ -8,6 +8,8 @@ gPlayTimeCounterState = 0x300057C;
gLocalTime = 0x3004038;
gRngValue = 0x03004818;
gUnknown_3004820 = 0x3004820;
word_3004858 = 0x3004858;

View File

@ -66,6 +66,8 @@ SECTIONS {
src/link.o(.text);
src/rtc.o(.text);
asm/rom3.o(.text);
src/rng.o(.text);
asm/rom_8040EB4.o(.text);
src/play_time.o(.text);
asm/rom4.o(.text);
src/palette.o(.text);

14
src/rng.c Normal file
View File

@ -0,0 +1,14 @@
#include "global.h"
extern u32 gRngValue;
u16 Random(void)
{
gRngValue = 0x41c64e6d * gRngValue + 0x00006073;
return gRngValue >> 16;
}
void SeedRng(u16 seed)
{
gRngValue = seed;
}