Add Pica Texture Encoding Decoding
Supported Formats: A4, A8, L4, L8, RGB565, RGB888 RGBA8888 (for now) Add a .clang-format Move ctrff into a subdirectory Replace the BCLIM creation part with Pica encoder Fix non const RGB565ToRGBA issue
This commit is contained in:
@@ -6,4 +6,5 @@
|
||||
#include <ctrff/bcwav.hpp>
|
||||
#include <ctrff/binutil.hpp>
|
||||
#include <ctrff/lz11.hpp>
|
||||
#include <ctrff/pica.hpp>
|
||||
#include <ctrff/smdh.hpp>
|
||||
@@ -9,24 +9,24 @@
|
||||
namespace ctrff {
|
||||
class CTRFF_API BCLIM : public BinFile {
|
||||
public:
|
||||
BCLIM() {}
|
||||
BCLIM() : pCurrent(Header::Default()), pImag(ImagHeader::Default()) {}
|
||||
~BCLIM() {}
|
||||
|
||||
enum Format : u32 {
|
||||
L8,
|
||||
L8, // tested
|
||||
A8, // tested
|
||||
LA4,
|
||||
LA8,
|
||||
HILO8,
|
||||
RGB565, // tested
|
||||
RGB888,
|
||||
RGB888, // tested
|
||||
RGBA5551,
|
||||
RGBA4444,
|
||||
RGBA8888, // tested
|
||||
ETC1,
|
||||
ETC1A4,
|
||||
L4,
|
||||
A4,
|
||||
L4, // tested
|
||||
A4, // tested
|
||||
};
|
||||
|
||||
struct Header {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
namespace ctrff {
|
||||
CTRFF_API void String2U16(ctrff::u16 *res, const std::string &src, size_t max);
|
||||
CTRFF_API std::string U16toU8(ctrff::u16 *in, size_t max);
|
||||
CTRFF_API void RGB565toRGBA(std::vector<ctrff::u8> &img, ctrff::u16 *icon,
|
||||
CTRFF_API void RGB565toRGBA(std::vector<ctrff::u8> &img, const ctrff::u16 *icon,
|
||||
const int &w, const int &h);
|
||||
// Image can only be rgba8888
|
||||
CTRFF_API void RGBA2RGB565(ctrff::u16 *out, const std::vector<ctrff::u8> &img,
|
||||
|
||||
34
include/ctrff/pica.hpp
Normal file
34
include/ctrff/pica.hpp
Normal file
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
#include <ctrff/types.hpp>
|
||||
|
||||
/**
|
||||
* 3ds GPU Stuff
|
||||
*/
|
||||
|
||||
namespace ctrff {
|
||||
namespace Pica {
|
||||
enum Color : u32 {
|
||||
L8, // tested
|
||||
A8, // tested
|
||||
LA4,
|
||||
LA8,
|
||||
HILO8,
|
||||
RGB565, // tested
|
||||
RGB888, // tested
|
||||
RGBA5551,
|
||||
RGBA4444,
|
||||
RGBA8888, // tested
|
||||
ETC1,
|
||||
ETC1A4,
|
||||
L4, // tested
|
||||
A4, // tested
|
||||
};
|
||||
CTRFF_API void EncodeImage(std::vector<ctrff::u8>& ret,
|
||||
std::vector<ctrff::u8> rgba, int w, int h,
|
||||
Color dst);
|
||||
CTRFF_API void DecodeImage(std::vector<ctrff::u8>& ret,
|
||||
std::vector<ctrff::u8> pixels, int w, int h,
|
||||
Color src);
|
||||
} // namespace Pica
|
||||
} // namespace ctrff
|
||||
Reference in New Issue
Block a user