Files
kaizen/src/common.hpp
T
2026-03-23 12:11:07 +01:00

46 lines
1.0 KiB
C++

#pragma once
#include <types.hpp>
#include <ErrorData.hpp>
#define FORCE_INLINE inline __attribute__((always_inline))
constexpr u32 N64_CPU_FREQ = 93750000;
#ifdef KAIZEN_USE_HASH
#include <resources/version.hpp>
#define KAIZEN_VERSION_STR KAIZEN_GIT_COMMIT_HASH
#else
#define KAIZEN_VERSION_YEAR 2026
#define KAIZEN_VERSION_MONTH 1
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)
#define KAIZEN_VERSION_STR STR(KAIZEN_VERSION_YEAR) "." STR(KAIZEN_VERSION_MONTH)
#endif
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