match some of fraser/cuyler files.

This commit is contained in:
Prakxo
2022-12-21 00:00:29 +01:00
parent a25019b474
commit 26186c33ee
15 changed files with 183 additions and 3 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ __pycache__/
build/
expected/
rel/*/*.s
src/*/*.s
src/*/*/*.s
out/
dump/*
!dump/foresta.rel.sha1
+1
View File
@@ -309,6 +309,7 @@ LOCAL_CFLAGS = [
"-nostdinc",
"-proc gekko",
"-maxerrors 1",
"-Cpp_exceptions off",
"-I-",
f"-i {INCDIR}",
f"-i {PPCDIS_INCDIR}",
+4
View File
@@ -0,0 +1,4 @@
libultra/gfxprint/gfxprint_locate.c:
.text: [0x8005B1EC, 0x8005B210]
libultra/gfxprint/gfxprint_locate8x8.c:
.text: [0x8005B210, 0x8005B238]
+8 -1
View File
@@ -7,4 +7,11 @@ zurumode/zerucheck_key_check.c:
zurumode/zurumode_cleanup.c:
.text: [0x8040efc4, 0x8040f008]
# zurumode/zurumode_update.c:
# .text: [0x8040EDA8 , 0x8040ee74] Has C++ functions but was matched with C?? Won't really bother at the moment with this one.
# .text: [0x8040EDA8 , 0x8040ee74] Has C++ functions but was matched with C?? Won't really bother at the moment with this one.
m_random_field/mRF_MakePerfectBit.c:
.text: [0x8050B1AC, 0x8050B1D4]
m_random_field/mRF_GetRandomStepMode.c:
.text: [0x8050B284, 0x8050B2C0]
m_room_type/mRmTp_FtrItemNo2FtrIdx.c:
.text: [0x803E7878, 0x803E78BC]
+19
View File
@@ -0,0 +1,19 @@
#pragma once
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
#pragma section code_type ".init"
void * memcpy(void * dst, const void * src, size_t n);
void * memset(void * dst, int val, size_t n);
void __fill_mem(void * dst, int val, unsigned long n);
#pragma section code_type
#ifdef __cplusplus
}
#endif
+22
View File
@@ -0,0 +1,22 @@
#ifndef GFXPRINT_H
#define GFXPRINT_H
#include "types.h"
typedef struct gfxprint_obj {
s32 unk0;
struct unknown_struct * unk4;
s16 NewX;
s16 NewY;
u16 PrevX;
u8 PrevY;
u8 unkF;
u8 R;
u8 G;
u8 B;
u8 A;
};
void gfxprint_locate(struct gfxprint_obj*, s32, s32);
#endif
+4
View File
@@ -1,6 +1,10 @@
#ifndef LIBULTRA_H
#define LIBULTRA_H
#include "types.h"
void bcopy(const void *dst, void *src, size_t n);
void bzero(void *ptr, size_t size);
extern s32 osAppNMIBuffer[16];
#endif
+11
View File
@@ -0,0 +1,11 @@
#ifndef RANDOM_FIELD_H
#define RANDOM_FIELD_H
#include "types.h"
#define mRF_PERFECT_BIT 9
int mRF_GetRandom(int val);
#endif
+58
View File
@@ -0,0 +1,58 @@
#ifndef ROOM_TYPE_H
#define ROOM_TYPE_H
#include "types.h"
enum {
FG_ITEM0_TYPE,
FG_FTR0_TYPE,
FG_ITEM1_TYPE,
FG_FTR1_TYPE,
FG_NXGT0_TYPE,
FG_STRUCTURE_TYPE,
FG_PAD6_TYPE,
FG_PAD7_TYPE,
FG_ITEM2_TYPE,
FG_ACTOR_TYPE,
FG_PROPS_TYPE,
FG_PAD11_TYPE,
FG_PAD12_TYPE,
FG_SP_NPC_TYPE,
FG_NPC_TYPE,
FG_DONT_TYPE,
FG_TYPE_NUM
};
// TEMPORARY. Should be generated with .decl files
#define ITEM0_NO_START 0x0000
#define NULL_NO ITEM0_NO_START
#define ITEM0_1_NO_START ITEM0_NO_START + 0x800
#define FTR0_NO_START 0x1000
#define ITEM1_NO_START 0x2000
#define ITEM1_0_NO_START ITEM0_1_NO_START // paper
#define ITEM1_1_NO_START ITEM1_NO_START + 0x100 // money
#define ITEM1_2_NO_START ITEM1_NO_START + 0x200 // tools
#define ITEM1_3_NO_START ITEM1_NO_START + 0x300 // fish
#define ITEM1_4_NO_START ITEM1_NO_START + 0x400 // clothing
#define ITEM1_5_NO_START ITEM1_NO_START + 0x500 // etc
#define ITEM1_6_NO_START ITEM1_NO_START + 0x600 // carpets
#define ITEM1_7_NO_START ITEM1_NO_START + 0x700 // wallpaper
#define ITEM1_8_NO_START ITEM1_NO_START + 0x800 // food
#define ITEM1_9_NO_START ITEM1_NO_START + 0x900 // seeds
#define ITEM1_A_NO_START ITEM1_NO_START + 0xA00 // mini disks
#define ITEM1_B_NO_START ITEM1_NO_START + 0xB00 // diaries
#define ITEM1_C_NO_START ITEM1_NO_START + 0xC00 // tickets
#define ITEM1_D_NO_START ITEM1_NO_START + 0xD00 // insects
#define ITEM1_E_NO_START ITEM1_NO_START + 0xE00 // hukubukuro
#define ITEM1_F_NO_START ITEM1_NO_START + 0xF00 // kabu
#define FTR1_NO_START 0x3000
#define GET_FG_ITEM0_CATEGORY(f) (((f)&0x800) >> 11)
#define GET_FG_ITEM1_CATEGORY(f) (((f)&0xF00) >> 8)
#define GET_FG_TYPE(f) (((f)&0xF000) >> 12)
#endif
+10 -1
View File
@@ -26,6 +26,15 @@ typedef double f64;
typedef volatile f32 vf32;
typedef volatile f64 vf64;
#define NULL ((void*)0)
typedef int BOOL;
typedef unsigned int uintptr_t; // Manually added
// Pointer to unknown, to be determined at a later date.
typedef void* unkptr;
typedef u32 unknown;
#define TRUE 1
#define FALSE 0
#define NULL ((void*)0)
#define nullptr 0
#endif
@@ -0,0 +1,5 @@
#include "random_field.h"
int mRF_GetRandomStepMode(void) {
return mRF_GetRandom(100) < 15;
}
+10
View File
@@ -0,0 +1,10 @@
#include "random_field.h"
int mRF_MakePerfectBit(void) {
int perfect_bit = 0;
int i;
for (i = 0; i < mRF_PERFECT_BIT; i++) {
perfect_bit |= 1 << i;
}
return perfect_bit;
}
+17
View File
@@ -0,0 +1,17 @@
#include "roomtype.h"
#define FTR_NO_2_FTR_IDX(f) ((f) >> 2)
#define NUM_FTR_IN_TYPE (FTR_NO_2_FTR_IDX(0x1000))
#define IS_FTR(f) ((f) == FG_FTR0_TYPE || (f) == FG_FTR1_TYPE)
extern int mRmTp_FtrItemNo2FtrIdx(u16 ftr_no) {
int type = GET_FG_TYPE(ftr_no);
if (IS_FTR(type)) {
if (type == FG_FTR0_TYPE) {
return FTR_NO_2_FTR_IDX(ftr_no - FTR0_NO_START);
}
return FTR_NO_2_FTR_IDX(ftr_no - FTR1_NO_START) + NUM_FTR_IN_TYPE;
}
return NULL_NO;
}
+6
View File
@@ -0,0 +1,6 @@
#include "libultra/gfxprint.h"
void gfxprint_locate(struct gfxprint_obj* gfxprint, s32 x, s32 y) {
gfxprint->NewX = (s16) (gfxprint->PrevX + (x * 4));
gfxprint->NewY = (s16) (gfxprint->PrevY + (y * 4));
}
@@ -0,0 +1,7 @@
#include "libultra/gfxprint.h"
void gfxprint_locate8x8(struct gfxprint_obj* arg0, s32 arg1, s32 arg2) {
s32 x = arg1 << 3;
s32 y = arg2 << 3;
gfxprint_locate(arg0, x, y);
}