Prepare for shared code
This commit is contained in:
parent
aaf1e99ce8
commit
9520050038
|
@ -3,7 +3,6 @@ use tool_helper::{raw::RawConversion, Error};
|
||||||
|
|
||||||
#[repr(packed)]
|
#[repr(packed)]
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
// TODO: Move logic of fixed values into the raw function, including the BE/LE stuff?
|
|
||||||
pub struct VAGHeader {
|
pub struct VAGHeader {
|
||||||
_id: [u8; 4],
|
_id: [u8; 4],
|
||||||
version: u32,
|
version: u32,
|
||||||
|
|
|
@ -1 +1,5 @@
|
||||||
pub mod reduced_tim;
|
pub mod color_clut;
|
||||||
|
pub mod color_full16;
|
||||||
|
pub mod reduced_tim;
|
||||||
|
pub mod tim;
|
||||||
|
pub mod types;
|
|
@ -1,14 +1,10 @@
|
||||||
use clap::{Args, ValueEnum};
|
use clap::{Args, ValueEnum};
|
||||||
use image::{DynamicImage, io::Reader as ImageReader};
|
use image::{DynamicImage, io::Reader as ImageReader};
|
||||||
use color_clut::IndexedImage;
|
use super::color_clut::{IndexedImage, OutputType};
|
||||||
use color_full16::{RgbaImage, RgbImage};
|
use super::color_full16::{RgbaImage, RgbImage};
|
||||||
use std::io::{Cursor, Write};
|
use std::io::{Cursor, Write};
|
||||||
use tool_helper::{Error, Input};
|
use tool_helper::{Error, Input};
|
||||||
use types::{Header, Color as PSXColor, PSXImageConverter};
|
use super::types::{Header, Color as PSXColor, PSXImageConverter};
|
||||||
|
|
||||||
mod types;
|
|
||||||
mod color_clut;
|
|
||||||
mod color_full16;
|
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)]
|
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)]
|
||||||
pub enum ColorType{
|
pub enum ColorType{
|
||||||
|
@ -160,8 +156,8 @@ fn convert_palette_based(input: Input, output: &mut dyn Write, color_type: Color
|
||||||
Ok(reader) => {
|
Ok(reader) => {
|
||||||
let output_type = {
|
let output_type = {
|
||||||
match color_type {
|
match color_type {
|
||||||
ColorType::Clut4 => color_clut::OutputType::FourBit,
|
ColorType::Clut4 => OutputType::FourBit,
|
||||||
ColorType::Clut8 => color_clut::OutputType::EightBit,
|
ColorType::Clut8 => OutputType::EightBit,
|
||||||
_ => return Err(Error::from_str("ColorType not supported"))
|
_ => return Err(Error::from_str("ColorType not supported"))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -21,7 +21,6 @@ struct CommandLine {
|
||||||
|
|
||||||
#[derive(Subcommand)]
|
#[derive(Subcommand)]
|
||||||
enum SubCommands {
|
enum SubCommands {
|
||||||
// === Internal Commands ===
|
|
||||||
Nothing,
|
Nothing,
|
||||||
SimpleTIM(reduced_tim::Arguments),
|
SimpleTIM(reduced_tim::Arguments),
|
||||||
VAG(vag::Arguments),
|
VAG(vag::Arguments),
|
||||||
|
|
Loading…
Reference in New Issue