Files
kaizen/src/common.hpp
2025-09-01 09:47:07 +02:00

38 lines
794 B
C++

#pragma once
#include <bitset>
#include <types.hpp>
#include <ErrorData.hpp>
#define FORCE_INLINE inline __attribute__((always_inline))
constexpr u32 N64_CPU_FREQ = 93750000;
constexpr u16 KAIZEN_VERSION = 0x010;
static FORCE_INLINE constexpr u32 GetCyclesPerFrame(bool pal) {
if (pal) {
return N64_CPU_FREQ / 50;
} else {
return N64_CPU_FREQ / 60;
}
}
static FORCE_INLINE constexpr u32 GetVideoFrequency(bool pal) {
if (pal) {
return 49'656'530;
} else {
return 48'681'812;
}
}
#define HALF_ADDRESS(addr) ((addr) ^ 2)
#define BYTE_ADDRESS(addr) ((addr) ^ 3)
#define ELEMENT_INDEX(i) (7 - (i))
#define BYTE_INDEX(i) (15 - (i))
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
#define ABI_WINDOWS
#else
#define ABI_UNIX
#endif