Introduce the JabyEngine namespace to all files
This commit is contained in:
parent
52be17a891
commit
9d97cf746d
|
@ -2,7 +2,8 @@
|
||||||
#define __JABYENGINE_BITS_HPP__
|
#define __JABYENGINE_BITS_HPP__
|
||||||
#include "../jabyengine_defines.h"
|
#include "../jabyengine_defines.h"
|
||||||
|
|
||||||
namespace bit {
|
namespace JabyEngine {
|
||||||
|
namespace bit {
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static constexpr T set(T raw_value, size_t bit) {
|
static constexpr T set(T raw_value, size_t bit) {
|
||||||
return (raw_value | (1 << bit));
|
return (raw_value | (1 << bit));
|
||||||
|
@ -49,6 +50,7 @@ namespace bit {
|
||||||
static constexpr S cast(T value) {
|
static constexpr S cast(T value) {
|
||||||
return *reinterpret_cast<S*>(&value);
|
return *reinterpret_cast<S*>(&value);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define __start_end_bit2_start_length(start_bit, end_bit) start_bit, (end_bit - start_bit + 1)
|
#define __start_end_bit2_start_length(start_bit, end_bit) start_bit, (end_bit - start_bit + 1)
|
||||||
|
|
|
@ -2,15 +2,16 @@
|
||||||
#define __JABYENGINE_COMPLEX_BITMAP_HPP__
|
#define __JABYENGINE_COMPLEX_BITMAP_HPP__
|
||||||
#include "bits.hpp"
|
#include "bits.hpp"
|
||||||
|
|
||||||
struct ClearBitValue {
|
namespace JabyEngine {
|
||||||
|
struct ClearBitValue {
|
||||||
size_t bit;
|
size_t bit;
|
||||||
|
|
||||||
constexpr ClearBitValue(size_t bit) : bit(bit) {
|
constexpr ClearBitValue(size_t bit) : bit(bit) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct Bit {
|
struct Bit {
|
||||||
typedef T ValueType;
|
typedef T ValueType;
|
||||||
|
|
||||||
size_t value;
|
size_t value;
|
||||||
|
@ -25,17 +26,17 @@ struct Bit {
|
||||||
constexpr ClearBitValue operator!() const {
|
constexpr ClearBitValue operator!() const {
|
||||||
return ClearBitValue(this->value);
|
return ClearBitValue(this->value);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct BitRangeValue {
|
struct BitRangeValue {
|
||||||
T value;
|
T value;
|
||||||
size_t begin;
|
size_t begin;
|
||||||
size_t length;
|
size_t length;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct BitRange {
|
struct BitRange {
|
||||||
typedef T ValueType;
|
typedef T ValueType;
|
||||||
|
|
||||||
size_t begin;
|
size_t begin;
|
||||||
|
@ -48,19 +49,19 @@ struct BitRange {
|
||||||
constexpr BitRangeValue<T> with(T value) const {
|
constexpr BitRangeValue<T> with(T value) const {
|
||||||
return {value, this->begin, this->length};
|
return {value, this->begin, this->length};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static constexpr __always_inline BitRangeValue<T> operator<<(const BitRange<T>& range, T value) {
|
static constexpr __always_inline BitRangeValue<T> operator<<(const BitRange<T>& range, T value) {
|
||||||
return BitRangeValue{value, range.begin, range.length};
|
return BitRangeValue{value, range.begin, range.length};
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class ComplexBitMap {
|
class ComplexBitMap {
|
||||||
public:
|
public:
|
||||||
T raw;
|
T raw;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template<typename S>
|
template<typename S>
|
||||||
constexpr __always_inline ComplexBitMap<T>& set_va(const S& value) {
|
constexpr __always_inline ComplexBitMap<T>& set_va(const S& value) {
|
||||||
return this->set(value);
|
return this->set(value);
|
||||||
|
@ -71,7 +72,7 @@ private:
|
||||||
return this->set_va(value).set_va(args...);
|
return this->set_va(value).set_va(args...);
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
template<typename...ARGS>
|
template<typename...ARGS>
|
||||||
static constexpr __always_inline ComplexBitMap<T> with(ARGS...args) {
|
static constexpr __always_inline ComplexBitMap<T> with(ARGS...args) {
|
||||||
return ComplexBitMap().set_va(args...);
|
return ComplexBitMap().set_va(args...);
|
||||||
|
@ -190,6 +191,7 @@ public:
|
||||||
this->clear_bit(value.bit);
|
this->clear_bit(value.bit);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
#endif //!__JABYENGINE_COMPLEX_BITMAP_HPP__
|
#endif //!__JABYENGINE_COMPLEX_BITMAP_HPP__
|
|
@ -3,7 +3,8 @@
|
||||||
#include "../cd_file_types.hpp"
|
#include "../cd_file_types.hpp"
|
||||||
#include "file_processor.hpp"
|
#include "file_processor.hpp"
|
||||||
|
|
||||||
namespace CDFileProcessor {
|
namespace JabyEngine {
|
||||||
|
namespace CDFileProcessor {
|
||||||
class State {
|
class State {
|
||||||
private:
|
private:
|
||||||
FileProcessor::State file_processor_state;
|
FileProcessor::State file_processor_state;
|
||||||
|
@ -27,6 +28,7 @@ namespace CDFileProcessor {
|
||||||
//while(state.process());???
|
//while(state.process());???
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This will be used as the file processor but will work on cd types
|
// This will be used as the file processor but will work on cd types
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
#define __JABYENGINE_FILE_PROCESSOR_HPP__
|
#define __JABYENGINE_FILE_PROCESSOR_HPP__
|
||||||
#include "../file_types.hpp"
|
#include "../file_types.hpp"
|
||||||
|
|
||||||
namespace FileProcessor {
|
namespace JabyEngine {
|
||||||
|
namespace FileProcessor {
|
||||||
class State {
|
class State {
|
||||||
private:
|
private:
|
||||||
struct Reserved {
|
struct Reserved {
|
||||||
|
@ -46,6 +47,6 @@ namespace FileProcessor {
|
||||||
};
|
};
|
||||||
|
|
||||||
State create(const uint32_t* data_adr, const SimpleTIM& file);
|
State create(const uint32_t* data_adr, const SimpleTIM& file);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // !__JABYENGINE_FILE_PROCESSOR_HPP__
|
#endif // !__JABYENGINE_FILE_PROCESSOR_HPP__
|
|
@ -3,12 +3,13 @@
|
||||||
#include "../Overlay/overlay.hpp"
|
#include "../Overlay/overlay.hpp"
|
||||||
#include "file_types.hpp"
|
#include "file_types.hpp"
|
||||||
|
|
||||||
enum struct CDFileType : uint8_t {
|
namespace JabyEngine {
|
||||||
|
enum struct CDFileType : uint8_t {
|
||||||
SimpleTIM = 0,
|
SimpleTIM = 0,
|
||||||
Custom
|
Custom
|
||||||
};
|
};
|
||||||
|
|
||||||
struct __no_align CDFile {
|
struct __no_align CDFile {
|
||||||
union __no_align Payload {
|
union __no_align Payload {
|
||||||
uint32_t empty;
|
uint32_t empty;
|
||||||
SimpleTIM simple_tim;
|
SimpleTIM simple_tim;
|
||||||
|
@ -17,11 +18,12 @@ struct __no_align CDFile {
|
||||||
uint8_t rel_lba_idx;
|
uint8_t rel_lba_idx;
|
||||||
CDFileType type;
|
CDFileType type;
|
||||||
Payload payload;
|
Payload payload;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace CDFileBuilder {
|
namespace CDFileBuilder {
|
||||||
static constexpr CDFile simple_tim(uint8_t rel_lba_idx, SimpleTIM simple_tim) {
|
static constexpr CDFile simple_tim(uint8_t rel_lba_idx, SimpleTIM simple_tim) {
|
||||||
return CDFile{.rel_lba_idx = rel_lba_idx, .type = CDFileType::SimpleTIM, .payload = {.simple_tim = simple_tim}};
|
return CDFile{.rel_lba_idx = rel_lba_idx, .type = CDFileType::SimpleTIM, .payload = {.simple_tim = simple_tim}};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif //!__JABYENGINE_CD_FILE_TYPES_HPP__
|
#endif //!__JABYENGINE_CD_FILE_TYPES_HPP__
|
|
@ -3,7 +3,8 @@
|
||||||
#include "../Auxiliary/complex_bitmap.hpp"
|
#include "../Auxiliary/complex_bitmap.hpp"
|
||||||
#include "../jabyengine_defines.h"
|
#include "../jabyengine_defines.h"
|
||||||
|
|
||||||
struct __no_align SimpleTIM : private ComplexBitMap<uint32_t> {
|
namespace JabyEngine {
|
||||||
|
struct __no_align SimpleTIM : private ComplexBitMap<uint32_t> {
|
||||||
static constexpr auto TextureX = BitRange<uint32_t>(0, 8);
|
static constexpr auto TextureX = BitRange<uint32_t>(0, 8);
|
||||||
static constexpr auto TextureY = BitRange<uint32_t>(9, 16);
|
static constexpr auto TextureY = BitRange<uint32_t>(9, 16);
|
||||||
static constexpr auto ClutX = BitRange<uint32_t>(17, 22);
|
static constexpr auto ClutX = BitRange<uint32_t>(17, 22);
|
||||||
|
@ -31,7 +32,6 @@ struct __no_align SimpleTIM : private ComplexBitMap<uint32_t> {
|
||||||
constexpr uint16_t getClutY() const {
|
constexpr uint16_t getClutY() const {
|
||||||
return ComplexBitMap<uint32_t>::get_value(SimpleTIM::ClutY);
|
return ComplexBitMap<uint32_t>::get_value(SimpleTIM::ClutY);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
#endif // !__JABYENGINE_FILE_TYPES_HPP__
|
#endif // !__JABYENGINE_FILE_TYPES_HPP__
|
|
@ -10,7 +10,8 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace GPU {
|
namespace JabyEngine {
|
||||||
|
namespace GPU {
|
||||||
namespace Display {
|
namespace Display {
|
||||||
#ifdef JABYENGINE_PAL
|
#ifdef JABYENGINE_PAL
|
||||||
static constexpr size_t Width = 320;
|
static constexpr size_t Width = 320;
|
||||||
|
@ -36,6 +37,6 @@ namespace GPU {
|
||||||
void set_offset(uint16_t x, uint16_t y);
|
void set_offset(uint16_t x, uint16_t y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //!__JABYENGINE_GPU_HPP__
|
#endif //!__JABYENGINE_GPU_HPP__
|
|
@ -3,7 +3,8 @@
|
||||||
#include "../jabyengine_defines.h"
|
#include "../jabyengine_defines.h"
|
||||||
#include "../Auxiliary/complex_bitmap.hpp"
|
#include "../Auxiliary/complex_bitmap.hpp"
|
||||||
|
|
||||||
namespace GPU {
|
namespace JabyEngine {
|
||||||
|
namespace GPU {
|
||||||
struct Color24 {
|
struct Color24 {
|
||||||
uint8_t red = 0;
|
uint8_t red = 0;
|
||||||
uint8_t green = 0;
|
uint8_t green = 0;
|
||||||
|
@ -97,6 +98,6 @@ namespace GPU {
|
||||||
|
|
||||||
typedef Size<int16_t> SizeI16;
|
typedef Size<int16_t> SizeI16;
|
||||||
typedef Size<uint16_t> SizeU16;
|
typedef Size<uint16_t> SizeU16;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //!__JABYENGINE_GPU_TYPES_HPP__
|
#endif //!__JABYENGINE_GPU_TYPES_HPP__
|
|
@ -2,14 +2,16 @@
|
||||||
#define __JABYENGINE_OVERLAY__HPP__
|
#define __JABYENGINE_OVERLAY__HPP__
|
||||||
#include "../../stdint.h"
|
#include "../../stdint.h"
|
||||||
|
|
||||||
struct __attribute__((packed)) OverlayHeader {
|
namespace JabyEngine {
|
||||||
|
struct __attribute__((packed)) OverlayHeader {
|
||||||
void (*execute)();
|
void (*execute)();
|
||||||
uint16_t lba_size;
|
uint16_t lba_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Maybe encode attributes like "isLZ4" into size parameter
|
// Maybe encode attributes like "isLZ4" into size parameter
|
||||||
struct __attribute__((packed)) OverlayLBA {
|
struct __attribute__((packed)) OverlayLBA {
|
||||||
uint16_t lba;
|
uint16_t lba;
|
||||||
uint16_t size;
|
uint16_t size;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
#endif //!__JABYENGINE_OVERLAY__HPP__
|
#endif //!__JABYENGINE_OVERLAY__HPP__
|
|
@ -3,12 +3,12 @@
|
||||||
|
|
||||||
// No include here because this header should be included in a namespace and we don't want multiple namespace definitions of OverlayHeader and OverlayLBA
|
// No include here because this header should be included in a namespace and we don't want multiple namespace definitions of OverlayHeader and OverlayLBA
|
||||||
|
|
||||||
extern const OverlayHeader overlay_header;
|
extern const JabyEngine::OverlayHeader overlay_header;
|
||||||
extern const OverlayLBA overlay_lba[];
|
extern const JabyEngine::OverlayLBA overlay_lba[];
|
||||||
|
|
||||||
#define __declare_overlay_header(function, enum_struct) \
|
#define __declare_overlay_header(function, enum_struct) \
|
||||||
[[gnu::used]] \
|
[[gnu::used]] \
|
||||||
const OverlayHeader __section(".header") overlay_header = {.execute = &function, .lba_size = static_cast<uint16_t>(enum_struct::EndOfRequest)}; \
|
const JabyEngine::OverlayHeader __section(".header") overlay_header = {.execute = &function, .lba_size = static_cast<uint16_t>(enum_struct::EndOfRequest)}; \
|
||||||
[[gnu::used]] \
|
[[gnu::used]] \
|
||||||
const OverlayLBA __section(".header.lbas") overlay_lba[static_cast<int>(enum_struct::EndOfRequest)] = {0}
|
const JabyEngine::OverlayLBA __section(".header.lbas") overlay_lba[static_cast<int>(enum_struct::EndOfRequest)] = {0}
|
||||||
#endif //!__JABYENGINE_OVERLAY_DECLARATION__HPP__
|
#endif //!__JABYENGINE_OVERLAY_DECLARATION__HPP__
|
|
@ -2,7 +2,8 @@
|
||||||
#define __JABYENGINE_DMA_IO_HPP__
|
#define __JABYENGINE_DMA_IO_HPP__
|
||||||
#include "ioport.hpp"
|
#include "ioport.hpp"
|
||||||
|
|
||||||
namespace DMA {
|
namespace JabyEngine {
|
||||||
|
namespace DMA {
|
||||||
struct __no_align MADR : public ComplexBitMap<uint32_t> {
|
struct __no_align MADR : public ComplexBitMap<uint32_t> {
|
||||||
__io_port_inherit_complex_bit_map(MADR);
|
__io_port_inherit_complex_bit_map(MADR);
|
||||||
|
|
||||||
|
@ -139,6 +140,6 @@ namespace DMA {
|
||||||
|
|
||||||
__declare_io_port_global(DMAControlRegister, DPCR, 0x1F8010F0);
|
__declare_io_port_global(DMAControlRegister, DPCR, 0x1F8010F0);
|
||||||
__declare_io_port_global(DMAInterruptRegister, DICR, 0x1F8010F4);
|
__declare_io_port_global(DMAInterruptRegister, DICR, 0x1F8010F4);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //!__JABYENGINE_DMA_IO_HPP__
|
#endif //!__JABYENGINE_DMA_IO_HPP__
|
|
@ -3,7 +3,8 @@
|
||||||
#include "ioport.hpp"
|
#include "ioport.hpp"
|
||||||
#include "../../GPU/gpu_types.hpp"
|
#include "../../GPU/gpu_types.hpp"
|
||||||
|
|
||||||
namespace GPU {
|
namespace JabyEngine {
|
||||||
|
namespace GPU {
|
||||||
enum struct SemiTransparency {
|
enum struct SemiTransparency {
|
||||||
B_Half_add_F_Half = 0,
|
B_Half_add_F_Half = 0,
|
||||||
B_add_F = 1,
|
B_add_F = 1,
|
||||||
|
@ -167,6 +168,6 @@ namespace GPU {
|
||||||
|
|
||||||
__declare_io_port_global_const(uint32_t, GPUREAD, 0x1F801810);
|
__declare_io_port_global_const(uint32_t, GPUREAD, 0x1F801810);
|
||||||
__declare_io_port_global_const(GPUStatusRegister, GPUSTAT, 0x1F801814);
|
__declare_io_port_global_const(GPUStatusRegister, GPUSTAT, 0x1F801814);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //!__JABYENGINE_GPU_IO_HPP__
|
#endif //!__JABYENGINE_GPU_IO_HPP__
|
|
@ -2,12 +2,13 @@
|
||||||
#define __JABYENGINE_IOPORT_HPP__
|
#define __JABYENGINE_IOPORT_HPP__
|
||||||
#include "../../Auxiliary/complex_bitmap.hpp"
|
#include "../../Auxiliary/complex_bitmap.hpp"
|
||||||
|
|
||||||
template<typename T>
|
namespace JabyEngine {
|
||||||
class __no_align IOPort {
|
template<typename T>
|
||||||
private:
|
class __no_align IOPort {
|
||||||
|
private:
|
||||||
T value;
|
T value;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//For easy access
|
//For easy access
|
||||||
constexpr T read() const {
|
constexpr T read() const {
|
||||||
return const_cast<volatile IOPort<T>*>(this)->value;
|
return const_cast<volatile IOPort<T>*>(this)->value;
|
||||||
|
@ -24,9 +25,9 @@ public:
|
||||||
constexpr const volatile T& ref() const {
|
constexpr const volatile T& ref() const {
|
||||||
return const_cast<volatile IOPort<T>*>(this)->value;
|
return const_cast<volatile IOPort<T>*>(this)->value;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct __no_align ubus32_t {
|
struct __no_align ubus32_t {
|
||||||
ComplexBitMap<uint16_t> low;
|
ComplexBitMap<uint16_t> low;
|
||||||
ComplexBitMap<uint16_t> high;
|
ComplexBitMap<uint16_t> high;
|
||||||
|
|
||||||
|
@ -53,19 +54,19 @@ struct __no_align ubus32_t {
|
||||||
this->low.raw = (value & 0xFFFF);
|
this->low.raw = (value & 0xFFFF);
|
||||||
this->high.raw = (value >> 16);
|
this->high.raw = (value >> 16);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static constexpr uintptr_t IO_Base_Mask = 0xF0000000;
|
static constexpr uintptr_t IO_Base_Mask = 0xF0000000;
|
||||||
static constexpr uintptr_t IO_Base_Adr = 0x10000000;
|
static constexpr uintptr_t IO_Base_Adr = 0x10000000;
|
||||||
|
|
||||||
#define __io_port_adr(adr) (IO_Base_Adr + (adr & ~IO_Base_Mask))
|
#define __io_port_adr(adr) (IO_Base_Adr + (adr & ~IO_Base_Mask))
|
||||||
#define __declare_io_port_global_raw(cv, type, name, adr) static __always_inline cv auto& name = *reinterpret_cast<IOPort<type>*>(__io_port_adr(adr))
|
#define __declare_io_port_global_raw(cv, type, name, adr) static __always_inline cv auto& name = *reinterpret_cast<IOPort<type>*>(__io_port_adr(adr))
|
||||||
|
|
||||||
#define __declare_io_port_global(type, name, adr) __declare_io_port_global_raw(, type, name, adr)
|
#define __declare_io_port_global(type, name, adr) __declare_io_port_global_raw(, type, name, adr)
|
||||||
#define __declare_io_port_global_const(type, name, adr) __declare_io_port_global_raw(const, type, name, adr)
|
#define __declare_io_port_global_const(type, name, adr) __declare_io_port_global_raw(const, type, name, adr)
|
||||||
#define __declare_io_port_global_array(type, name, adr, size) static __always_inline auto& name = reinterpret_cast<type(&)[size]>(*reinterpret_cast<type*>((IO_Base_Adr + (adr & ~IO_Base_Mask))))
|
#define __declare_io_port_global_array(type, name, adr, size) static __always_inline auto& name = reinterpret_cast<type(&)[size]>(*reinterpret_cast<type*>((IO_Base_Adr + (adr & ~IO_Base_Mask))))
|
||||||
#define __declare_io_port_global_struct(type, name, adr) static __always_inline auto& name = *reinterpret_cast<type*>(__io_port_adr(adr))
|
#define __declare_io_port_global_struct(type, name, adr) static __always_inline auto& name = *reinterpret_cast<type*>(__io_port_adr(adr))
|
||||||
|
|
||||||
#define __io_port_inherit_complex_bit_map(name) \
|
#define __io_port_inherit_complex_bit_map(name) \
|
||||||
constexpr __always_inline name() = default; \
|
constexpr __always_inline name() = default; \
|
||||||
constexpr __always_inline name(ComplexBitMap value) : ComplexBitMap(value) { \
|
constexpr __always_inline name(ComplexBitMap value) : ComplexBitMap(value) { \
|
||||||
} \
|
} \
|
||||||
|
@ -77,5 +78,5 @@ static constexpr uintptr_t IO_Base_Adr = 0x10000000;
|
||||||
constexpr void __always_inline operator=(ComplexBitMap<T> value) volatile { \
|
constexpr void __always_inline operator=(ComplexBitMap<T> value) volatile { \
|
||||||
this->raw = value.raw; \
|
this->raw = value.raw; \
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif //!__JABYENGINE_IOPORT_HPP__
|
#endif //!__JABYENGINE_IOPORT_HPP__
|
|
@ -2,7 +2,8 @@
|
||||||
#define __JABYENGINE_SPU_IO_HPP__
|
#define __JABYENGINE_SPU_IO_HPP__
|
||||||
#include "ioport.hpp"
|
#include "ioport.hpp"
|
||||||
|
|
||||||
namespace SPU {
|
namespace JabyEngine {
|
||||||
|
namespace SPU {
|
||||||
enum struct Mode {
|
enum struct Mode {
|
||||||
Linear = 0,
|
Linear = 0,
|
||||||
Exponential = 1,
|
Exponential = 1,
|
||||||
|
@ -164,6 +165,6 @@ namespace SPU {
|
||||||
__declare_io_port_global(EchoOn, EON, 0x1F801D98);
|
__declare_io_port_global(EchoOn, EON, 0x1F801D98);
|
||||||
|
|
||||||
__declare_io_port_global_array(Voice, Voices, 0x1F801C00, VoiceCount);
|
__declare_io_port_global_array(Voice, Voices, 0x1F801C00, VoiceCount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //!__JABYENGINE_SPU_IO_HPP__
|
#endif //!__JABYENGINE_SPU_IO_HPP__
|
|
@ -2,6 +2,7 @@
|
||||||
#define __JABYENGINE_SCRATCHPAD_HPP__
|
#define __JABYENGINE_SCRATCHPAD_HPP__
|
||||||
#include "../jabyengine_defines.h"
|
#include "../jabyengine_defines.h"
|
||||||
|
|
||||||
static __always_inline auto& ScratchPad = reinterpret_cast<uint8_t(&)[1024]>(*reinterpret_cast<uint8_t*>(0x1F800000));
|
namespace JabyEngine {
|
||||||
|
static __always_inline auto& ScratchPad = reinterpret_cast<uint8_t(&)[1024]>(*reinterpret_cast<uint8_t*>(0x1F800000));
|
||||||
|
}
|
||||||
#endif //!__JABYENGINE_SCRATCHPAD_HPP__
|
#endif //!__JABYENGINE_SCRATCHPAD_HPP__
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef __JABYENGINE__H__
|
#ifndef __JABYENGINE__HPP__
|
||||||
#define __JABYENGINE__H__
|
#define __JABYENGINE__HPP__
|
||||||
#include "../stdint.h"
|
#include "../stdint.h"
|
||||||
|
|
||||||
namespace JabyEngine {
|
namespace JabyEngine {
|
||||||
|
@ -33,4 +33,4 @@ namespace JabyEngine {
|
||||||
typedef NextRoutine::MainRoutine MainRoutine;
|
typedef NextRoutine::MainRoutine MainRoutine;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //!__JABYENGINE__H__
|
#endif //!__JABYENGINE__HPP__
|
|
@ -1,23 +1,24 @@
|
||||||
#ifndef BOOT_LOADER_HPP
|
#ifndef BOOT_LOADER_HPP
|
||||||
#define BOOT_LOADER_HPP
|
#define BOOT_LOADER_HPP
|
||||||
#include <PSX/jabyengine.h>
|
#include <PSX/jabyengine.hpp>
|
||||||
|
|
||||||
namespace GPU {
|
namespace JabyEngine {
|
||||||
|
namespace GPU {
|
||||||
void display_logo();
|
void display_logo();
|
||||||
void setup();
|
void setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace SPU {
|
namespace SPU {
|
||||||
void stop_voices();
|
void stop_voices();
|
||||||
void setup();
|
void setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Setup {
|
namespace Setup {
|
||||||
JabyEngine::NextRoutine start();
|
JabyEngine::NextRoutine start();
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace BootFile {
|
namespace BootFile {
|
||||||
JabyEngine::NextRoutine setup();
|
JabyEngine::NextRoutine setup();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //!BOOT_LOADER_HPP
|
#endif //!BOOT_LOADER_HPP
|
|
@ -2,7 +2,8 @@
|
||||||
#define __JABYENGINE_CD_HPP__
|
#define __JABYENGINE_CD_HPP__
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
namespace CD {
|
namespace JabyEngine {
|
||||||
|
namespace CD {
|
||||||
namespace CircularBuffer {
|
namespace CircularBuffer {
|
||||||
extern uint8_t* write_ptr;
|
extern uint8_t* write_ptr;
|
||||||
extern uint8_t* read_ptr;
|
extern uint8_t* read_ptr;
|
||||||
|
@ -13,6 +14,6 @@ namespace CD {
|
||||||
};
|
};
|
||||||
|
|
||||||
extern State state;
|
extern State state;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //!__JABYENGINE_CD_HPP__
|
#endif //!__JABYENGINE_CD_HPP__
|
|
@ -4,7 +4,8 @@
|
||||||
#include <PSX/System/IOPorts/dma_io.hpp>
|
#include <PSX/System/IOPorts/dma_io.hpp>
|
||||||
#include <PSX/System/IOPorts/gpu_io.hpp>
|
#include <PSX/System/IOPorts/gpu_io.hpp>
|
||||||
|
|
||||||
namespace GPU {
|
namespace JabyEngine {
|
||||||
|
namespace GPU {
|
||||||
namespace Screen {
|
namespace Screen {
|
||||||
struct Mode {
|
struct Mode {
|
||||||
enum struct TVEncoding {
|
enum struct TVEncoding {
|
||||||
|
@ -78,7 +79,7 @@ namespace GPU {
|
||||||
|
|
||||||
namespace DMA {
|
namespace DMA {
|
||||||
static void wait() {
|
static void wait() {
|
||||||
while(::DMA::GPU.channel_ctrl.ref().is(::DMA::CHCHR::Busy));
|
while(::JabyEngine::DMA::GPU.channel_ctrl.ref().is(::JabyEngine::DMA::CHCHR::Busy));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void end() {
|
static void end() {
|
||||||
|
@ -93,7 +94,7 @@ namespace GPU {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_src(uintptr_t adr) {
|
static void set_src(uintptr_t adr) {
|
||||||
::DMA::GPU.adr.ref().set_value(static_cast<uint32_t>(adr), ::DMA::MADR::MemoryAdr);
|
::JabyEngine::DMA::GPU.adr.ref().set_value(static_cast<uint32_t>(adr), ::JabyEngine::DMA::MADR::MemoryAdr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_dst(const PositionU16& position, const SizeU16& size) {
|
static void set_dst(const PositionU16& position, const SizeU16& size) {
|
||||||
|
@ -105,10 +106,11 @@ namespace GPU {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void start(uint16_t blockCount, uint16_t wordsPerBlock = 0x10) {
|
static void start(uint16_t blockCount, uint16_t wordsPerBlock = 0x10) {
|
||||||
typedef ::DMA::BCR::SyncMode1 SyncMode1;
|
typedef ::JabyEngine::DMA::BCR::SyncMode1 SyncMode1;
|
||||||
|
|
||||||
::DMA::GPU.block_ctrl.write(SyncMode1::with(SyncMode1::BlockSize.with(wordsPerBlock), SyncMode1::BlockAmount.with(blockCount)));
|
::JabyEngine::DMA::GPU.block_ctrl.write(SyncMode1::with(SyncMode1::BlockSize.with(wordsPerBlock), SyncMode1::BlockAmount.with(blockCount)));
|
||||||
::DMA::GPU.channel_ctrl.write(::DMA::CHCHR::StartGPUReceive());
|
::JabyEngine::DMA::GPU.channel_ctrl.write(::JabyEngine::DMA::CHCHR::StartGPUReceive());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,11 @@
|
||||||
|
|
||||||
extern JabyEngine::NextRoutine main();
|
extern JabyEngine::NextRoutine main();
|
||||||
|
|
||||||
namespace BootFile {
|
namespace JabyEngine {
|
||||||
|
namespace BootFile {
|
||||||
JabyEngine::NextRoutine setup() {
|
JabyEngine::NextRoutine setup() {
|
||||||
printf("Running main!\n");
|
printf("Running main!\n");
|
||||||
return JabyEngine::NextRoutine::from(main);
|
return JabyEngine::NextRoutine::from(main);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,9 +1,11 @@
|
||||||
#include "../../../include/BootLoader/boot_loader.hpp"
|
#include "../../../include/BootLoader/boot_loader.hpp"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
namespace BootFile {
|
namespace JabyEngine {
|
||||||
|
namespace BootFile {
|
||||||
JabyEngine::NextRoutine setup() {
|
JabyEngine::NextRoutine setup() {
|
||||||
printf("Overlay boot not implemented!\n");
|
printf("Overlay boot not implemented!\n");
|
||||||
return JabyEngine::NextRoutine::null();
|
return JabyEngine::NextRoutine::null();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -8,7 +8,8 @@
|
||||||
#include "splash_image_ntsc_boot.hpp"
|
#include "splash_image_ntsc_boot.hpp"
|
||||||
#endif //JABYENGINE_PAL
|
#endif //JABYENGINE_PAL
|
||||||
|
|
||||||
namespace GPU {
|
namespace JabyEngine {
|
||||||
|
namespace GPU {
|
||||||
void display_logo() {
|
void display_logo() {
|
||||||
// Upload SplashScreen picture
|
// Upload SplashScreen picture
|
||||||
auto state = FileProcessor::create(reinterpret_cast<const uint32_t*>(SplashScreen), SimpleTIM(32, 0, 0, 0));
|
auto state = FileProcessor::create(reinterpret_cast<const uint32_t*>(SplashScreen), SimpleTIM(32, 0, 0, 0));
|
||||||
|
@ -25,4 +26,5 @@ namespace GPU {
|
||||||
GPU::wait_ready_for_CMD();
|
GPU::wait_ready_for_CMD();
|
||||||
quick_fill_fast(Color24::Black(), PositionU16(32, 0), SizeU16(Display::Width, Display::Height));
|
quick_fill_fast(Color24::Black(), PositionU16(32, 0), SizeU16(Display::Width, Display::Height));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -2,7 +2,10 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
namespace SPU {
|
namespace JabyEngine {
|
||||||
|
namespace SPU {
|
||||||
|
using namespace JabyEngine;
|
||||||
|
|
||||||
static void clear_main_volume() {
|
static void clear_main_volume() {
|
||||||
static constexpr auto StartVol = SweepVolume::with(SweepVolume::VolumeEnable, SweepVolume::Volume.with(I16_MAX >> 2));
|
static constexpr auto StartVol = SweepVolume::with(SweepVolume::VolumeEnable, SweepVolume::Volume.with(I16_MAX >> 2));
|
||||||
|
|
||||||
|
@ -92,4 +95,5 @@ namespace SPU {
|
||||||
setup_data_transfer_control();
|
setup_data_transfer_control();
|
||||||
setup_control_register();
|
setup_control_register();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -2,7 +2,8 @@
|
||||||
#include <PSX/System/IOPorts/dMa_io.hpp>
|
#include <PSX/System/IOPorts/dMa_io.hpp>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
namespace Setup {
|
namespace JabyEngine {
|
||||||
|
namespace Setup {
|
||||||
static void enable_DMA() {
|
static void enable_DMA() {
|
||||||
DMA::DPCR.write(DMA::DPCR.read() | DMA::DMAControlRegister::SPUEnable | DMA::DMAControlRegister::GPUEnable);
|
DMA::DPCR.write(DMA::DPCR.read() | DMA::DMAControlRegister::SPUEnable | DMA::DMAControlRegister::GPUEnable);
|
||||||
}
|
}
|
||||||
|
@ -19,4 +20,5 @@ namespace Setup {
|
||||||
SPU::setup();
|
SPU::setup();
|
||||||
return BootFile::setup();
|
return BootFile::setup();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -3,7 +3,8 @@
|
||||||
#define private public
|
#define private public
|
||||||
#include <PSX/File/Processor/file_processor.hpp>
|
#include <PSX/File/Processor/file_processor.hpp>
|
||||||
|
|
||||||
namespace FileProcessor {
|
namespace JabyEngine {
|
||||||
|
namespace FileProcessor {
|
||||||
namespace Helper {
|
namespace Helper {
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static void simple_read(T& dst, State::Configuration& config) {
|
static void simple_read(T& dst, State::Configuration& config) {
|
||||||
|
@ -21,6 +22,6 @@ namespace FileProcessor {
|
||||||
return process_routine(config, state);
|
return process_routine(config, state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // !__JABYENGINE_INTERNAL_SIMPLE_HELPER_HPP__
|
#endif // !__JABYENGINE_INTERNAL_SIMPLE_HELPER_HPP__
|
|
@ -3,7 +3,8 @@
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
namespace FileProcessor {
|
namespace JabyEngine {
|
||||||
|
namespace FileProcessor {
|
||||||
using GPU::PositionU16;
|
using GPU::PositionU16;
|
||||||
using GPU::SizeU16;
|
using GPU::SizeU16;
|
||||||
|
|
||||||
|
@ -126,6 +127,6 @@ namespace FileProcessor {
|
||||||
State create(const uint32_t* data_adr, const SimpleTIM& file) {
|
State create(const uint32_t* data_adr, const SimpleTIM& file) {
|
||||||
return State::from(SimpleTIMState(file), data_adr, parse_header);
|
return State::from(SimpleTIMState(file), data_adr, parse_header);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef private
|
#undef private
|
|
@ -1,6 +1,7 @@
|
||||||
#include "../include/GPU/gpu.hpp"
|
#include "../include/GPU/gpu.hpp"
|
||||||
|
|
||||||
namespace GPU {
|
namespace JabyEngine {
|
||||||
|
namespace GPU {
|
||||||
namespace Screen {
|
namespace Screen {
|
||||||
uint8_t CurrentDisplayAreaID = 1; //< Setup will call exchange and set it to 0
|
uint8_t CurrentDisplayAreaID = 1; //< Setup will call exchange and set it to 0
|
||||||
|
|
||||||
|
@ -33,4 +34,5 @@ namespace GPU {
|
||||||
GP1.write(Command::GP1::DisplayArea(0, (Display::Height*CurrentDisplayAreaID)));
|
GP1.write(Command::GP1::DisplayArea(0, (Display::Height*CurrentDisplayAreaID)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue