~quf/libcs3tio

d344442bca055fcf5c9d1c8d0b9d362d4769ac4d — Lukas Himbert 8 months ago ccc7092
senschema update
20 files changed, 133 insertions(+), 54 deletions(-)

M 3rdparty/SenSchema
M compile.sh
M ksp-src/base_list.h
M ksp-src/cs3.h
M ksp-src/cs3_tbl_entry.cpp
M ksp-src/cs3_tbl_entry.h
M ksp-src/master_quartz_base.h
M ksp-src/master_quartz_data.h
M ksp-src/master_quartz_dummy.h
M ksp-src/master_quartz_memo.h
M ksp-src/master_quartz_status.h
M ksp-src/orb_line_list.h
R ksp-src/{qschapter.cpp => qs_chapter.cpp}
R ksp-src/{qschapter.h => qs_chapter.h}
R ksp-src/{qsmons.cpp => qs_mons.cpp}
R ksp-src/{qsmons.h => qs_mons.h}
M ksp-src/quartz_cost.h
M ksp-src/slot_cost.h
M ksp-src/slot_ep.h
M src/load_tbl.cpp
M 3rdparty/SenSchema => 3rdparty/SenSchema +1 -1
@@ 1,1 1,1 @@
Subproject commit 20a68f3e6080eaf69b68457bef10af5dbba2fb88
Subproject commit e52d82fc92c48487e169ec819edd0555814c4ac9

M compile.sh => compile.sh +1 -1
@@ 6,7 6,7 @@ if test -z "$CXX"; then
  CXX=g++
fi

for x in base_list character cs3 cs3_tbl_entry element header_base header_extend master_quartz_base master_quartz_data master_quartz_dummy master_quartz_memo master_quartz_status orb_line_list quartz_cost qschapter qsmons slot_cost slot_ep; do
for x in base_list character cs3 cs3_tbl_entry element header_base header_extend master_quartz_base master_quartz_data master_quartz_dummy master_quartz_memo master_quartz_status orb_line_list quartz_cost qs_chapter qs_mons slot_cost slot_ep; do
  "$CXX" -std=c++20 -W -Wall -Wno-unused-parameter -Werror -Wfatal-errors -fsanitize=address,undefined -I 3rdparty/kaitai_struct_cpp_stl_runtime/ -c ksp-src/$x.cpp -o build/obj-ksp/$x.o
done


M ksp-src/base_list.h => ksp-src/base_list.h +6 -0
@@ 15,6 15,12 @@ namespace ksp {
    class element_t;
    class character_t;

    /**
     * Orbment layout: lines and slot restrictions.
     * 
     * Present in t_orb.tbl.
     */

    class base_list_t : public kaitai::kstruct {

    public:

M ksp-src/cs3.h => ksp-src/cs3.h +2 -2
@@ 5,18 5,18 @@

#include "kaitai/kaitaistruct.h"
#include <stdint.h>
#include "cs3_tbl_entry.h"
#include "header_extend.h"
#include "header_base.h"
#include "cs3_tbl_entry.h"
#include <vector>

#if KAITAI_STRUCT_VERSION < 9000L
#error "Incompatible Kaitai Struct C++/STL API: version 0.9 or later is required"
#endif
namespace ksp {
    class cs3_tbl_entry_t;
    class header_extend_t;
    class header_base_t;
    class cs3_tbl_entry_t;

    class cs3_t : public kaitai::kstruct {


M ksp-src/cs3_tbl_entry.cpp => ksp-src/cs3_tbl_entry.cpp +2 -2
@@ 30,7 30,7 @@ namespace ksp {
                m_data = new master_quartz_dummy_t(m__io);
            }
            else if (on == std::string("QSChapter")) {
                m_data = new qschapter_t(m__io);
                m_data = new qs_chapter_t(m__io);
            }
            else if (on == std::string("OrbLineList")) {
                m_data = new orb_line_list_t(m__io);


@@ 48,7 48,7 @@ namespace ksp {
                m_data = new slot_ep_t(m__io);
            }
            else if (on == std::string("QSMons")) {
                m_data = new qsmons_t(m__io);
                m_data = new qs_mons_t(m__io);
            }
            else if (on == std::string("SlotCost")) {
                m_data = new slot_cost_t(m__io);

M ksp-src/cs3_tbl_entry.h => ksp-src/cs3_tbl_entry.h +16 -16
@@ 5,35 5,35 @@

#include "kaitai/kaitaistruct.h"
#include <stdint.h>
#include "master_quartz_dummy.h"
#include "master_quartz_status.h"
#include "orb_line_list.h"
#include "qs_chapter.h"
#include "master_quartz_base.h"
#include "master_quartz_memo.h"
#include "slot_ep.h"
#include "qsmons.h"
#include "master_quartz_data.h"
#include "slot_cost.h"
#include "master_quartz_base.h"
#include "qschapter.h"
#include "base_list.h"
#include "master_quartz_dummy.h"
#include "quartz_cost.h"
#include "orb_line_list.h"
#include "base_list.h"
#include "slot_cost.h"
#include "slot_ep.h"
#include "qs_mons.h"

#if KAITAI_STRUCT_VERSION < 9000L
#error "Incompatible Kaitai Struct C++/STL API: version 0.9 or later is required"
#endif
namespace ksp {
    class master_quartz_dummy_t;
    class master_quartz_status_t;
    class orb_line_list_t;
    class qs_chapter_t;
    class master_quartz_base_t;
    class master_quartz_memo_t;
    class slot_ep_t;
    class qsmons_t;
    class master_quartz_data_t;
    class slot_cost_t;
    class master_quartz_base_t;
    class qschapter_t;
    class base_list_t;
    class master_quartz_dummy_t;
    class quartz_cost_t;
    class orb_line_list_t;
    class base_list_t;
    class slot_cost_t;
    class slot_ep_t;
    class qs_mons_t;

    class cs3_tbl_entry_t : public kaitai::kstruct {


M ksp-src/master_quartz_base.h => ksp-src/master_quartz_base.h +8 -0
@@ 11,6 11,14 @@
#endif
namespace ksp {

    /**
     * Master quartz stats.
     * 
     * Stat patterns refer to values defined under the MasterQuartzStatus header.
     * 
     * Present in t_mstqrt.tbl.
     */

    class master_quartz_base_t : public kaitai::kstruct {

    public:

M ksp-src/master_quartz_data.h => ksp-src/master_quartz_data.h +6 -0
@@ 11,6 11,12 @@
#endif
namespace ksp {

    /**
     * Master quartz effect strengths, arts, and descriptions.
     * 
     * Present in t_mstqrt.tbl.
     */

    class master_quartz_data_t : public kaitai::kstruct {

    public:

M ksp-src/master_quartz_dummy.h => ksp-src/master_quartz_dummy.h +6 -0
@@ 11,6 11,12 @@
#endif
namespace ksp {

    /**
     * Mapping "EX" dummy master quartzes to their originals.
     * 
     * Present in t_mstqrt.tbl.
     */

    class master_quartz_dummy_t : public kaitai::kstruct {

    public:

M ksp-src/master_quartz_memo.h => ksp-src/master_quartz_memo.h +6 -0
@@ 11,6 11,12 @@
#endif
namespace ksp {

    /**
     * Master quartz effect descriptions.
     * 
     * Present in t_mstqrt.tbl.
     */

    class master_quartz_memo_t : public kaitai::kstruct {

    public:

M ksp-src/master_quartz_status.h => ksp-src/master_quartz_status.h +6 -0
@@ 11,6 11,12 @@
#endif
namespace ksp {

    /**
     * Master quartz stat values.
     * 
     * Present in t_mstqrt.tbl.
     */

    class master_quartz_status_t : public kaitai::kstruct {

    public:

M ksp-src/orb_line_list.h => ksp-src/orb_line_list.h +9 -0
@@ 13,6 13,15 @@
namespace ksp {
    class character_t;

    /**
     * Orbment layout: Order of slots.
     * 
     * Slot ids go from 2 to 8. Slot 2 is the one left of the sub MQ slot, the rest
     * are numbered in clockwise order.
     * 
     * Present in t_orb.tbl.
     */

    class orb_line_list_t : public kaitai::kstruct {

    public:

R ksp-src/qschapter.cpp => ksp-src/qs_chapter.cpp +5 -5
@@ 1,9 1,9 @@
// This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild

#include "qschapter.h"
#include "qs_chapter.h"
namespace ksp {

    qschapter_t::qschapter_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent, qschapter_t* p__root) : kaitai::kstruct(p__io) {
    qs_chapter_t::qs_chapter_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent, qs_chapter_t* p__root) : kaitai::kstruct(p__io) {
        m__parent = p__parent;
        m__root = this;



@@ 15,16 15,16 @@ namespace ksp {
        }
    }

    void qschapter_t::_read() {
    void qs_chapter_t::_read() {
        m_section_id = m__io->read_s2le();
        m_section_name = kaitai::kstream::bytes_to_str(m__io->read_bytes_term(0, false, true, true), std::string("UTF-8"));
        m_unknown = m__io->read_u2le();
    }

    qschapter_t::~qschapter_t() {
    qs_chapter_t::~qs_chapter_t() {
        _clean_up();
    }

    void qschapter_t::_clean_up() {
    void qs_chapter_t::_clean_up() {
    }
}

R ksp-src/qschapter.h => ksp-src/qs_chapter.h +15 -8
@@ 1,5 1,5 @@
#ifndef QSCHAPTER_H_
#define QSCHAPTER_H_
#ifndef QS_CHAPTER_H_
#define QS_CHAPTER_H_

// This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild



@@ 11,33 11,40 @@
#endif
namespace ksp {

    class qschapter_t : public kaitai::kstruct {
    /**
     * Notebook chapters.
     * 
     * Present in t_navi.tbl, t_notebook.tbl, t_notecard.tbl, t_notechar.tbl,
     * t_notehelp.tbl, t_notemons.tbl, t_notesynp.tbl, t_quest.tbl.
     */

    class qs_chapter_t : public kaitai::kstruct {

    public:

        qschapter_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent = 0, qschapter_t* p__root = 0);
        qs_chapter_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent = 0, qs_chapter_t* p__root = 0);

    private:
        void _read();
        void _clean_up();

    public:
        ~qschapter_t();
        ~qs_chapter_t();

    private:
        int16_t m_section_id;
        std::string m_section_name;
        uint16_t m_unknown;
        qschapter_t* m__root;
        qs_chapter_t* m__root;
        kaitai::kstruct* m__parent;

    public:
        int16_t section_id() const { return m_section_id; }
        std::string section_name() const { return m_section_name; }
        uint16_t unknown() const { return m_unknown; }
        qschapter_t* _root() const { return m__root; }
        qs_chapter_t* _root() const { return m__root; }
        kaitai::kstruct* _parent() const { return m__parent; }
    };
}

#endif  // QSCHAPTER_H_
#endif  // QS_CHAPTER_H_

R ksp-src/qsmons.cpp => ksp-src/qs_mons.cpp +5 -5
@@ 1,9 1,9 @@
// This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild

#include "qsmons.h"
#include "qs_mons.h"
namespace ksp {

    qsmons_t::qsmons_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent, qsmons_t* p__root) : kaitai::kstruct(p__io) {
    qs_mons_t::qs_mons_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent, qs_mons_t* p__root) : kaitai::kstruct(p__io) {
        m__parent = p__parent;
        m__root = this;



@@ 15,7 15,7 @@ namespace ksp {
        }
    }

    void qsmons_t::_read() {
    void qs_mons_t::_read() {
        m_enemy_script = kaitai::kstream::bytes_to_str(m__io->read_bytes_term(0, false, true, true), std::string("UTF-8"));
        m_unknown_string = kaitai::kstream::bytes_to_str(m__io->read_bytes_term(0, false, true, true), std::string("UTF-8"));
        m_section_id = m__io->read_s2le();


@@ 24,10 24,10 @@ namespace ksp {
        m_unknown_byte = m__io->read_u1();
    }

    qsmons_t::~qsmons_t() {
    qs_mons_t::~qs_mons_t() {
        _clean_up();
    }

    void qsmons_t::_clean_up() {
    void qs_mons_t::_clean_up() {
    }
}

R ksp-src/qsmons.h => ksp-src/qs_mons.h +15 -8
@@ 1,5 1,5 @@
#ifndef QSMONS_H_
#define QSMONS_H_
#ifndef QS_MONS_H_
#define QS_MONS_H_

// This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild



@@ 11,18 11,25 @@
#endif
namespace ksp {

    class qsmons_t : public kaitai::kstruct {
    /**
     * Monster notebook entries.
     * Stats are taken from t_status.tbl.
     * 
     * Present in t_notemons.tbl.
     */

    class qs_mons_t : public kaitai::kstruct {

    public:

        qsmons_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent = 0, qsmons_t* p__root = 0);
        qs_mons_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent = 0, qs_mons_t* p__root = 0);

    private:
        void _read();
        void _clean_up();

    public:
        ~qsmons_t();
        ~qs_mons_t();

    private:
        std::string m_enemy_script;


@@ 31,7 38,7 @@ namespace ksp {
        uint16_t m_unknown_short;
        uint8_t m_is_extra;
        uint8_t m_unknown_byte;
        qsmons_t* m__root;
        qs_mons_t* m__root;
        kaitai::kstruct* m__parent;

    public:


@@ 54,9 61,9 @@ namespace ksp {
         * In the original files, this byte is always 0.
         */
        uint8_t unknown_byte() const { return m_unknown_byte; }
        qsmons_t* _root() const { return m__root; }
        qs_mons_t* _root() const { return m__root; }
        kaitai::kstruct* _parent() const { return m__parent; }
    };
}

#endif  // QSMONS_H_
#endif  // QS_MONS_H_

M ksp-src/quartz_cost.h => ksp-src/quartz_cost.h +6 -0
@@ 11,6 11,12 @@
#endif
namespace ksp {

    /**
     * Quartz synthesis cost.
     * 
     * Present in t_qu_cost.tbl.
     */

    class quartz_cost_t : public kaitai::kstruct {

    public:

M ksp-src/slot_cost.h => ksp-src/slot_cost.h +6 -0
@@ 11,6 11,12 @@
#endif
namespace ksp {

    /**
     * Cost to unlock orbment slots.
     * 
     * Present in t_slot.tbl.
     */

    class slot_cost_t : public kaitai::kstruct {

    public:

M ksp-src/slot_ep.h => ksp-src/slot_ep.h +6 -0
@@ 13,6 13,12 @@
namespace ksp {
    class character_t;

    /**
     * Amount of EP gained by unlocking a slot.
     * 
     * Present in t_slot.tbl.
     */

    class slot_ep_t : public kaitai::kstruct {

    public:

M src/load_tbl.cpp => src/load_tbl.cpp +6 -6
@@ 14,8 14,8 @@ static MasterQuartzStatusEntry convert(const ksp::master_quartz_status_t *);
static OrbBaseEntry convert(const ksp::base_list_t *);
static OrbLineEntry convert(const ksp::orb_line_list_t *);
static QuartzCostEntry convert(const ksp::quartz_cost_t *);
static QSChapterEntry convert(const ksp::qschapter_t *);
static QSMonsEntry convert(const ksp::qsmons_t *);
static QSChapterEntry convert(const ksp::qs_chapter_t *);
static QSMonsEntry convert(const ksp::qs_mons_t *);
static SlotCostEntry convert(const ksp::slot_cost_t *);
static SlotEPEntry convert(const ksp::slot_ep_t *);



@@ 45,9 45,9 @@ Tbl load_tbl(std::istream &input) {
    } else if (entry->header_name() == "QuartzCost") {
      entries.emplace_back(convert(dynamic_cast<const ksp::quartz_cost_t *>(entry->data())));
    } else if (entry->header_name() == "QSChapter") {
      entries.emplace_back(convert(dynamic_cast<const ksp::qschapter_t *>(entry->data())));
      entries.emplace_back(convert(dynamic_cast<const ksp::qs_chapter_t *>(entry->data())));
    } else if (entry->header_name() == "QSMons") {
      entries.emplace_back(convert(dynamic_cast<const ksp::qsmons_t *>(entry->data())));
      entries.emplace_back(convert(dynamic_cast<const ksp::qs_mons_t *>(entry->data())));
    } else if (entry->header_name() == "SlotCost") {
      entries.emplace_back(convert(dynamic_cast<const ksp::slot_cost_t *>(entry->data())));
    } else if (entry->header_name() == "SlotEp") {


@@ 207,7 207,7 @@ static QuartzCostEntry convert(const ksp::quartz_cost_t *entry) {
  };
}

static QSChapterEntry convert(const ksp::qschapter_t *entry) {
static QSChapterEntry convert(const ksp::qs_chapter_t *entry) {
  return QSChapterEntry{
      .section_id = entry->section_id(),
      .section_name = entry->section_name(),


@@ 215,7 215,7 @@ static QSChapterEntry convert(const ksp::qschapter_t *entry) {
  };
}

static QSMonsEntry convert(const ksp::qsmons_t *entry) {
static QSMonsEntry convert(const ksp::qs_mons_t *entry) {
  if (entry->is_extra() != 0 && entry->is_extra() != 1) {
    throw std::logic_error("is_extra byte should be 0 or 1");
  }