Disable auto crlf
This commit is contained in:
@@ -1,57 +1,57 @@
|
||||
#pragma once
|
||||
#include "../../Auxiliary/types.hpp"
|
||||
#include "../file_types.hpp"
|
||||
|
||||
namespace JabyEngine {
|
||||
namespace FileProcessor {
|
||||
class State {
|
||||
__friends:
|
||||
struct Reserved {
|
||||
uint32_t reserved[4];
|
||||
};
|
||||
|
||||
struct Configuration;
|
||||
|
||||
template<typename T>
|
||||
using GenericProcessRoutine = Progress (*)(Configuration&, T&);
|
||||
|
||||
typedef GenericProcessRoutine<Reserved> ProcessRoutine;
|
||||
|
||||
struct Configuration {
|
||||
ProcessRoutine process_routine = nullptr;
|
||||
const uint8_t* data_adr = nullptr;
|
||||
size_t data_bytes = 0ull;
|
||||
|
||||
template<typename T>
|
||||
static __always_inline Configuration from(GenericProcessRoutine<T> process_routine, const uint8_t* data_adr) {
|
||||
return {reinterpret_cast<ProcessRoutine>(process_routine), data_adr};
|
||||
}
|
||||
|
||||
constexpr void processed(size_t bytes) {
|
||||
this->data_adr += bytes;
|
||||
this->data_bytes -= bytes;
|
||||
}
|
||||
};
|
||||
|
||||
__friends:
|
||||
Configuration config;
|
||||
Reserved reserved;
|
||||
|
||||
template<typename T>
|
||||
static __always_inline State from(const T& reserved, const uint8_t* data_adr, GenericProcessRoutine<T> process_routine) {
|
||||
return {Configuration::from(process_routine, data_adr), *reinterpret_cast<const Reserved*>(&reserved)};
|
||||
static_assert(sizeof(T) <= sizeof(Reserved));
|
||||
}
|
||||
|
||||
public:
|
||||
Progress process(size_t bytes_ready) {
|
||||
this->config.data_bytes += bytes_ready;
|
||||
return (*this->config.process_routine)(this->config, this->reserved);
|
||||
}
|
||||
};
|
||||
|
||||
// The nothing state
|
||||
State create(const uint32_t* data_adr, const Nothing& nothing);
|
||||
State create(const uint32_t* data_adr, const SimpleTIM& file);
|
||||
}
|
||||
#pragma once
|
||||
#include "../../Auxiliary/types.hpp"
|
||||
#include "../file_types.hpp"
|
||||
|
||||
namespace JabyEngine {
|
||||
namespace FileProcessor {
|
||||
class State {
|
||||
__friends:
|
||||
struct Reserved {
|
||||
uint32_t reserved[4];
|
||||
};
|
||||
|
||||
struct Configuration;
|
||||
|
||||
template<typename T>
|
||||
using GenericProcessRoutine = Progress (*)(Configuration&, T&);
|
||||
|
||||
typedef GenericProcessRoutine<Reserved> ProcessRoutine;
|
||||
|
||||
struct Configuration {
|
||||
ProcessRoutine process_routine = nullptr;
|
||||
const uint8_t* data_adr = nullptr;
|
||||
size_t data_bytes = 0ull;
|
||||
|
||||
template<typename T>
|
||||
static __always_inline Configuration from(GenericProcessRoutine<T> process_routine, const uint8_t* data_adr) {
|
||||
return {reinterpret_cast<ProcessRoutine>(process_routine), data_adr};
|
||||
}
|
||||
|
||||
constexpr void processed(size_t bytes) {
|
||||
this->data_adr += bytes;
|
||||
this->data_bytes -= bytes;
|
||||
}
|
||||
};
|
||||
|
||||
__friends:
|
||||
Configuration config;
|
||||
Reserved reserved;
|
||||
|
||||
template<typename T>
|
||||
static __always_inline State from(const T& reserved, const uint8_t* data_adr, GenericProcessRoutine<T> process_routine) {
|
||||
return {Configuration::from(process_routine, data_adr), *reinterpret_cast<const Reserved*>(&reserved)};
|
||||
static_assert(sizeof(T) <= sizeof(Reserved));
|
||||
}
|
||||
|
||||
public:
|
||||
Progress process(size_t bytes_ready) {
|
||||
this->config.data_bytes += bytes_ready;
|
||||
return (*this->config.process_routine)(this->config, this->reserved);
|
||||
}
|
||||
};
|
||||
|
||||
// The nothing state
|
||||
State create(const uint32_t* data_adr, const Nothing& nothing);
|
||||
State create(const uint32_t* data_adr, const SimpleTIM& file);
|
||||
}
|
||||
}
|
@@ -1,167 +1,167 @@
|
||||
#pragma once
|
||||
#include "../jabyengine_defines.h"
|
||||
|
||||
/*
|
||||
R0 zr Constant Zero
|
||||
R1 at Reserved for the assembler
|
||||
R2-R3 v0-v1 Values for results and expression evaluation
|
||||
R4-R7 a0-a3 Arguments
|
||||
R8-R15 t0-t7 Temporaries (not preserved across call)
|
||||
R16-R23 s0-s7 Saved (preserved across call)
|
||||
R24-R25 t8-t9 More temporaries (not preserved across call)
|
||||
R26-R27 k0-k1 Reserved for OS Kernel
|
||||
R28 gp Global Pointer
|
||||
R29 sp Stack Pointer
|
||||
R30 fp Frame Pointer
|
||||
R31 ra Return address (set by function call)
|
||||
*/
|
||||
|
||||
namespace JabyEngine {
|
||||
namespace SysCall {
|
||||
static constexpr const uint32_t Table_A = 0xA0;
|
||||
static constexpr const uint32_t Table_B = 0xB0;
|
||||
static constexpr const uint32_t Table_C = 0xC0;
|
||||
|
||||
enum struct Priority {
|
||||
CdromDmaIrq = 0,
|
||||
CdromIoIrq = 0,
|
||||
SyscallException = 0,
|
||||
|
||||
CardSpecificIrq = 1,
|
||||
VblankIrq = 1,
|
||||
Timer2Irq = 1,
|
||||
Timer1Irq = 1,
|
||||
Timer0Irq = 1,
|
||||
|
||||
PadCardIrq = 2,
|
||||
|
||||
DefInt = 3
|
||||
};
|
||||
|
||||
enum InterruptVerifierResult {
|
||||
SkipHandler = 0,
|
||||
ExecuteHandler = 1
|
||||
};
|
||||
|
||||
typedef InterruptVerifierResult (*InterruptVerifier)();
|
||||
typedef uint32_t (*InterruptHandler)(uint32_t);
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct InterrupCallback {
|
||||
struct InterrupCallback* next;
|
||||
InterruptHandler handler_function;
|
||||
InterruptVerifier verifier_function;
|
||||
uint32_t notUsed;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
#define __syscall_function_cast(table, ...) reinterpret_cast<__VA_ARGS__>(table)
|
||||
|
||||
static __always_inline void* memcpy(void *dst, const void *src, size_t len) {
|
||||
register uint32_t FuncID asm("t1") = 0x2A;
|
||||
__asm__ volatile("" : "=r"(FuncID) : "r"(FuncID));
|
||||
|
||||
return __syscall_function_cast(Table_A, void*(*)(void*, const void*, size_t))(dst, src, len);
|
||||
}
|
||||
|
||||
static __always_inline void InitPad(uint8_t *portA, uint32_t portASize, uint8_t *portB, uint32_t portBSize) {
|
||||
register uint32_t FuncID asm("t1") = 0x12;
|
||||
__asm__ volatile("" : "=r"(FuncID) : "r"(FuncID));
|
||||
|
||||
__syscall_function_cast(Table_B, void(*)(uint8_t*, uint32_t, uint8_t*, uint32_t))(portA, portASize, portB, portBSize);
|
||||
}
|
||||
|
||||
static __always_inline void StartPad() {
|
||||
register uint32_t FuncID asm("t1") = 0x13;
|
||||
__asm__ volatile("" : "=r"(FuncID) : "r"(FuncID));
|
||||
|
||||
__syscall_function_cast(Table_B, void(*)())();
|
||||
}
|
||||
|
||||
static __always_inline void StopPad() {
|
||||
register uint32_t FuncID asm("t1") = 0x14;
|
||||
__asm__ volatile("" : "=r"(FuncID) : "r"(FuncID));
|
||||
|
||||
__syscall_function_cast(Table_B, void(*)())();
|
||||
}
|
||||
|
||||
static __always_inline void ChangeClearPad(int32_t _reserved) {
|
||||
register uint32_t FuncID asm("t1") = 0x5B;
|
||||
__asm__ volatile("" : "=r"(FuncID) : "r"(FuncID));
|
||||
|
||||
__syscall_function_cast(Table_B, void(*)(int32_t))(_reserved);
|
||||
}
|
||||
|
||||
static __always_inline void [[noreturn]] ReturnFromException() {
|
||||
register uint32_t FuncID asm("t1") = 0x17;
|
||||
__asm__ volatile("" : "=r"(FuncID) : "r"(FuncID));
|
||||
|
||||
__syscall_function_cast(Table_B, void(*)())();
|
||||
}
|
||||
|
||||
static __always_inline int SysEnqIntRP(Priority prio, InterrupCallback* interElm) {
|
||||
register uint32_t FuncID asm("t1") = 0x02;
|
||||
__asm__ volatile("" : "=r"(FuncID) : "r"(FuncID));
|
||||
|
||||
return __syscall_function_cast(Table_C, int(*)(Priority prio, InterrupCallback *interElm))(prio, interElm);
|
||||
}
|
||||
|
||||
static __always_inline int SysDeqIntRP(Priority prio, InterrupCallback *interElm) {
|
||||
register uint32_t FuncID asm("t1") = 0x03;
|
||||
__asm__ volatile("" : "=r"(FuncID) : "r"(FuncID));
|
||||
|
||||
return __syscall_function_cast(Table_C, int(*)(Priority prio, InterrupCallback *interElm))(prio, interElm);
|
||||
}
|
||||
|
||||
static __always_inline uint32_t EnterCriticalSection() {
|
||||
register uint32_t FuncID asm("a0") = 0x01;
|
||||
register uint32_t returnValue asm("v0");
|
||||
|
||||
__asm__ volatile("syscall" : "=r"(FuncID), "=r"(returnValue) : "r"(FuncID) : "at", "v1", "a1", "a2", "a3", "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", "t8", "t9", "memory");
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
static __always_inline void ExitCriticalSection() {
|
||||
register uint32_t FuncID asm("a0") = 0x02;
|
||||
|
||||
__asm__ volatile("syscall" : "=r"(FuncID) : "r"(FuncID) : "at", "v0", "v1", "a1", "a2", "a3", "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", "t8", "t9", "memory");
|
||||
}
|
||||
|
||||
static __always_inline void DeliverEvent(uint32_t classId, uint32_t spec) {
|
||||
register uint32_t FuncID asm("t1") = 0x07;
|
||||
|
||||
__asm__ volatile("" : "=r"(FuncID) : "r"(FuncID));
|
||||
__syscall_function_cast(Table_B, void (*)(uint32_t, uint32_t))(classId, spec);
|
||||
}
|
||||
|
||||
static __always_inline uint32_t OpenEvent(uint32_t classId, uint32_t spec, uint32_t mode, void (*handler)()) {
|
||||
register uint32_t FuncID asm("t1") = 0x08;
|
||||
|
||||
__asm__ volatile("" : "=r"(FuncID) : "r"(FuncID));
|
||||
return __syscall_function_cast(Table_B, uint32_t(*)(uint32_t, uint32_t, uint32_t, void(*)()))(classId, spec, mode, handler);
|
||||
}
|
||||
|
||||
static __always_inline int CloseEvent(uint32_t event) {
|
||||
register uint32_t FuncID asm("t1") = 0x09;
|
||||
|
||||
__asm__ volatile("" : "=r"(FuncID) : "r"(FuncID));
|
||||
return __syscall_function_cast(Table_B, uint32_t(*)(uint32_t))(event);
|
||||
}
|
||||
|
||||
static __always_inline int TestEvent(uint32_t event) {
|
||||
register uint32_t FuncID asm("t1") = 0x0B;
|
||||
|
||||
__asm__ volatile("" : "=r"(FuncID) : "r"(FuncID));
|
||||
return __syscall_function_cast(Table_B, int (*)(uint32_t))(event);
|
||||
}
|
||||
|
||||
static __always_inline int EnableEvent(uint32_t event) {
|
||||
register uint32_t FuncID asm("t1") = 0x0C;
|
||||
|
||||
__asm__ volatile("" : "=r"(FuncID) : "r"(FuncID));
|
||||
return __syscall_function_cast(Table_B, int (*)(uint32_t))(event);
|
||||
}
|
||||
|
||||
void printf(const char* txt, ...);
|
||||
}
|
||||
#pragma once
|
||||
#include "../jabyengine_defines.h"
|
||||
|
||||
/*
|
||||
R0 zr Constant Zero
|
||||
R1 at Reserved for the assembler
|
||||
R2-R3 v0-v1 Values for results and expression evaluation
|
||||
R4-R7 a0-a3 Arguments
|
||||
R8-R15 t0-t7 Temporaries (not preserved across call)
|
||||
R16-R23 s0-s7 Saved (preserved across call)
|
||||
R24-R25 t8-t9 More temporaries (not preserved across call)
|
||||
R26-R27 k0-k1 Reserved for OS Kernel
|
||||
R28 gp Global Pointer
|
||||
R29 sp Stack Pointer
|
||||
R30 fp Frame Pointer
|
||||
R31 ra Return address (set by function call)
|
||||
*/
|
||||
|
||||
namespace JabyEngine {
|
||||
namespace SysCall {
|
||||
static constexpr const uint32_t Table_A = 0xA0;
|
||||
static constexpr const uint32_t Table_B = 0xB0;
|
||||
static constexpr const uint32_t Table_C = 0xC0;
|
||||
|
||||
enum struct Priority {
|
||||
CdromDmaIrq = 0,
|
||||
CdromIoIrq = 0,
|
||||
SyscallException = 0,
|
||||
|
||||
CardSpecificIrq = 1,
|
||||
VblankIrq = 1,
|
||||
Timer2Irq = 1,
|
||||
Timer1Irq = 1,
|
||||
Timer0Irq = 1,
|
||||
|
||||
PadCardIrq = 2,
|
||||
|
||||
DefInt = 3
|
||||
};
|
||||
|
||||
enum InterruptVerifierResult {
|
||||
SkipHandler = 0,
|
||||
ExecuteHandler = 1
|
||||
};
|
||||
|
||||
typedef InterruptVerifierResult (*InterruptVerifier)();
|
||||
typedef uint32_t (*InterruptHandler)(uint32_t);
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct InterrupCallback {
|
||||
struct InterrupCallback* next;
|
||||
InterruptHandler handler_function;
|
||||
InterruptVerifier verifier_function;
|
||||
uint32_t notUsed;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
#define __syscall_function_cast(table, ...) reinterpret_cast<__VA_ARGS__>(table)
|
||||
|
||||
static __always_inline void* memcpy(void *dst, const void *src, size_t len) {
|
||||
register uint32_t FuncID asm("t1") = 0x2A;
|
||||
__asm__ volatile("" : "=r"(FuncID) : "r"(FuncID));
|
||||
|
||||
return __syscall_function_cast(Table_A, void*(*)(void*, const void*, size_t))(dst, src, len);
|
||||
}
|
||||
|
||||
static __always_inline void InitPad(uint8_t *portA, uint32_t portASize, uint8_t *portB, uint32_t portBSize) {
|
||||
register uint32_t FuncID asm("t1") = 0x12;
|
||||
__asm__ volatile("" : "=r"(FuncID) : "r"(FuncID));
|
||||
|
||||
__syscall_function_cast(Table_B, void(*)(uint8_t*, uint32_t, uint8_t*, uint32_t))(portA, portASize, portB, portBSize);
|
||||
}
|
||||
|
||||
static __always_inline void StartPad() {
|
||||
register uint32_t FuncID asm("t1") = 0x13;
|
||||
__asm__ volatile("" : "=r"(FuncID) : "r"(FuncID));
|
||||
|
||||
__syscall_function_cast(Table_B, void(*)())();
|
||||
}
|
||||
|
||||
static __always_inline void StopPad() {
|
||||
register uint32_t FuncID asm("t1") = 0x14;
|
||||
__asm__ volatile("" : "=r"(FuncID) : "r"(FuncID));
|
||||
|
||||
__syscall_function_cast(Table_B, void(*)())();
|
||||
}
|
||||
|
||||
static __always_inline void ChangeClearPad(int32_t _reserved) {
|
||||
register uint32_t FuncID asm("t1") = 0x5B;
|
||||
__asm__ volatile("" : "=r"(FuncID) : "r"(FuncID));
|
||||
|
||||
__syscall_function_cast(Table_B, void(*)(int32_t))(_reserved);
|
||||
}
|
||||
|
||||
static __always_inline void [[noreturn]] ReturnFromException() {
|
||||
register uint32_t FuncID asm("t1") = 0x17;
|
||||
__asm__ volatile("" : "=r"(FuncID) : "r"(FuncID));
|
||||
|
||||
__syscall_function_cast(Table_B, void(*)())();
|
||||
}
|
||||
|
||||
static __always_inline int SysEnqIntRP(Priority prio, InterrupCallback* interElm) {
|
||||
register uint32_t FuncID asm("t1") = 0x02;
|
||||
__asm__ volatile("" : "=r"(FuncID) : "r"(FuncID));
|
||||
|
||||
return __syscall_function_cast(Table_C, int(*)(Priority prio, InterrupCallback *interElm))(prio, interElm);
|
||||
}
|
||||
|
||||
static __always_inline int SysDeqIntRP(Priority prio, InterrupCallback *interElm) {
|
||||
register uint32_t FuncID asm("t1") = 0x03;
|
||||
__asm__ volatile("" : "=r"(FuncID) : "r"(FuncID));
|
||||
|
||||
return __syscall_function_cast(Table_C, int(*)(Priority prio, InterrupCallback *interElm))(prio, interElm);
|
||||
}
|
||||
|
||||
static __always_inline uint32_t EnterCriticalSection() {
|
||||
register uint32_t FuncID asm("a0") = 0x01;
|
||||
register uint32_t returnValue asm("v0");
|
||||
|
||||
__asm__ volatile("syscall" : "=r"(FuncID), "=r"(returnValue) : "r"(FuncID) : "at", "v1", "a1", "a2", "a3", "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", "t8", "t9", "memory");
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
static __always_inline void ExitCriticalSection() {
|
||||
register uint32_t FuncID asm("a0") = 0x02;
|
||||
|
||||
__asm__ volatile("syscall" : "=r"(FuncID) : "r"(FuncID) : "at", "v0", "v1", "a1", "a2", "a3", "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", "t8", "t9", "memory");
|
||||
}
|
||||
|
||||
static __always_inline void DeliverEvent(uint32_t classId, uint32_t spec) {
|
||||
register uint32_t FuncID asm("t1") = 0x07;
|
||||
|
||||
__asm__ volatile("" : "=r"(FuncID) : "r"(FuncID));
|
||||
__syscall_function_cast(Table_B, void (*)(uint32_t, uint32_t))(classId, spec);
|
||||
}
|
||||
|
||||
static __always_inline uint32_t OpenEvent(uint32_t classId, uint32_t spec, uint32_t mode, void (*handler)()) {
|
||||
register uint32_t FuncID asm("t1") = 0x08;
|
||||
|
||||
__asm__ volatile("" : "=r"(FuncID) : "r"(FuncID));
|
||||
return __syscall_function_cast(Table_B, uint32_t(*)(uint32_t, uint32_t, uint32_t, void(*)()))(classId, spec, mode, handler);
|
||||
}
|
||||
|
||||
static __always_inline int CloseEvent(uint32_t event) {
|
||||
register uint32_t FuncID asm("t1") = 0x09;
|
||||
|
||||
__asm__ volatile("" : "=r"(FuncID) : "r"(FuncID));
|
||||
return __syscall_function_cast(Table_B, uint32_t(*)(uint32_t))(event);
|
||||
}
|
||||
|
||||
static __always_inline int TestEvent(uint32_t event) {
|
||||
register uint32_t FuncID asm("t1") = 0x0B;
|
||||
|
||||
__asm__ volatile("" : "=r"(FuncID) : "r"(FuncID));
|
||||
return __syscall_function_cast(Table_B, int (*)(uint32_t))(event);
|
||||
}
|
||||
|
||||
static __always_inline int EnableEvent(uint32_t event) {
|
||||
register uint32_t FuncID asm("t1") = 0x0C;
|
||||
|
||||
__asm__ volatile("" : "=r"(FuncID) : "r"(FuncID));
|
||||
return __syscall_function_cast(Table_B, int (*)(uint32_t))(event);
|
||||
}
|
||||
|
||||
void printf(const char* txt, ...);
|
||||
}
|
||||
}
|
@@ -1,59 +1,59 @@
|
||||
#ifndef __JABYENGINE_FRAME_TIMER_HPP__
|
||||
#define __JABYENGINE_FRAME_TIMER_HPP__
|
||||
#include "frame_time_helper.hpp"
|
||||
#include <stdint.h>
|
||||
|
||||
namespace JabyEngine {
|
||||
class MasterTime {
|
||||
__friends:
|
||||
static uint32_t value;
|
||||
|
||||
public:
|
||||
static uint32_t read() {
|
||||
return reinterpret_cast<volatile uint32_t&>(MasterTime::value);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static T read_as() {
|
||||
return static_cast<T>(MasterTime::read());
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class SimpleTimer {
|
||||
protected:
|
||||
T value = 0;
|
||||
|
||||
public:
|
||||
constexpr SimpleTimer() = default;
|
||||
|
||||
bool is_expired_for(T time) const {
|
||||
return static_cast<T>((MasterTime::read_as<T>() - this->value)) >= time;
|
||||
}
|
||||
|
||||
void reset() {
|
||||
this->value = MasterTime::read_as<T>();
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class IntervalTimer : public SimpleTimer<T> {
|
||||
private:
|
||||
T interval = 0;
|
||||
|
||||
public:
|
||||
constexpr IntervalTimer() = default;
|
||||
constexpr IntervalTimer(T interval) : SimpleTimer<T>(), interval(interval) {
|
||||
}
|
||||
|
||||
void set_interval(T interval) {
|
||||
this->interval = interval;
|
||||
}
|
||||
|
||||
bool is_expired() const {
|
||||
return SimpleTimer<T>::is_expired_for(this->interval);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#ifndef __JABYENGINE_FRAME_TIMER_HPP__
|
||||
#define __JABYENGINE_FRAME_TIMER_HPP__
|
||||
#include "frame_time_helper.hpp"
|
||||
#include <stdint.h>
|
||||
|
||||
namespace JabyEngine {
|
||||
class MasterTime {
|
||||
__friends:
|
||||
static uint32_t value;
|
||||
|
||||
public:
|
||||
static uint32_t read() {
|
||||
return reinterpret_cast<volatile uint32_t&>(MasterTime::value);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static T read_as() {
|
||||
return static_cast<T>(MasterTime::read());
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class SimpleTimer {
|
||||
protected:
|
||||
T value = 0;
|
||||
|
||||
public:
|
||||
constexpr SimpleTimer() = default;
|
||||
|
||||
bool is_expired_for(T time) const {
|
||||
return static_cast<T>((MasterTime::read_as<T>() - this->value)) >= time;
|
||||
}
|
||||
|
||||
void reset() {
|
||||
this->value = MasterTime::read_as<T>();
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class IntervalTimer : public SimpleTimer<T> {
|
||||
private:
|
||||
T interval = 0;
|
||||
|
||||
public:
|
||||
constexpr IntervalTimer() = default;
|
||||
constexpr IntervalTimer(T interval) : SimpleTimer<T>(), interval(interval) {
|
||||
}
|
||||
|
||||
void set_interval(T interval) {
|
||||
this->interval = interval;
|
||||
}
|
||||
|
||||
bool is_expired() const {
|
||||
return SimpleTimer<T>::is_expired_for(this->interval);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif //!__JABYENGINE_FRAME_TIMER_HPP__
|
@@ -1,26 +1,26 @@
|
||||
#ifndef __JABYENGINE_DEFINES__H__
|
||||
#define __JABYENGINE_DEFINES__H__
|
||||
#include "../stddef.h"
|
||||
|
||||
#define __used __attribute__((used))
|
||||
#define __no_align __attribute__((packed))
|
||||
#define __no_inline __attribute__((noinline))
|
||||
#define __no_return __attribute__((noreturn))
|
||||
#define __always_inline __attribute__((always_inline))
|
||||
#define __section(name) __attribute__((section(name)))
|
||||
#define __collect(...) __VA_ARGS__
|
||||
|
||||
#ifndef __friends
|
||||
#define __friends private
|
||||
#endif //!__friends
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define __constexpr constexpr
|
||||
#define START_C_FUNCTIONS extern "C" {
|
||||
#define END_C_FUNCTIONS }
|
||||
#else
|
||||
#define __constexpr
|
||||
#define START_C_FUNCTIONS
|
||||
#define END_C_FUNCTIONS
|
||||
#endif
|
||||
#ifndef __JABYENGINE_DEFINES__H__
|
||||
#define __JABYENGINE_DEFINES__H__
|
||||
#include "../stddef.h"
|
||||
|
||||
#define __used __attribute__((used))
|
||||
#define __no_align __attribute__((packed))
|
||||
#define __no_inline __attribute__((noinline))
|
||||
#define __no_return __attribute__((noreturn))
|
||||
#define __always_inline __attribute__((always_inline))
|
||||
#define __section(name) __attribute__((section(name)))
|
||||
#define __collect(...) __VA_ARGS__
|
||||
|
||||
#ifndef __friends
|
||||
#define __friends private
|
||||
#endif //!__friends
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define __constexpr constexpr
|
||||
#define START_C_FUNCTIONS extern "C" {
|
||||
#define END_C_FUNCTIONS }
|
||||
#else
|
||||
#define __constexpr
|
||||
#define START_C_FUNCTIONS
|
||||
#define END_C_FUNCTIONS
|
||||
#endif
|
||||
#endif //!__JABYENGINE_DEFINES__H__
|
@@ -1,8 +1,8 @@
|
||||
#ifndef __STDIO__H
|
||||
#define __STDIO__H
|
||||
#include "PSX/jabyengine_defines.h"
|
||||
|
||||
START_C_FUNCTIONS
|
||||
int printf(const char* txt, ...) asm("_ZN10JabyEngine7SysCall6printfEPKcz");
|
||||
END_C_FUNCTIONS
|
||||
#ifndef __STDIO__H
|
||||
#define __STDIO__H
|
||||
#include "PSX/jabyengine_defines.h"
|
||||
|
||||
START_C_FUNCTIONS
|
||||
int printf(const char* txt, ...) asm("_ZN10JabyEngine7SysCall6printfEPKcz");
|
||||
END_C_FUNCTIONS
|
||||
#endif //!__STDIO__H
|
Reference in New Issue
Block a user