Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ if(LIBLCF_WITH_ICU)
set(LCF_SUPPORT_ICU 1)
else()
if(NOT WIN32)
message(FATAL_ERROR "ICU not found. Use LCF_SUPPORT_ICU=0 to disable ICU support (not recommended).")
message(FATAL_ERROR "ICU not found. Use LIBLCF_WITH_ICU=0 to disable ICU support (not recommended).")
endif()

message(STATUS "ICU not found. Using the system library.")
Expand Down
2 changes: 2 additions & 0 deletions generator/csv/enums_easyrpg.csv
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ EventCommand,Code,Maniac_WritePicture,3026
EventCommand,Code,Maniac_AddMoveRoute,3027
EventCommand,Code,Maniac_EditTile,3028
EventCommand,Code,Maniac_ControlTextProcessing,3029
EventCommand,Code,Maniac_Zoom,3032
EventPage,ManiacEventInfo,action,0
EventPage,ManiacEventInfo,touched,1
EventPage,ManiacEventInfo,collision,2
Expand All @@ -54,5 +55,6 @@ SavePicture,EasyRpgFlip,y,2
SavePicture,EasyRpgFlip,both,3
SavePicture,EasyRpgType,default,0
SavePicture,EasyRpgType,window,1
SavePicture,EasyRpgType,canvas,2
Skill,HpType,cost,0
Skill,HpType,percent,1
1 change: 1 addition & 0 deletions generator/csv/fields_easyrpg.csv
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ SavePicture,easyrpg_flip,f,Enum<EasyRpgFlip>,0xC8,0,0,1,How to flip the picture
SavePicture,easyrpg_blend_mode,f,Int32,0xC9,0,0,1,Blend mode to use for blit. See Bitmap::BlendMode
SavePicture,easyrpg_type,f,Enum<EasyRpgPictureType>,0xCA,0,0,1,Type of this picture
SavePicture,maniac_current_magnify_height,f,Double,0x0A,100.0,0,0,Current zoom level of picture (y direction).
SavePicture,maniac_image_data,f,Vector<UInt8>,0x1C,,0,0,Deflate compressed image data of a picture modified with EditPicture command
SavePicture,maniac_finish_magnify_height,f,Int32,0x24,100,0,0,Final zoom level to animate picture to (y direction).
SaveEasyRpgWindow,texts,f,Array<SaveEasyRpgText>,0x01,,0,0,Texts to render
SaveEasyRpgWindow,width,f,Int32,0x02,0,0,0,Window width (px)
Expand Down
2 changes: 2 additions & 0 deletions src/generated/lcf/lsd/chunks.h
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,8 @@ namespace LSD_Reader {
easyrpg_type = 0xCA,
/** Current zoom level of picture (y direction). */
maniac_current_magnify_height = 0x0A,
/** Deflate compressed image data of a picture modified with EditPicture command */
maniac_image_data = 0x1C,
/** Final zoom level to animate picture to (y direction). */
maniac_finish_magnify_height = 0x24
};
Expand Down
6 changes: 4 additions & 2 deletions src/generated/lcf/rpg/eventcommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ namespace rpg {
Maniac_WritePicture = 3026,
Maniac_AddMoveRoute = 3027,
Maniac_EditTile = 3028,
Maniac_ControlTextProcessing = 3029
Maniac_ControlTextProcessing = 3029,
Maniac_Zoom = 3032
};
static constexpr auto kCodeTags = lcf::EnumTags{
Code::END, "END",
Expand Down Expand Up @@ -358,7 +359,8 @@ namespace rpg {
Code::Maniac_WritePicture, "Maniac_WritePicture",
Code::Maniac_AddMoveRoute, "Maniac_AddMoveRoute",
Code::Maniac_EditTile, "Maniac_EditTile",
Code::Maniac_ControlTextProcessing, "Maniac_ControlTextProcessing"
Code::Maniac_ControlTextProcessing, "Maniac_ControlTextProcessing",
Code::Maniac_Zoom, "Maniac_Zoom"
};

int32_t code = 0;
Expand Down
9 changes: 7 additions & 2 deletions src/generated/lcf/rpg/savepicture.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <array>
#include <stdint.h>
#include <string>
#include <vector>
#include "lcf/enum_tags.h"
#include "lcf/context.h"
#include <ostream>
Expand Down Expand Up @@ -96,11 +97,13 @@ namespace rpg {
);
enum EasyRpgType {
EasyRpgType_default = 0,
EasyRpgType_window = 1
EasyRpgType_window = 1,
EasyRpgType_canvas = 2
};
static constexpr auto kEasyRpgTypeTags = lcf::makeEnumTags<EasyRpgType>(
"default",
"window"
"window",
"canvas"
);

int ID = 0;
Expand Down Expand Up @@ -161,6 +164,7 @@ namespace rpg {
int32_t easyrpg_blend_mode = 0;
int32_t easyrpg_type = 0;
double maniac_current_magnify_height = 100.0;
std::vector<uint8_t> maniac_image_data;
int32_t maniac_finish_magnify_height = 100;
};
inline std::ostream& operator<<(std::ostream& os, SavePicture::Effect code) {
Expand Down Expand Up @@ -237,6 +241,7 @@ namespace rpg {
&& l.easyrpg_blend_mode == r.easyrpg_blend_mode
&& l.easyrpg_type == r.easyrpg_type
&& l.maniac_current_magnify_height == r.maniac_current_magnify_height
&& l.maniac_image_data == r.maniac_image_data
&& l.maniac_finish_magnify_height == r.maniac_finish_magnify_height;
}

Expand Down
8 changes: 8 additions & 0 deletions src/generated/lsd_savepicture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,13 @@ static TypedField<rpg::SavePicture, double> static_maniac_current_magnify_height
0,
0
);
static TypedField<rpg::SavePicture, std::vector<uint8_t>> static_maniac_image_data(
&rpg::SavePicture::maniac_image_data,
LSD_Reader::ChunkSavePicture::maniac_image_data,
"maniac_image_data",
0,
0
);
static TypedField<rpg::SavePicture, int32_t> static_maniac_finish_magnify_height(
&rpg::SavePicture::maniac_finish_magnify_height,
LSD_Reader::ChunkSavePicture::maniac_finish_magnify_height,
Expand Down Expand Up @@ -367,6 +374,7 @@ Field<rpg::SavePicture> const* Struct<rpg::SavePicture>::fields[] = {
&static_easyrpg_blend_mode,
&static_easyrpg_type,
&static_maniac_current_magnify_height,
&static_maniac_image_data,
&static_maniac_finish_magnify_height,
NULL
};
Expand Down
5 changes: 5 additions & 0 deletions src/generated/rpg_savepicture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ std::ostream& operator<<(std::ostream& os, const SavePicture& obj) {
os << ", easyrpg_blend_mode="<< obj.easyrpg_blend_mode;
os << ", easyrpg_type="<< obj.easyrpg_type;
os << ", maniac_current_magnify_height="<< obj.maniac_current_magnify_height;
os << ", maniac_image_data=";
for (size_t i = 0; i < obj.maniac_image_data.size(); ++i) {
os << (i == 0 ? "[" : ", ") << obj.maniac_image_data[i];
}
os << "]";
os << ", maniac_finish_magnify_height="<< obj.maniac_finish_magnify_height;
os << "}";
return os;
Expand Down
9 changes: 8 additions & 1 deletion src/lcf/reader_lcf.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,18 @@ class LcfReader {
* In debug builds, dumps the content of the
* skipped chunk to stderr.
*
* @param chunk_info chunk that will be skipped.
* @param chunk_info chunk that will be skipped and dumped.
* @param where name of the caller that caused the skip, for finding unknown chunks
*/
void Skip(const struct LcfReader::Chunk& chunk_info, const char* where);

/**
* Like Skip but only dumps the content of the skipped chunk on stderr.
*
* @param length how many bytes to dump
*/
void Dump(uint32_t length);

/**
* Encodes a string to UTF-8 using the set encoding
* in the reader constructor.
Expand Down
6 changes: 5 additions & 1 deletion src/reader_lcf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,14 @@ void LcfReader::Skip(const struct LcfReader::Chunk& chunk_info, const char* wher
Log::Debug("Skipped Chunk %02X (%" PRIu32 " byte) in lcf at %" PRIX32 " (%s)",
chunk_info.ID, chunk_info.length, Tell(), where);

Dump(chunk_info.length);
}

void LcfReader::Dump(uint32_t length) {
std::stringstream ss;
ss << std::hex;

for (uint32_t i = 0; i < chunk_info.length; ++i) {
for (uint32_t i = 0; i < length; ++i) {
uint8_t byte;
LcfReader::Read(byte);
ss << std::setfill('0') << std::setw(2) << (int)byte << " ";
Expand Down
4 changes: 4 additions & 0 deletions src/reader_struct_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "lcf/lmt/reader.h"
#include "lcf/lmu/reader.h"
#include "lcf/lsd/reader.h"
#include "lcf/reader_lcf.h"
#include "reader_struct.h"
#include "lcf/rpg/save.h"
#include "log.h"
Expand Down Expand Up @@ -81,6 +82,9 @@ void Struct<S>::ReadLcf(S& obj, LcfReader& stream) {
if (bytes_read != chunk_info.length) {
Log::Warning("%s: Corrupted Chunk 0x%02" PRIx32 " (size: %" PRIu32 ", pos: 0x%" PRIx32 "): %s : Read %" PRIu32 " bytes!",
Struct<S>::name, chunk_info.ID, chunk_info.length, off, it->second->name, bytes_read);
stream.Seek(off);
stream.Dump(bytes_read);

stream.Seek(off + chunk_info.length);
}
}
Expand Down