Prepare for supporting LBAs in persitent code
This commit is contained in:
16
include/PSX/AutoLBA/auto_lba.hpp
Normal file
16
include/PSX/AutoLBA/auto_lba.hpp
Normal file
@@ -0,0 +1,16 @@
|
||||
#ifndef __JABYENGINE_AUTO_LBA_HPP__
|
||||
#define __JABYENGINE_AUTO_LBA_HPP__
|
||||
#include "../../stdint.h"
|
||||
|
||||
namespace JabyEngine {
|
||||
#define __jabyengine_start_lba_request
|
||||
#define __jabyengine_request_lba_for(name, file) name
|
||||
#define __jabyengine_end_lba_request EndOfRequest
|
||||
|
||||
struct __attribute__((packed)) AutoLBAEntry {
|
||||
uint16_t lba;
|
||||
uint16_t size_words;
|
||||
};
|
||||
}
|
||||
|
||||
#endif //!__JABYENGINE_AUTO_LBA_HPP__
|
9
include/PSX/AutoLBA/auto_lba_declaration.hpp
Normal file
9
include/PSX/AutoLBA/auto_lba_declaration.hpp
Normal file
@@ -0,0 +1,9 @@
|
||||
#ifndef __JABYENGINE_AUTO_LBA_DECLARATION_HPP__
|
||||
#define __JABYENGINE_AUTO_LBA_DECLARATION_HPP__
|
||||
|
||||
extern const JabyEngine::AutoLBAEntry overlay_lba[];
|
||||
|
||||
#define __declare_lba_header(enum_struct) \
|
||||
[[gnu::used]] \
|
||||
const JabyEngine::AutoLBAEntry __section(".header.lbas") overlay_lba[static_cast<int>(enum_struct::EndOfRequest)] = {0}
|
||||
#endif //!__JABYENGINE_AUTO_LBA_DECLARATION_HPP__
|
@@ -1,6 +1,6 @@
|
||||
#ifndef __JABYENGINE_OVERLAY__HPP__
|
||||
#define __JABYENGINE_OVERLAY__HPP__
|
||||
#include "../../stdint.h"
|
||||
#include "../AutoLBA/auto_lba.hpp"
|
||||
|
||||
namespace JabyEngine {
|
||||
struct __attribute__((packed)) OverlayHeader {
|
||||
@@ -8,10 +8,6 @@ namespace JabyEngine {
|
||||
uint16_t lba_size; //< The size of the OverlayLBA section
|
||||
};
|
||||
|
||||
// Maybe encode attributes like "isLZ4" into size parameter
|
||||
struct __attribute__((packed)) OverlayLBA {
|
||||
uint16_t lba;
|
||||
uint16_t size_words;
|
||||
};
|
||||
typedef AutoLBAEntry OverlayLBA;
|
||||
}
|
||||
#endif //!__JABYENGINE_OVERLAY__HPP__
|
@@ -3,12 +3,11 @@
|
||||
|
||||
// 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"
|
||||
extern const JabyEngine::OverlayHeader overlay_header;
|
||||
extern const JabyEngine::OverlayLBA overlay_lba[];
|
||||
|
||||
#define __declare_overlay_header(function, enum_struct) \
|
||||
__declare_lba_header(enum_struct); \
|
||||
[[gnu::used]] \
|
||||
const JabyEngine::OverlayHeader __section(".header") overlay_header = {.execute = &function, .lba_size = static_cast<uint16_t>(enum_struct::EndOfRequest)}; \
|
||||
[[gnu::used]] \
|
||||
const JabyEngine::OverlayLBA __section(".header.lbas") overlay_lba[static_cast<int>(enum_struct::EndOfRequest)] = {0}
|
||||
const JabyEngine::OverlayHeader __section(".header") overlay_header = {.execute = &function, .lba_size = static_cast<uint16_t>(enum_struct::EndOfRequest)};
|
||||
#endif //!__JABYENGINE_OVERLAY_DECLARATION__HPP__
|
@@ -1,8 +0,0 @@
|
||||
#ifndef __JABYENGINE_OVERLAY_LBA__HPP__
|
||||
#define __JABYENGINE_OVERLAY_LBA__HPP__
|
||||
|
||||
#define __jabyengine_start_lba_request
|
||||
#define __jabyengine_request_lba_for(name, file) name
|
||||
#define __jabyengine_end_lba_request EndOfRequest
|
||||
|
||||
#endif //!__JABYENGINE_OVERLAY_LBA__HPP__
|
Reference in New Issue
Block a user