Starship/include/macros.h
Alejandro Asenjo Nitti 410a5b017b
fox_versus decompiled, introduce first_diff.py to the project, fixed fox_option NON_MATCHING build (#71)
* fox_versus functions

* more functions

* more input!

* functions so far

* fix bss reordering

* all functions matching

* fix caller addresses

* import data cleanup

* introduce first_diff to the project

* fix wrong type

* second version of bss reordering prevention header

* move versus symbols to variables.h

* BSS importing attempt (failed)
terrain is prepared for another contributor to try

* fix fox_option NON_MATCHING build

* format

* remove static keyword from fox_map data symbols

* IMPORT BSS

* rename fox_versus

* FIX ADDRESSES & SYMBOLS y fox map

* fix more addresses

* more address fixes for fox_map

* all fox_map addresses done

* fix bss build in fox_map, migration pending

* bss reorder failed attempt

* remove unused externs

* remove unnecessary config file

* remove unnecessary entries in settings.json

* comments

* move structs to fox_map header

* put static back in fox_option data

* PR review
2024-01-10 11:55:08 -06:00

23 lines
812 B
C

#ifndef MACROS_H
#define MACROS_H
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240
#define SEGMENTED_TO_VIRTUAL(segment) ((void*)OS_PHYSICAL_TO_K0(gSegments[((uintptr_t)(segment)<<4)>>0x1C]+(((uintptr_t)(segment))&0xFFFFFF)))
#define ARRAY_COUNT(arr) (s32)(sizeof(arr) / sizeof(arr[0]))
#define SIGN_OF(x) (((x) > 0) ? 1 : ((x) == 0) ? 0 : -1)
#define SQ(x) ((x) * (x))
#define VEC3F_SQ(vec) (SQ((vec).x) + SQ((vec).y) + SQ((vec).z))
#define DOT_XYZ(a, b) ((a).x * (b).x + (a).y * (b).y + (a).z * (b).z)
#define USEC_TO_CYCLES(n) (((u64)(n)*(osClockRate/15625LL))/(1000000LL/15625LL))
#define MSEC_TO_CYCLES(n) (USEC_TO_CYCLES((n) * 1000LL))
#define CYCLES_TO_USEC(c) (((u64)(c)*(1000000LL/15625LL))/(osClockRate/15625LL))
#define CYCLES_TO_MSEC(c) ((s32)CYCLES_TO_USEC(c)/1000)
#endif // MACROS_H