Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: EasyRPG/liblcf
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: cd495a5
Choose a base ref
...
head repository: EasyRPG/liblcf
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 861adca
Choose a head ref
  • 5 commits
  • 24 files changed
  • 2 contributors

Commits on Apr 13, 2024

  1. Add chunk to track how often a move command failed in a move route.

    Used by "Wait for Single Movement" command
    Ghabry committed Apr 13, 2024
    Copy the full SHA
    801f82e View commit details
  2. Copy the full SHA
    41048d4 View commit details

Commits on Apr 14, 2024

  1. Do not vendor inih

    The C++ part of the library is still kept as we made changes to it.
    Ghabry committed Apr 14, 2024
    Copy the full SHA
    2693b31 View commit details

Commits on Apr 15, 2024

  1. Merge pull request #479 from Ghabry/inih-no-vendor

    Do not vendor inih
    carstene1ns authored Apr 15, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    54dff22 View commit details

Commits on Jul 31, 2024

  1. Add custom chunks to EventExecState to store event state.

    Contrary to RPG_RT this does not require adding new fields everytime a new event is added that waits.
    Ghabry committed Jul 31, 2024
    Copy the full SHA
    861adca View commit details
2 changes: 1 addition & 1 deletion .github/workflows/stable-compilation.yml
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ jobs:
apt-get update
apt-get install -y --no-install-recommends --no-install-suggests \
ca-certificates build-essential cmake ninja-build git \
libicu-dev libexpat1-dev
libicu-dev libexpat1-dev libinih-dev
- name: Clone Repository
uses: actions/checkout@v4
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -50,6 +50,11 @@ build/
# IntelliJ / CLion
.idea/

# VS Code
.vscode/
.cache/
compile_commands.json

# doxygen generated files
/doc/

@@ -72,3 +77,4 @@ test_runner*

# distribution archives
liblcf-*.tar.*

8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -27,7 +27,6 @@ set(LCF_SOURCES
src/dbarray.cpp
src/dbstring_struct.cpp
src/encoder.cpp
src/ini.cpp
src/inireader.cpp
src/ldb_equipment.cpp
src/ldb_eventcommand.cpp
@@ -201,7 +200,6 @@ set(LCF_HEADERS
src/lcf/encoder.h
src/lcf/enum_tags.h
src/lcf/flag_set.h
src/lcf/ini.h
src/lcf/inireader.h
src/lcf/ldb/reader.h
src/lcf/lmt/reader.h
@@ -343,6 +341,10 @@ set_property(TARGET lcf PROPERTY WINDOWS_EXPORT_ALL_SYMBOLS ON)
# Name of the exported library
set_property(TARGET lcf PROPERTY EXPORT_NAME liblcf)

# inih
find_package(inih REQUIRED)
target_link_libraries(lcf inih::inih)

# icu
set(LCF_SUPPORT_ICU 0)
if(LIBLCF_WITH_ICU)
@@ -380,7 +382,6 @@ set_property(TARGET lcf PROPERTY SOVERSION 0)

# installation
if(LIBLCF_ENABLE_INSTALL)

# pkg-config file generation
set(LCF_LIBDIR ${CMAKE_INSTALL_LIBDIR})
if(IS_ABSOLUTE ${LCF_LIBDIR})
@@ -441,6 +442,7 @@ if(LIBLCF_ENABLE_INSTALL)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/liblcf-config.cmake
${CMAKE_CURRENT_BINARY_DIR}/liblcf-config-version.cmake
${CMAKE_CURRENT_SOURCE_DIR}/builds/cmake/Modules/Findinih.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/liblcf
)

6 changes: 4 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -34,9 +34,11 @@ liblcf_la_CXXFLAGS = \
-std=gnu++17 \
-fno-math-errno \
$(AM_CXXFLAGS) \
$(INIH_CFLAGS) \
$(EXPAT_CFLAGS) \
$(ICU_CFLAGS)
liblcf_la_LIBADD = \
$(INIH_LIBS) \
$(EXPAT_LIBS) \
$(ICU_LIBS)
liblcf_la_LDFLAGS = \
@@ -46,7 +48,6 @@ liblcf_la_SOURCES = \
src/dbarray.cpp \
src/dbstring_struct.cpp \
src/encoder.cpp \
src/ini.cpp \
src/inireader.cpp \
src/ldb_equipment.cpp \
src/ldb_eventcommand.cpp \
@@ -219,7 +220,6 @@ lcfinclude_HEADERS = \
src/lcf/encoder.h \
src/lcf/enum_tags.h \
src/lcf/flag_set.h \
src/lcf/ini.h \
src/lcf/inireader.h \
src/lcf/log_handler.h \
src/lcf/reader_lcf.h \
@@ -347,10 +347,12 @@ test_runner_CPPFLAGS = \
test_runner_CXXFLAGS = \
-std=gnu++17 \
-DDOCTEST_CONFIG_TREAT_CHAR_STAR_AS_STRING=1 \
$(INIH_CXXFLAGS) \
$(EXPAT_CXXFLAGS) \
$(ICU_CXXFLAGS)
test_runner_LDADD = \
liblcf.la \
$(INIH_LIBS) \
$(EXPAT_LIBS) \
$(ICU_LIBS)
test_runner_LDFLAGS = -no-install
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@ Documentation is available at the documentation wiki: https://wiki.easyrpg.org

## Requirements

- [inih] for INI file reading. (required)
- [Expat] for XML reading support.
- [ICU] for character encoding detection and conversion (recommended).

63 changes: 63 additions & 0 deletions builds/cmake/Modules/Findinih.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#.rst:
# Findinih
# --------
#
# Find the inih Library
#
# Imported Targets
# ^^^^^^^^^^^^^^^^
#
# This module defines the following :prop_tgt:`IMPORTED` targets:
#
# ``inih::inih``
# The ``inih`` library, if found.
#
# Result Variables
# ^^^^^^^^^^^^^^^^
#
# This module will set the following variables in your project:
#
# ``INIH_INCLUDE_DIRS``
# where to find inih headers.
# ``INIH_LIBRARIES``
# the libraries to link against to use inih.
# ``INIH_FOUND``
# true if the inih headers and libraries were found.

find_package(PkgConfig QUIET)

pkg_check_modules(PC_INIH QUIET libinih)

# Look for the header file.
find_path(INIH_INCLUDE_DIR
NAMES ini.h
HINTS ${PC_INIH_INCLUDE_DIRS})

# Look for the library.
# Allow INIH_LIBRARY to be set manually, as the location of the inih library
if(NOT INIH_LIBRARY)
find_library(INIH_LIBRARY
NAMES libinih inih
HINTS ${PC_INIH_LIBRARY_DIRS})
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(inih
REQUIRED_VARS INIH_LIBRARY INIH_INCLUDE_DIR)

if(INIH_FOUND)
set(INIH_INCLUDE_DIRS ${INIH_INCLUDE_DIR})

if(NOT INIH_LIBRARIES)
set(INIH_LIBRARIES ${INIH_LIBRARIES})
endif()

if(NOT TARGET inih::inih)
add_library(inih::inih UNKNOWN IMPORTED)
set_target_properties(inih::inih PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${INIH_INCLUDE_DIRS}"
IMPORTED_LOCATION "${INIH_LIBRARY}")
endif()
endif()

mark_as_advanced(INIH_INCLUDE_DIR INIH_LIBRARY)
5 changes: 5 additions & 0 deletions builds/cmake/liblcf-config.cmake.in
Original file line number Diff line number Diff line change
@@ -2,6 +2,11 @@

include(CMakeFindDependencyMacro)

# Required to find our installed Findinih.cmake
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")

find_dependency(inih REQUIRED)

if(@LCF_SUPPORT_ICU@)
find_dependency(ICU COMPONENTS i18n uc data REQUIRED)
endif()
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -21,6 +21,8 @@ LT_INIT([win32-dll])
AM_CONDITIONAL(CROSS_COMPILING,[test "x$cross_compiling" = "xyes"])

# Checks for libraries.
AX_PKG_CHECK_MODULES([INIH],[],[inih],[])

AC_SUBST([LCF_SUPPORT_ICU],[0])
AC_ARG_ENABLE([icu],[AS_HELP_STRING([--disable-icu],[Disable ICU encoding handling (only windows-1252 supported) [default=no]])])
AS_IF([test "x$enable_icu" != "xno"],[
5 changes: 5 additions & 0 deletions generator/csv/enums_easyrpg.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
Structure,Entry,Value,Index
EventCommand,Code,EasyRpg_TriggerEventAt,2002
EventCommand,Code,EasyRpg_CallMovementAction,2050
EventCommand,Code,EasyRpg_WaitForSingleMovement,2051
EventCommand,Code,EasyRpg_AnimateVariable,2052
EventCommand,Code,EasyRpg_SpawnMapEvent,2056
EventCommand,Code,Maniac_GetSaveInfo,3001
EventCommand,Code,Maniac_Save,3002
EventCommand,Code,Maniac_Load,3003
4 changes: 4 additions & 0 deletions generator/csv/fields_easyrpg.csv
Original file line number Diff line number Diff line change
@@ -8,6 +8,9 @@ SaveEventExecFrame,maniac_event_id,f,Int32,0x0F,0,0,0,Event ID
SaveEventExecFrame,maniac_event_page_id,f,Int32,0x10,0,0,0,Page ID when it is a map event
SaveEventExecFrame,maniac_loop_info_size,f,Int32,0x11,0,0,0,Amount of loop info groups
SaveEventExecFrame,maniac_loop_info,f,Vector<Int32>,0x12,,0,0,"One group of (Current loop count, end loop value) for each identation"
SaveEventExecState,easyrpg_active,f,Boolean,0xC9,False,0,0,When true state of an event is preserved in easyrpg_string and easyrpg_parameters
SaveEventExecState,easyrpg_string,f,DBString,0xCA,,0,0,Preserved string data of an event
SaveEventExecState,easyrpg_parameters,f,Vector<Int32>,0xCB,,0,0,Preserved int parameter of an event
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
@@ -27,6 +30,7 @@ SaveEasyRpgText,font_size,f,Int32,0x05,12,0,0,Font size
SaveEasyRpgText,letter_spacing,f,Int32,0x06,0,0,0,Additional spacing between letters
SaveEasyRpgText,line_spacing,f,Int32,0x07,4,0,0,Additional spacing between lines
SaveEasyRpgText,flags,f,SaveEasyRpgText_Flags,0x08,3,0,0,Various text settings
SaveMapEventBase,easyrpg_move_failure_count,f,Int32,0xC9,0,0,0,Tracks how often the current move operation in a move route failed
SaveSystem,maniac_strings,f,Vector<DBString>,0x24,,0,0,rpg::Strings
SaveSystem,maniac_frameskip,,Int32,0x88,0,0,0,"FatalMix Frameskip (0=None, 1=1/5, 2=1/3, 3=1/2)"
SaveSystem,maniac_picture_limit,,Int32,0x89,0,0,0,FatalMix Picture Limit
18 changes: 16 additions & 2 deletions src/generated/lcf/lsd/chunks.h
Original file line number Diff line number Diff line change
@@ -408,6 +408,8 @@ namespace LSD_Reader {
flash_current_level = 0x54,
/** int */
flash_time_left = 0x55,
/** Tracks how often the current move operation in a move route failed */
easyrpg_move_failure_count = 0xC9,
/** */
boarding = 0x65,
/** */
@@ -522,6 +524,8 @@ namespace LSD_Reader {
flash_current_level = 0x54,
/** int */
flash_time_left = 0x55,
/** Tracks how often the current move operation in a move route failed */
easyrpg_move_failure_count = 0xC9,
/** Which vehicle */
vehicle = 0x65,
/** From 0 to 255 - In flying vehicles; remaining distance to ascend */
@@ -733,7 +737,13 @@ namespace LSD_Reader {
/** */
keyinput_timed = 0x29,
/** Used for a wait command WaitForKeyInput rm2k3 feature to wait for decision key press. */
wait_key_enter = 0x2A
wait_key_enter = 0x2A,
/** When true state of an event is preserved in easyrpg_string and easyrpg_parameters */
easyrpg_active = 0xC9,
/** Preserved string data of an event */
easyrpg_string = 0xCA,
/** Preserved int parameter of an event */
easyrpg_parameters = 0xCB
};
};
struct ChunkSaveMapEventBase {
@@ -815,7 +825,9 @@ namespace LSD_Reader {
/** double */
flash_current_level = 0x54,
/** int */
flash_time_left = 0x55
flash_time_left = 0x55,
/** Tracks how often the current move operation in a move route failed */
easyrpg_move_failure_count = 0xC9
};
};
struct ChunkSaveMapEvent {
@@ -898,6 +910,8 @@ namespace LSD_Reader {
flash_current_level = 0x54,
/** int */
flash_time_left = 0x55,
/** Tracks how often the current move operation in a move route failed */
easyrpg_move_failure_count = 0xC9,
/** If true; this event is waiting for foreground execution. */
waiting_execution = 0x65,
/** Index of custom move route */
10 changes: 10 additions & 0 deletions src/generated/lcf/rpg/eventcommand.h
Original file line number Diff line number Diff line change
@@ -157,6 +157,11 @@ namespace rpg {
Comment_2 = 22410,
ElseBranch_B = 23310,
EndBranch_B = 23311,
EasyRpg_TriggerEventAt = 2002,
EasyRpg_CallMovementAction = 2050,
EasyRpg_WaitForSingleMovement = 2051,
EasyRpg_AnimateVariable = 2052,
EasyRpg_SpawnMapEvent = 2056,
Maniac_GetSaveInfo = 3001,
Maniac_Save = 3002,
Maniac_Load = 3003,
@@ -313,6 +318,11 @@ namespace rpg {
Code::Comment_2, "Comment_2",
Code::ElseBranch_B, "ElseBranch_B",
Code::EndBranch_B, "EndBranch_B",
Code::EasyRpg_TriggerEventAt, "EasyRpg_TriggerEventAt",
Code::EasyRpg_CallMovementAction, "EasyRpg_CallMovementAction",
Code::EasyRpg_WaitForSingleMovement, "EasyRpg_WaitForSingleMovement",
Code::EasyRpg_AnimateVariable, "EasyRpg_AnimateVariable",
Code::EasyRpg_SpawnMapEvent, "EasyRpg_SpawnMapEvent",
Code::Maniac_GetSaveInfo, "Maniac_GetSaveInfo",
Code::Maniac_Save, "Maniac_Save",
Code::Maniac_Load, "Maniac_Load",
11 changes: 10 additions & 1 deletion src/generated/lcf/rpg/saveeventexecstate.h
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@
// Headers
#include <stdint.h>
#include <vector>
#include "lcf/dbstring.h"
#include "lcf/rpg/saveeventexecframe.h"
#include "lcf/context.h"
#include <ostream>
@@ -49,6 +50,9 @@ namespace rpg {
int32_t keyinput_2k3up = 0;
bool keyinput_timed = false;
bool wait_key_enter = false;
bool easyrpg_active = false;
DBString easyrpg_string;
std::vector<int32_t> easyrpg_parameters;
};

inline bool operator==(const SaveEventExecState& l, const SaveEventExecState& r) {
@@ -73,7 +77,10 @@ namespace rpg {
&& l.keyinput_2k3right == r.keyinput_2k3right
&& l.keyinput_2k3up == r.keyinput_2k3up
&& l.keyinput_timed == r.keyinput_timed
&& l.wait_key_enter == r.wait_key_enter;
&& l.wait_key_enter == r.wait_key_enter
&& l.easyrpg_active == r.easyrpg_active
&& l.easyrpg_string == r.easyrpg_string
&& l.easyrpg_parameters == r.easyrpg_parameters;
}

inline bool operator!=(const SaveEventExecState& l, const SaveEventExecState& r) {
@@ -88,6 +95,8 @@ namespace rpg {
const auto ctx1 = Context<SaveEventExecState, ParentCtx>{ "stack", i, &obj, parent_ctx };
ForEachString(obj.stack[i], f, &ctx1);
}
const auto ctx24 = Context<SaveEventExecState, ParentCtx>{ "easyrpg_string", -1, &obj, parent_ctx };
f(obj.easyrpg_string, ctx24);
(void)obj;
(void)f;
(void)parent_ctx;
4 changes: 3 additions & 1 deletion src/generated/lcf/rpg/savemapeventbase.h
Original file line number Diff line number Diff line change
@@ -67,6 +67,7 @@ namespace rpg {
int32_t flash_blue = -1;
double flash_current_level = 0.0;
int32_t flash_time_left = 0;
int32_t easyrpg_move_failure_count = 0;
};

inline bool operator==(const SaveMapEventBase& l, const SaveMapEventBase& r) {
@@ -108,7 +109,8 @@ namespace rpg {
&& l.flash_green == r.flash_green
&& l.flash_blue == r.flash_blue
&& l.flash_current_level == r.flash_current_level
&& l.flash_time_left == r.flash_time_left;
&& l.flash_time_left == r.flash_time_left
&& l.easyrpg_move_failure_count == r.easyrpg_move_failure_count;
}

inline bool operator!=(const SaveMapEventBase& l, const SaveMapEventBase& r) {
Loading