mirror of
https://github.com/zeldaret/oot
synced 2026-08-19 13:53:51 -04:00
Use __builtin_offsetof for non IDO builds (#1140)
* Add offsetof macro * Change old uses of OFFSETOF with offsetof
This commit is contained in:
+7
-7
@@ -74,13 +74,13 @@ typedef struct {
|
||||
#define SLOT_SIZE (sizeof(SaveContext) + 0x28)
|
||||
#define CHECKSUM_SIZE (sizeof(Save) / 2)
|
||||
|
||||
#define DEATHS OFFSETOF(SaveContext, deaths)
|
||||
#define NAME OFFSETOF(SaveContext, playerName)
|
||||
#define N64DD OFFSETOF(SaveContext, n64ddFlag)
|
||||
#define HEALTH_CAP OFFSETOF(SaveContext, healthCapacity)
|
||||
#define QUEST OFFSETOF(SaveContext, inventory.questItems)
|
||||
#define DEFENSE OFFSETOF(SaveContext, inventory.defenseHearts)
|
||||
#define HEALTH OFFSETOF(SaveContext, health)
|
||||
#define DEATHS offsetof(SaveContext, deaths)
|
||||
#define NAME offsetof(SaveContext, playerName)
|
||||
#define N64DD offsetof(SaveContext, n64ddFlag)
|
||||
#define HEALTH_CAP offsetof(SaveContext, healthCapacity)
|
||||
#define QUEST offsetof(SaveContext, inventory.questItems)
|
||||
#define DEFENSE offsetof(SaveContext, inventory.defenseHearts)
|
||||
#define HEALTH offsetof(SaveContext, health)
|
||||
|
||||
#define SLOT_OFFSET(index) (SRAM_HEADER_SIZE + 0x10 + (index * SLOT_SIZE))
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
#ifndef _FILE_CHOOSE_H_
|
||||
#define _FILE_CHOOSE_H_
|
||||
|
||||
#include "libc/stddef.h"
|
||||
#include "ultra64.h"
|
||||
#include "global.h"
|
||||
#include "vt.h"
|
||||
|
||||
|
||||
#define GET_NEWF(sramCtx, slotNum, index) (sramCtx->readBuff[gSramSlotOffsets[slotNum] + OFFSETOF(SaveContext, newf[index])])
|
||||
#define GET_NEWF(sramCtx, slotNum, index) (sramCtx->readBuff[gSramSlotOffsets[slotNum] + offsetof(SaveContext, newf[index])])
|
||||
|
||||
#define SLOT_OCCUPIED(sramCtx, slotNum) \
|
||||
((GET_NEWF(sramCtx, slotNum, 0) == 'Z') || \
|
||||
|
||||
Reference in New Issue
Block a user