Integrate all the progress into master #6

Merged
jaby merged 595 commits from ToolBox into main 2025-01-01 13:17:44 +00:00
42 changed files with 83 additions and 193 deletions
Showing only changes of commit db1bbec06e - Show all commits

View File

@ -1,5 +1,4 @@
#ifndef __FONT_WRITER_HPP__
#define __FONT_WRITER_HPP__
#pragma once
#include "../assets.hpp"
#include <PSX/GPU/gpu.hpp>
#include <stdint.h>
@ -46,6 +45,4 @@ namespace FontWriter {
Position write(Position pos, const char* text);
};
}
#endif //!__FONT_WRITER_HPP__
}

View File

@ -1,5 +1,4 @@
#ifndef __PACO_HPP__
#define __PACO_HPP__
#pragma once
#include <PSX/File/Processor/cd_file_processor.hpp>
#include <PSX/GPU/gpu.hpp>
#include <PSX/Timer/frame_timer.hpp>
@ -35,6 +34,4 @@ namespace object {
void update();
void render();
};
}
#endif //!__PACO_HPP__
}

View File

@ -1,5 +1,4 @@
#ifndef __ASSETS_HPP__
#define __ASSETS_HPP__
#pragma once
#include <PSX/File/Processor/cd_file_processor.hpp>
namespace Assets {
@ -7,6 +6,4 @@ namespace Assets {
static constexpr auto FontTIM = SimpleTIM(960, 0, 960, 511);
void load_for_main();
}
#endif //!__ASSETS_HPP__
}

View File

@ -1,5 +1,4 @@
#ifndef __JABYENGINE_AUTO_LBA_HPP__
#define __JABYENGINE_AUTO_LBA_HPP__
#pragma once
#include "../Auxiliary/bits.hpp"
namespace JabyEngine {
@ -39,6 +38,4 @@ namespace JabyEngine {
return const_cast<const AutoLBAEntry*>(this)->is_lz4();
}
};
}
#endif //!__JABYENGINE_AUTO_LBA_HPP__
}

View File

@ -1,9 +1,6 @@
#ifndef __JABYENGINE_AUTO_LBA_DECLARATION_HPP__
#define __JABYENGINE_AUTO_LBA_DECLARATION_HPP__
#pragma once
extern const volatile JabyEngine::AutoLBAEntry lba[];
#define __declare_lba_header(enum_struct) \
[[gnu::used]] \
const volatile JabyEngine::AutoLBAEntry __section(".header.lbas") lba[static_cast<int>(enum_struct::EndOfRequest)] = {0}
#endif //!__JABYENGINE_AUTO_LBA_DECLARATION_HPP__

View File

@ -1,5 +1,4 @@
#ifndef __JABYENGINE_ARRAY_RANGE_HPP__
#define __JABYENGINE_ARRAY_RANGE_HPP__
#pragma once
#include "../../stddef.h"
namespace JabyEngine {
@ -39,6 +38,4 @@ namespace JabyEngine {
return this->start[idx];
}
};
}
#endif //!__JABYENGINE_ARRAY_RANGE_HPP__
}

View File

@ -1,5 +1,4 @@
#ifndef __JABYENGINE_BITS_HPP__
#define __JABYENGINE_BITS_HPP__
#pragma once
#include "../jabyengine_defines.h"
#include "types.hpp"
@ -153,5 +152,4 @@ namespace JabyEngine {
}
}
#define __start_end_bit2_start_length(start_bit, end_bit) start_bit, (end_bit - start_bit + 1)
#endif //!__JABYENGINE_BITS_HPP__
#define __start_end_bit2_start_length(start_bit, end_bit) start_bit, (end_bit - start_bit + 1)

View File

@ -1,5 +1,4 @@
#ifndef __JABYENGINE_CIRCULAR_BUFFER_HPP__
#define __JABYENGINE_CIRCULAR_BUFFER_HPP__
#pragma once
#include "array_range.hpp"
namespace JabyEngine {
@ -59,6 +58,4 @@ namespace JabyEngine {
return (this->read_adr != this->write_adr);
}
};
}
#endif //!__JABYENGINE_CIRCULAR_BUFFER_HPP__
}

View File

@ -1,5 +1,4 @@
#ifndef __JABYENGINE_LZ4_DECOMPRESSOR_HPP__
#define __JABYENGINE_LZ4_DECOMPRESSOR_HPP__
#pragma once
#include "../../stddef.h"
#include "array_range.hpp"
#include "types.hpp"
@ -76,6 +75,4 @@ namespace JabyEngine {
Result process(ArrayRange<const uint8_t> data, bool is_last);
};
}
#endif //!__JABYENGINE_LZ4_DECOMPRESSOR_HPP__
}

View File

@ -1,5 +1,4 @@
#ifndef __JABYENGINE_MATH_HELPER_HPP__
#define __JABYENGINE_MATH_HELPER_HPP__
#pragma once
#include "types.hpp"
namespace JabyEngine {
@ -13,6 +12,4 @@ namespace JabyEngine {
const auto [tenth, rest] = div_and_mod(value, static_cast<uint8_t>(10));
return (tenth << 4 | rest);
}
}
#endif //!__JABYENGINE_MATH_HELPER_HPP__
}

View File

@ -1,5 +1,4 @@
#ifndef __JABYENGINE_TYPE_TRAITS_HPP__
#define __JABYENGINE_TYPE_TRAITS_HPP__
#pragma once
namespace JabyEngine {
template <class T, T v>
@ -76,6 +75,4 @@ namespace JabyEngine {
using variadic_force_same = enable_if<conjunction<is_same<T, Ts>...>::value>::type;
// #############################################
}
#endif //! __JABYENGINE_TYPE_TRAITS_HPP__
}

View File

@ -1,5 +1,4 @@
#ifndef __JABYENGINE_TYPES_HPP__
#define __JABYENGINE_TYPES_HPP__
#pragma once
namespace JabyEngine {
template<typename T, typename S>
@ -31,6 +30,4 @@ namespace JabyEngine {
Done,
Error
};
}
#endif //!__JABYENGINE_TYPES_HPP__
}

View File

@ -1,11 +1,8 @@
#ifndef __JABYENGINE_UNALIGNED_READ_HPP__
#define __JABYENGINE_UNALIGNED_READ_HPP__
#pragma once
#include "../../stdint.h"
namespace JabyEngine {
uint16_t unaligned_lhu(const uint8_t* adr) {
return (static_cast<uint16_t>(adr[0]) | static_cast<uint16_t>(adr[1]) << 8);
}
}
#endif //!__JABYENGINE_UNALIGNED_READ_HPP__
}

View File

@ -1,5 +1,4 @@
#ifndef __JABYENGINE_CD_FILE_PROCESSOR_HPP__
#define __JABYENGINE_CD_FILE_PROCESSOR_HPP__
#pragma once
#include "../../AutoLBA/auto_lba.hpp"
#include "../../Auxiliary/circular_buffer.hpp"
#include "../../Auxiliary/lz4_decompressor.hpp"
@ -66,6 +65,4 @@ namespace JabyEngine {
return false;
}
};
}
#endif //!__JABYENGINE_CD_FILE_PROCESSOR_HPP__
}

View File

@ -1,5 +1,4 @@
#ifndef __JABYENGINE_FILE_PROCESSOR_HPP__
#define __JABYENGINE_FILE_PROCESSOR_HPP__
#pragma once
#include "../../Auxiliary/types.hpp"
#include "../file_types.hpp"
@ -55,5 +54,4 @@ namespace JabyEngine {
State create(const uint32_t* data_adr, const Nothing& nothing);
State create(const uint32_t* data_adr, const SimpleTIM& file);
}
}
#endif // !__JABYENGINE_FILE_PROCESSOR_HPP__
}

View File

@ -1,5 +1,4 @@
#ifndef __JABYENGINE_CD_FILE_TYPES_HPP__
#define __JABYENGINE_CD_FILE_TYPES_HPP__
#pragma once
#include "../Overlay/overlay.hpp"
#include "file_types.hpp"
@ -39,5 +38,4 @@ namespace JabyEngine {
return CDFile{.rel_lba_idx = rel_lba_idx, .type = CDFileType::CopyTo, .payload = {.overlay = Overlay{overlay_dst}}};
}
};
}
#endif //!__JABYENGINE_CD_FILE_TYPES_HPP__
}

View File

@ -1,5 +1,4 @@
#ifndef __JABYENGINE_FILE_TYPES_HPP__
#define __JABYENGINE_FILE_TYPES_HPP__
#pragma once
#include "../Auxiliary/bits.hpp"
#include "../GPU/gpu_types.hpp"
#include "../jabyengine_defines.h"
@ -53,5 +52,4 @@ namespace JabyEngine {
#pragma pack(pop)
typedef CopyTo Overlay;
}
#endif // !__JABYENGINE_FILE_TYPES_HPP__
}

View File

@ -1,5 +1,4 @@
#ifndef __JABYENGINE_LINKED_ELEMENTS_HPP__
#define __JABYENGINE_LINKED_ELEMENTS_HPP__
#pragma once
#include "../../Auxiliary/bits.hpp"
namespace JabyEngine {
@ -89,6 +88,4 @@ namespace JabyEngine {
};
}
}
}
#endif // !__JABYENGINE_LINKED_ELEMENTS_HPP__
}

View File

@ -1,5 +1,4 @@
#ifndef __JABYENGINE_PRIMITIVE_GPU_COMMANDS_HPP__
#define __JABYENGINE_PRIMITIVE_GPU_COMMANDS_HPP__
#pragma once
#include "../../System/IOPorts/gpu_io.hpp"
#include "linked_elements.hpp"
#include "primitive_support_types.hpp"
@ -16,6 +15,4 @@ namespace JabyEngine {
}
};
}
}
#endif // !__JABYENGINE_PRIMITIVE_GPU_COMMANDS_HPP__
}

View File

@ -1,5 +1,4 @@
#ifndef __JABYENGINE_PRIMITIVE_LINE_TYPES_HPP__
#define __JABYENGINE_PRIMITIVE_LINE_TYPES_HPP__
#pragma once
#include "linked_elements.hpp"
#include "primitive_support_types.hpp"
@ -107,6 +106,4 @@ namespace JabyEngine {
}
};
}
}
#endif //!__JABYENGINE_PRIMITIVE_LINE_TYPES_HPP__
}

View File

@ -1,5 +1,4 @@
#ifndef __JABYENGINE_PRIMITIVE_POLY_TYPES_HPP__
#define __JABYENGINE_PRIMITIVE_POLY_TYPES_HPP__
#pragma once
#include "linked_elements.hpp"
#include "primitive_support_types.hpp"
@ -366,5 +365,4 @@ namespace JabyEngine {
static_assert(sizeof(POLY_G4) == 32);
static_assert(sizeof(POLY_GT4) == 48);
}
}
#endif // !__JABYENGINE_PRIMITIVE_POLY_TYPES_HPP__
}

View File

@ -1,5 +1,4 @@
#ifndef __JABYENGINE_PRIMITIVE_RECTANGLE_TYPES_HPP__
#define __JABYENGINE_PRIMITIVE_RECTANGLE_TYPES_HPP__
#pragma once
#include "linked_elements.hpp"
#include "primitive_support_types.hpp"
@ -126,6 +125,4 @@ namespace JabyEngine {
}
};
}
}
#endif //!__JABYENGINE_PRIMITIVE_RECTANGLE_TYPES_HPP__
}

View File

@ -1,10 +1,8 @@
#ifndef __JABYENGINE_PRIMITIVE_SUPPORT_TYPES_HPP__
#define __JABYENGINE_PRIMITIVE_SUPPORT_TYPES_HPP__
#pragma once
#include "../../Auxiliary/type_traits.hpp"
#include "../../System/IOPorts/gpu_io.hpp"
#include "../gpu_types.hpp"
namespace JabyEngine {
namespace GPU {
namespace internal {
@ -89,6 +87,4 @@ namespace JabyEngine {
}
};
}
}
#endif //!__JABYENGINE_PRIMITIVE_SUPPORT_TYPES_HPP__
}

View File

@ -1,5 +1,4 @@
#ifndef __JABYENGINE_GPU_HPP__
#define __JABYENGINE_GPU_HPP__
#pragma once
#include "../Auxiliary/type_traits.hpp"
#include "../System/IOPorts/gpu_io.hpp"
#include "gpu_primitives.hpp"
@ -60,5 +59,4 @@ namespace JabyEngine {
uint8_t swap_buffers_vsync(uint8_t syncs, bool clear_screen = true);
}
}
#endif //!__JABYENGINE_GPU_HPP__
}

View File

@ -1,5 +1,4 @@
#ifndef __JABYENGINE_GPU_PRIMITIVES_HPP__
#define __JABYENGINE_GPU_PRIMITIVES_HPP__
#pragma once
#include "../Auxiliary/literals.hpp"
#include "Primitives/primitive_gpu_commands.hpp"
#include "Primitives/primitive_line_types.hpp"
@ -312,6 +311,4 @@ namespace JabyEngine {
return creator_template<GPU::SPRT>(area, page, color);
}
}
}
#endif // !__JABYENGINE_GPU_PRIMITIVES_HPP__
}

View File

@ -1,5 +1,4 @@
#ifndef __JABYENGINE_GPU_TYPES_HPP__
#define __JABYENGINE_GPU_TYPES_HPP__
#pragma once
#include "../Auxiliary/bits.hpp"
#include "../jabyengine_defines.h"
@ -222,5 +221,4 @@ namespace JabyEngine {
}
};
}
}
#endif //!__JABYENGINE_GPU_TYPES_HPP__
}

View File

@ -1,5 +1,4 @@
#ifndef __JABYENGINE_OVERLAY__HPP__
#define __JABYENGINE_OVERLAY__HPP__
#pragma once
#include "../AutoLBA/auto_lba.hpp"
namespace JabyEngine {
@ -7,5 +6,4 @@ namespace JabyEngine {
// Can be used to create dummy values to trick LZ4 into compressing an uncompressed overlay
#define __create_dummy_fill(length) static const uint8_t __section(".keep.dummy") __used DummyFilling[length] = {0x0}
}
#endif //!__JABYENGINE_OVERLAY__HPP__
}

View File

@ -1,10 +1,8 @@
#ifndef __JABYENGINE_OVERLAY_DECLARATION__HPP__
#define __JABYENGINE_OVERLAY_DECLARATION__HPP__
#pragma once
// No include here because this header should be included in a namespace and we don't want multiple namespace definitions of OverlayHeader and OverlayLBA
#include "../AutoLBA/auto_lba_declaration.hpp"
#define __declare_overlay_header(function, enum_struct) \
__declare_lba_header(enum_struct)
#endif //!__JABYENGINE_OVERLAY_DECLARATION__HPP__
__declare_lba_header(enum_struct)

View File

@ -1,5 +1,4 @@
#ifndef __JABYENGINE_CD_IO_HPP__
#define __JABYENGINE_CD_IO_HPP__
#pragma once
#include "ioport.hpp"
namespace JabyEngine {
@ -232,6 +231,4 @@ namespace JabyEngine {
#undef __declare_index_io_port
#undef __declare_index_io_port_const
}
}
#endif //!__JABYENGINE_CD_IO_HPP__
}

View File

@ -1,5 +1,4 @@
#ifndef __JABYENGINE_DMA_IO_HPP__
#define __JABYENGINE_DMA_IO_HPP__
#pragma once
#include "ioport.hpp"
namespace JabyEngine {
@ -151,5 +150,4 @@ namespace JabyEngine {
__declare_io_port(, DPCR, 0x1F8010F0);
__declare_io_port(, DICR, 0x1F8010F4);
}
}
#endif //!__JABYENGINE_DMA_IO_HPP__
}

View File

@ -1,5 +1,4 @@
#ifndef __JABYENGINE_GPU_IO_HPP__
#define __JABYENGINE_GPU_IO_HPP__
#pragma once
#include "ioport.hpp"
#include "../../GPU/gpu_types.hpp"
#include <stdio.h>
@ -223,5 +222,4 @@ namespace JabyEngine {
__declare_io_port(const, GPUREAD, 0x1F801810);
__declare_io_port(const, GPUSTAT, 0x1F801814);
}
}
#endif //!__JABYENGINE_GPU_IO_HPP__
}

View File

@ -1,5 +1,4 @@
#ifndef __JABYENGINE_INTERRUPT_IO_HPP__
#define __JABYENGINE_INTERRUPT_IO_HPP__
#pragma once
#include "ioport.hpp"
namespace JabyEngine {
@ -42,6 +41,4 @@ namespace JabyEngine {
Mask.write(Mask.read().set(irq));
}
};
}
#endif //!__JABYENGINE_INTERRUPT_IO_HPP__
}

View File

@ -1,5 +1,4 @@
#ifndef __JABYENGINE_IOPORT_HPP__
#define __JABYENGINE_IOPORT_HPP__
#pragma once
#include "../../Auxiliary/types.hpp"
#include "../../Auxiliary/bits.hpp"
@ -116,5 +115,4 @@ namespace JabyEngine {
#define __declare_io_port_w_type(cv, type, name, adr) __declare_value_at(cv, ::JabyEngine::IOPort<type>, name, adr)
#define __declare_io_port(cv, name, adr) __declare_io_port_w_type(cv, struct name, name, adr)
#define __declare_io_port_array(cv, name, size, adr) __declare_array_at(cv, struct name, name, size, adr)
}
#endif //!__JABYENGINE_IOPORT_HPP__
}

View File

@ -1,5 +1,4 @@
#ifndef __JABYENGINE_MEMORY_IO_HPP__
#define __JABYENGINE_MEMORY_IO_HPP__
#pragma once
#include "ioport.hpp"
namespace JabyEngine {
@ -19,6 +18,4 @@ namespace JabyEngine {
__declare_io_port(, COM_DELAY, 0x1F801020);
__declare_io_port(, CD_DELAY, 0x1F801018);
}
}
#endif //!__JABYENGINE_MEMORY_IO_HPP__
}

View File

@ -1,5 +1,4 @@
#ifndef __JABYENGINE_SPU_IO_HPP__
#define __JABYENGINE_SPU_IO_HPP__
#pragma once
#include "ioport.hpp"
namespace JabyEngine {
@ -165,5 +164,4 @@ namespace JabyEngine {
__declare_io_port_array(, Voice, VoiceCount, 0x1F801C00);
}
}
#endif //!__JABYENGINE_SPU_IO_HPP__
}

View File

@ -1,5 +1,4 @@
#ifndef __JABYENGINE_TIMER_IO_HPP__
#define __JABYENGINE_TIMER_IO_HPP__
#pragma once
#include "ioport.hpp"
namespace JabyEngine {
@ -111,6 +110,4 @@ namespace JabyEngine {
__declare_value_at(, struct Counter1, Counter1, counter_base_adr(1));
__declare_value_at(, struct Counter2, Counter2, counter_base_adr(2));
}
}
#endif //!__JABYENGINE_TIMER_IO_HPP__
}

View File

@ -1,8 +1,6 @@
#ifndef __JABYENGINE_SCRATCHPAD_HPP__
#define __JABYENGINE_SCRATCHPAD_HPP__
#pragma once
#include "../jabyengine_defines.h"
namespace JabyEngine {
static __always_inline auto& ScratchPad = reinterpret_cast<uint8_t(&)[1024]>(*reinterpret_cast<uint8_t*>(0x1F800000));
}
#endif //!__JABYENGINE_SCRATCHPAD_HPP__
}

View File

@ -1,9 +1,6 @@
#ifndef __JABYENGINE__HPP__
#define __JABYENGINE__HPP__
#pragma once
#include "jabyengine_defines.h"
namespace JabyEngine {
typedef void (*MainRoutine)();
}
#endif //!__JABYENGINE__HPP__
}

View File

@ -1,5 +1,4 @@
#ifndef BOOT_LOADER_HPP
#define BOOT_LOADER_HPP
#pragma once
#include "color_debug.hpp"
#include <PSX/jabyengine.hpp>
@ -25,5 +24,4 @@ namespace JabyEngine {
}
void __no_return run();
}
#endif //!BOOT_LOADER_HPP
}

View File

@ -1,5 +1,4 @@
#ifndef __JABYENGINE_CD_INTERNAL_HPP__
#define __JABYENGINE_CD_INTERNAL_HPP__
#pragma once
#include "cd_types.hpp"
namespace JabyEngine {
@ -48,5 +47,4 @@ namespace JabyEngine {
void continue_reading();
}
}
}
#endif //!__JABYENGINE_CD_INTERNAL_HPP__
}

View File

@ -1,5 +1,4 @@
#ifndef __JABYENGINE_INTERNAL_CD_TYPES_HPP__
#define __JABYENGINE_INTERNAL_CD_TYPES_HPP__
#pragma once
#include <PSX/AutoLBA/auto_lba.hpp>
#include <PSX/Auxiliary/math_helper.hpp>
#include <PSX/System/IOPorts/cd_io.hpp>
@ -73,5 +72,4 @@ namespace JabyEngine {
};
}
}
}
#endif //!__JABYENGINE_INTERNAL_CD_TYPES_HPP__
}

View File

@ -1,5 +1,4 @@
#ifndef __JABYENGINE_GPU_INTERNAL_HPP__
#define __JABYENGINE_GPU_INTERNAL_HPP__
#pragma once
#include <PSX/GPU/gpu.hpp>
#include <PSX/System/IOPorts/dma_io.hpp>
#include <PSX/System/IOPorts/gpu_io.hpp>
@ -100,6 +99,4 @@ namespace JabyEngine {
}
}
}
}
#endif //!__JABYENGINE_GPU_INTERNAL_HPP__
}