From 9efcf87ecc55f7971eced6869d8e72dca5159e66 Mon Sep 17 00:00:00 2001 From: Jaby Date: Wed, 3 Jan 2024 12:51:13 -0600 Subject: [PATCH] Re-create PoolBox Paco --- .../PoolBox/application/include/asset_mgr.hpp | 12 +++++ .../PoolBox/application/src/application.cpp | 32 +++++++++++++ .../PoolBox/application/src/asset_mgr.cpp | 47 +++++++++++++++++++ .../{old/Objects => src/include}/paco.hpp | 16 +++---- .../application/{old/Objects => src}/paco.cpp | 12 ++++- examples/PoolBox/assets/Makefile | 5 +- examples/PoolBox/assets/YoshiFont.png | 3 -- examples/PoolBox/iso/Config.xml | 3 +- 8 files changed, 110 insertions(+), 20 deletions(-) create mode 100644 examples/PoolBox/application/include/asset_mgr.hpp create mode 100644 examples/PoolBox/application/src/application.cpp create mode 100644 examples/PoolBox/application/src/asset_mgr.cpp rename examples/PoolBox/application/{old/Objects => src/include}/paco.hpp (50%) rename examples/PoolBox/application/{old/Objects => src}/paco.cpp (55%) delete mode 100644 examples/PoolBox/assets/YoshiFont.png diff --git a/examples/PoolBox/application/include/asset_mgr.hpp b/examples/PoolBox/application/include/asset_mgr.hpp new file mode 100644 index 00000000..ee771562 --- /dev/null +++ b/examples/PoolBox/application/include/asset_mgr.hpp @@ -0,0 +1,12 @@ +#pragma once +#include + +namespace Assets { + using namespace JabyEngine; + + namespace Main { + static constexpr auto PacoTIM = SimpleTIM(896, 0, 960, 510); + + void load(); + } +} \ No newline at end of file diff --git a/examples/PoolBox/application/src/application.cpp b/examples/PoolBox/application/src/application.cpp new file mode 100644 index 00000000..8948810a --- /dev/null +++ b/examples/PoolBox/application/src/application.cpp @@ -0,0 +1,32 @@ +#include "../include/asset_mgr.hpp" +#include "include/paco.hpp" +#include + +using namespace JabyEngine; + +// Do we want this namespace? +// Do we want Paco to be HERE?! +static object::Paco paco; + +static void setup() { + Assets::Main::load(); + paco.setup(); +} + +static void update() { + paco.update(); +} + +static void render() { + paco.render(); +} + +void main() { + setup(); + + while(true) { + update(); + GPU::swap_buffers_vsync(1); + render(); + } +} \ No newline at end of file diff --git a/examples/PoolBox/application/src/asset_mgr.cpp b/examples/PoolBox/application/src/asset_mgr.cpp new file mode 100644 index 00000000..aeec8c67 --- /dev/null +++ b/examples/PoolBox/application/src/asset_mgr.cpp @@ -0,0 +1,47 @@ +#include "../include/asset_mgr.hpp" +#include +#include +#include +#include + +namespace Assets { + enum LBA { + __jabyengine_start_lba_request + __jabyengine_request_lba_for(PACO, "ASSETS/MAIN/PACO.BIN"), + __jabyengine_end_lba_request + }; + __declare_lba_header(LBA); + + static void load(const CDFile* assets, size_t size) { + const auto buffer_cfg = CDFileProcessor::BufferConfiguration::new_default(); + CDFileProcessor file_processor; + + file_processor.setup(lba, CDFileProcessor::JobArray{assets, size}, buffer_cfg); + while(true) { + switch(file_processor.process()) { + case Progress::InProgress: + break; + + case Progress::Done: + if(!file_processor.next(lba, buffer_cfg)) { + return; + } + break; + + case Progress::Error: + printf("Error detected! Aborting load\n"); + return; + } + } + } + + namespace Main { + static const CDFile Files[] = { + CDFileBuilder::simple_tim(LBA::PACO, PacoTIM) + }; + + void load() { + ::Assets::load(Files, sizeof(Files)/sizeof(Files[0])); + } + } +} \ No newline at end of file diff --git a/examples/PoolBox/application/old/Objects/paco.hpp b/examples/PoolBox/application/src/include/paco.hpp similarity index 50% rename from examples/PoolBox/application/old/Objects/paco.hpp rename to examples/PoolBox/application/src/include/paco.hpp index 6e3e42ed..b39e6668 100644 --- a/examples/PoolBox/application/old/Objects/paco.hpp +++ b/examples/PoolBox/application/src/include/paco.hpp @@ -1,14 +1,12 @@ #pragma once -#include -#include +#include "../../include/asset_mgr.hpp" +#include #include namespace object { using namespace JabyEngine; class Paco { - public: - static constexpr auto TIM = SimpleTIM(896, 0, 960, 510); private: static const GPU::Color24 Colors[]; @@ -19,12 +17,12 @@ namespace object { public: constexpr Paco() : - tex_page(GPU::TexPage::create(GPU::PositionU16::create( - TIM.get_texture_x(), TIM.get_texture_y()), + tex_page(Make::TexPage(Make::PositionU16( + Assets::Main::PacoTIM.get_texture_x(), Assets::Main::PacoTIM.get_texture_y()), GPU::TexturePageColor::$4bit).linked()), - sprite(GPU::SPRT::create( - GPU::AreaI16::create(GPU::PositionI16::create(0, 100), GPU::SizeI16::create(120, 128)), - GPU::OffsetPageWithClut(GPU::PageOffset::create(0, 0), GPU::PageClut::create(TIM.get_clut_x(), TIM.get_clut_y())), + sprite(Make::SPRT( + Make::AreaI16(Make::PositionI16(0, 100), Make::SizeI16(120, 128)), + Make::OffsetPageWithClut(Make::PageOffset(0, 0), Make::PageClut(Assets::Main::PacoTIM.get_clut_x(), Assets::Main::PacoTIM.get_clut_y())), GPU::Color24::Blue()).linked()), timer(), color_idx(0) {} diff --git a/examples/PoolBox/application/old/Objects/paco.cpp b/examples/PoolBox/application/src/paco.cpp similarity index 55% rename from examples/PoolBox/application/old/Objects/paco.cpp rename to examples/PoolBox/application/src/paco.cpp index c3637f0e..f1f19eb8 100644 --- a/examples/PoolBox/application/old/Objects/paco.cpp +++ b/examples/PoolBox/application/src/paco.cpp @@ -1,11 +1,19 @@ -#include "paco.hpp" +#include "include/paco.hpp" namespace object { const GPU::Color24 Paco :: Colors[] = {GPU::Color24::Red(), GPU::Color24::Green(), GPU::Color24::Blue(), GPU::Color24::Yellow()}; void Paco :: setup() { + /*this->tex_page = Make::TexPage(Make::PositionU16( + Assets::Main::PacoTIM.get_texture_x(), Assets::Main::PacoTIM.get_texture_y()), + GPU::TexturePageColor::$4bit).linked(); + + this->sprite = Make::SPRT( + Make::AreaI16(Make::PositionI16(0, 100), Make::SizeI16(120, 128)), + Make::OffsetPageWithClut(Make::PageOffset(0, 0), Make::PageClut(Assets::Main::PacoTIM.get_clut_x(), Assets::Main::PacoTIM.get_clut_y())), + GPU::Color24::Blue()).linked();*/ + this->timer.reset(); - // This should only work on elements that are linkable - but it didn't this->tex_page.concat(this->sprite); } diff --git a/examples/PoolBox/assets/Makefile b/examples/PoolBox/assets/Makefile index 25601b8c..6ac738d9 100644 --- a/examples/PoolBox/assets/Makefile +++ b/examples/PoolBox/assets/Makefile @@ -2,7 +2,7 @@ include $(JABY_ENGINE_DIR)/mkfile/ExportPath.mk include $(JABY_ENGINE_DIR)/mkfile/RebuildTarget.mk OUTPUT_DIR = bin -INPUT = $(OUTPUT_DIR)/TexturePage.bin $(OUTPUT_DIR)/IconTexture.bin $(OUTPUT_DIR)/YoshiFont.bin $(OUTPUT_DIR)/Paco.bin +INPUT = $(OUTPUT_DIR)/TexturePage.bin $(OUTPUT_DIR)/IconTexture.bin $(OUTPUT_DIR)/Paco.bin $(OUTPUT_DIR)/TexturePage.bin: TexturePage.png @mkdir -p $(OUTPUT_DIR) @@ -12,9 +12,6 @@ $(OUTPUT_DIR)/IconTexture.bin: IconTexture.png @mkdir -p $(OUTPUT_DIR) jaby_engine_fconv --lz4 $< -o $@ simple-tim clut4 --semi-trans --color-trans -$(OUTPUT_DIR)/YoshiFont.bin: YoshiFont.png - jaby_engine_fconv --lz4 $< -o $@ simple-tim clut4 --color-trans - $(OUTPUT_DIR)/Paco.bin: Paco.png jaby_engine_fconv --lz4 $< -o $@ simple-tim clut4 --color-trans diff --git a/examples/PoolBox/assets/YoshiFont.png b/examples/PoolBox/assets/YoshiFont.png deleted file mode 100644 index 653e8ff8..00000000 --- a/examples/PoolBox/assets/YoshiFont.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:8d195c708c5642d2705039f1115c24c5d16bef6ec5ba332a6a6bbf9fa7e7bcaf -size 4452 diff --git a/examples/PoolBox/iso/Config.xml b/examples/PoolBox/iso/Config.xml index c36a0ab5..282edeed 100644 --- a/examples/PoolBox/iso/Config.xml +++ b/examples/PoolBox/iso/Config.xml @@ -5,10 +5,9 @@ System.cnf -
../application/bin/PSX-release/PoolBox.psexe
+
../application/bin/PSX-release/PoolBox.psexe