mirror of
https://github.com/pret/pmd-sky.git
synced 2026-09-29 21:57:42 -05:00
Decomped IsItemValid
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
.public HandleSir0Translation
|
||||
.public ITEM_DATA_TABLE_PTRS
|
||||
.public ITEM_TABLES_PTRS_1
|
||||
.public IsItemValid
|
||||
.public LoadFileFromRom
|
||||
.public MONEY_QUANTITY_TABLE
|
||||
.public MemAlloc
|
||||
|
||||
3
asm/include/main_0200E7E8.inc
Normal file
3
asm/include/main_0200E7E8.inc
Normal file
@@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
.public GetExclusiveItemOffsetEnsureValid
|
||||
.public ITEM_DATA_TABLE_PTRS
|
||||
@@ -6,6 +6,7 @@
|
||||
.public ITEM_DATA_TABLE_PTRS
|
||||
.public IsItemValid
|
||||
.public ItemZInit
|
||||
.public SprintfStatic__0200E808_EU
|
||||
.public StringFromId
|
||||
.public _0209808C
|
||||
.public _0209809C
|
||||
|
||||
@@ -2319,39 +2319,3 @@ _0200E7A0:
|
||||
.align 2, 0
|
||||
_0200E7BC: .word 0x00000578
|
||||
arm_func_end GetExclusiveItemOffsetEnsureValid
|
||||
|
||||
arm_func_start IsItemValid
|
||||
IsItemValid: ; 0x0200E7C0
|
||||
ldr r1, _0200E7E4 ; =ITEM_DATA_TABLE_PTRS
|
||||
#ifdef EUROPE
|
||||
ldr r1, [r1]
|
||||
#else
|
||||
ldr r1, [r1, #4]
|
||||
#endif
|
||||
add r0, r1, r0, lsl #4
|
||||
ldrb r0, [r0, #0xe]
|
||||
tst r0, #1
|
||||
movne r0, #1
|
||||
moveq r0, #0
|
||||
and r0, r0, #0xff
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_0200E7E4: .word ITEM_DATA_TABLE_PTRS
|
||||
arm_func_end IsItemValid
|
||||
|
||||
arm_func_start GetExclusiveItemParameter
|
||||
GetExclusiveItemParameter: ; 0x0200E7E8
|
||||
stmdb sp!, {r3, lr}
|
||||
bl GetExclusiveItemOffsetEnsureValid
|
||||
ldr r1, _0200E804 ; =ITEM_DATA_TABLE_PTRS
|
||||
#ifdef EUROPE
|
||||
ldr r1, [r1, #4]
|
||||
#else
|
||||
ldr r1, [r1]
|
||||
#endif
|
||||
add r0, r1, r0, lsl #2
|
||||
ldrsh r0, [r0, #2]
|
||||
ldmia sp!, {r3, pc}
|
||||
.align 2, 0
|
||||
_0200E804: .word ITEM_DATA_TABLE_PTRS
|
||||
arm_func_end GetExclusiveItemParameter
|
||||
|
||||
21
asm/main_0200E7E8.s
Normal file
21
asm/main_0200E7E8.s
Normal file
@@ -0,0 +1,21 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "main_0200E7E8.inc"
|
||||
|
||||
.text
|
||||
|
||||
arm_func_start GetExclusiveItemParameter
|
||||
GetExclusiveItemParameter: ; 0x0200E7E8
|
||||
stmdb sp!, {r3, lr}
|
||||
bl GetExclusiveItemOffsetEnsureValid
|
||||
ldr r1, _0200E804 ; =ITEM_DATA_TABLE_PTRS
|
||||
#ifdef EUROPE
|
||||
ldr r1, [r1, #4]
|
||||
#else
|
||||
ldr r1, [r1]
|
||||
#endif
|
||||
add r0, r1, r0, lsl #2
|
||||
ldrsh r0, [r0, #2]
|
||||
ldmia sp!, {r3, pc}
|
||||
.align 2, 0
|
||||
_0200E804: .word ITEM_DATA_TABLE_PTRS
|
||||
arm_func_end GetExclusiveItemParameter
|
||||
@@ -1,6 +1,14 @@
|
||||
#ifndef PMDSKY_ITEM_H
|
||||
#define PMDSKY_ITEM_H
|
||||
|
||||
#include "util.h"
|
||||
|
||||
#ifdef EUROPE
|
||||
#define ITEM_DATA_TABLE_PTRS_INDEX 0
|
||||
#else
|
||||
#define ITEM_DATA_TABLE_PTRS_INDEX 1
|
||||
#endif
|
||||
|
||||
// Item ID
|
||||
enum item_id {
|
||||
ITEM_NOTHING = 0,
|
||||
@@ -1487,7 +1495,8 @@ struct item_data_entry
|
||||
{
|
||||
/* 0x0 */ u8 *name;
|
||||
/* 0x4 */ enum item_category category;
|
||||
u8 fill8[8];
|
||||
u8 fill5[0xE - 0x5];
|
||||
/* 0xE */ bool8 valid;
|
||||
};
|
||||
|
||||
#endif //PMDSKY_ITEM_H
|
||||
|
||||
10
include/item_util_1.h
Normal file
10
include/item_util_1.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef PMDSKY_ITEM_UTIL_1_H
|
||||
#define PMDSKY_ITEM_UTIL_1_H
|
||||
|
||||
#include "util.h"
|
||||
|
||||
// Checks if an item is valid given its ID.
|
||||
// In particular, checks if the "is valid" flag is set on its item_p.bin entry.
|
||||
bool8 IsItemValid(s16 item_id);
|
||||
|
||||
#endif //PMDSKY_ITEM_UTIL_1_H
|
||||
2
main.lsf
2
main.lsf
@@ -23,6 +23,8 @@ Static main
|
||||
Object asm/main_0200C4CC.o
|
||||
Object src/item_util.o
|
||||
Object asm/main_0200CAFC.o
|
||||
Object src/item_util_1.o
|
||||
Object asm/main_0200E7E8.o
|
||||
Object src/item_util_2.o
|
||||
Object asm/main_0200E864.o
|
||||
Object src/main_0200ECFC.o
|
||||
|
||||
12
src/item_util_1.c
Normal file
12
src/item_util_1.c
Normal file
@@ -0,0 +1,12 @@
|
||||
#include "item_util_1.h"
|
||||
#include "item.h"
|
||||
|
||||
extern struct item_data_entry *ITEM_DATA_TABLE_PTRS[3];
|
||||
|
||||
bool8 IsItemValid(s16 item_id)
|
||||
{
|
||||
if (ITEM_DATA_TABLE_PTRS[ITEM_DATA_TABLE_PTRS_INDEX][item_id].valid & 1)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -1,14 +1,7 @@
|
||||
#include "item_util_2.h"
|
||||
#include "util.h"
|
||||
#include "item_util_1.h"
|
||||
|
||||
extern struct item_data_entry *ITEM_DATA_TABLE_PTRS[3];
|
||||
extern bool8 IsItemValid(s16 item_id);
|
||||
|
||||
#ifdef EUROPE
|
||||
#define ITEM_DATA_TABLE_PTRS_INDEX 0
|
||||
#else
|
||||
#define ITEM_DATA_TABLE_PTRS_INDEX 1
|
||||
#endif
|
||||
|
||||
enum item_category GetItemCategory(s16 item_id)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user