Load Font texture to VRAM
This commit is contained in:
parent
cdf647da20
commit
ef1890b3b7
|
@ -1,4 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include <PSX/File/file_types.hpp>
|
||||||
#include <PSX/GPU/gpu_types.hpp>
|
#include <PSX/GPU/gpu_types.hpp>
|
||||||
|
|
||||||
namespace JabyEngine {
|
namespace JabyEngine {
|
||||||
|
|
|
@ -8,6 +8,6 @@ namespace JabyEngine {
|
||||||
.FontSize = {12, 16}
|
.FontSize = {12, 16}
|
||||||
};
|
};
|
||||||
|
|
||||||
static void load(GPU::PositionU16 vram_dst);
|
static void load(uint32_t* work_area, SimpleTIM vram_dst);
|
||||||
};
|
};
|
||||||
}
|
}
|
|
@ -3,6 +3,6 @@
|
||||||
|
|
||||||
namespace JabyEngine {
|
namespace JabyEngine {
|
||||||
struct FontWriter {
|
struct FontWriter {
|
||||||
static void setup(GPU::PositionU16 vram_pos, const FontInfo& font_info);
|
static void setup(SimpleTIM vram_dst, const FontInfo& font_info);
|
||||||
};
|
};
|
||||||
}
|
}
|
|
@ -1,9 +1,24 @@
|
||||||
#include "default_font_data.hpp"
|
#include "default_font_data.hpp"
|
||||||
#include <FontWriter/default_font.hpp>
|
#include <FontWriter/default_font.hpp>
|
||||||
|
#include <PSX/File/Processor/file_processor.hpp>
|
||||||
|
#include <PSX/Auxiliary/lz4_decompressor.hpp>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
namespace JabyEngine {
|
namespace JabyEngine {
|
||||||
void DefaultFont :: load(GPU::PositionU16 vram_dst) {
|
static size_t decompress_font(uint32_t* work_area) {
|
||||||
printf("Loading DefaultFont @0x%p -> %lu\n", default_font_data, sizeof(default_font_data));
|
LZ4Decompressor lz4_decomp(reinterpret_cast<uint8_t*>(work_area));
|
||||||
|
|
||||||
|
const auto [progress, bytes_ready] = lz4_decomp.process(ArrayRange(default_font_data, sizeof(default_font_data)), true);
|
||||||
|
if(progress == Progress::Error) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return bytes_ready;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DefaultFont :: load(uint32_t* work_area, SimpleTIM vram_dst) {
|
||||||
|
const auto bytes_ready = decompress_font(work_area);
|
||||||
|
|
||||||
|
auto processor = FileProcessor::create(work_area, vram_dst);
|
||||||
|
processor.process(bytes_ready);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,7 +2,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
namespace JabyEngine {
|
namespace JabyEngine {
|
||||||
void FontWriter :: setup(GPU::PositionU16 vram_pos, const FontInfo& font_info) {
|
void FontWriter :: setup(SimpleTIM vram_dst, const FontInfo& font_info) {
|
||||||
printf("Hello Planschi c:\n");
|
printf("Hello Planschi c:\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -15,10 +15,10 @@ using NewFontWriter = ::JabyEngine::FontWriter;
|
||||||
static object::Paco paco;
|
static object::Paco paco;
|
||||||
|
|
||||||
static void setup() {
|
static void setup() {
|
||||||
static constexpr auto VRAMFontDst = GPU::PositionU16::create(320, 0);
|
static constexpr auto FontTIM = SimpleTIM(320, 0, 320, DefaultFont::Info.VRAMSize.height);
|
||||||
|
|
||||||
DefaultFont::load(VRAMFontDst);
|
DefaultFont::load(&__heap_start, FontTIM);
|
||||||
NewFontWriter::setup(VRAMFontDst, DefaultFont::Info);
|
NewFontWriter::setup(FontTIM, DefaultFont::Info);
|
||||||
|
|
||||||
Assets::load_for_main();
|
Assets::load_for_main();
|
||||||
FontWriter::FontWriter::setup();
|
FontWriter::FontWriter::setup();
|
||||||
|
|
Loading…
Reference in New Issue