Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
06efa08
meta_filedata.h: add FileFormatsError type
ds-sloth Jul 26, 2024
521de48
MDX: add the core system
ds-sloth Jul 26, 2024
4efefd5
file_rw_meta.cpp: add exception handling
ds-sloth Jul 26, 2024
853327f
MDX: add the meta read/write system
ds-sloth Jul 26, 2024
8a5e99e
MDX: add the level read/write system
ds-sloth Jul 26, 2024
b6d2a9d
MDX: add the world read/write system
ds-sloth Jul 26, 2024
41433c0
pge_file_lib_private.h: add an inline string replacement method
ds-sloth Jul 26, 2024
8eda5b5
MDX: add the gamesave read/write system
ds-sloth Jul 26, 2024
aa4aed7
smbx64.h: optimize string load code
ds-sloth Jul 26, 2024
78520d4
smbx64.h: use optimized MDX parse sub-methods
ds-sloth Jul 26, 2024
102fb85
Create and expose callbacks API for level load
ds-sloth Jul 26, 2024
291121d
file_rw_lvl.cpp: skip sections when callbacks unavailable
ds-sloth Jul 26, 2024
7c67955
pge_base_callbacks.h: ouch, make exception inheritance public
ds-sloth Jul 29, 2024
722fa2a
PlayerPoint: fix default size to be 0 (needed for PGE-X load funcs)
ds-sloth Aug 13, 2024
96f91ba
MDX: allocate objects on heap (prevents stack overflows)
ds-sloth Nov 27, 2024
6b55791
MDX: fix various warnings
ds-sloth Nov 27, 2024
3e67e6a
CMakeLists.txt: suppress GCC warnings for likely/unlikely extensions
ds-sloth Nov 28, 2024
d64e0f5
MDX: add internal world callbacks interface
ds-sloth Dec 16, 2024
0734096
SMBX64: load world using callbacks
ds-sloth Dec 16, 2024
626af29
Add 38A world objects to callbacks interface
ds-sloth Dec 16, 2024
a285fa6
38A: load world using callbacks
ds-sloth Dec 16, 2024
11363e2
Expose world load callbacks interface
ds-sloth Dec 16, 2024
c0772cc
Add option to disable SMBX-38A support
ds-sloth Dec 16, 2024
5c4a65a
SMBX64: prefer MDX integer parser instead of stdc++
ds-sloth Dec 16, 2024
4d35ae2
mdx_level_file.cpp: add warp exit event (EEX)
ds-sloth Dec 30, 2024
8ec6992
mdx_macros.h: Fixed extra semicolon warning
Wohlstand Dec 30, 2024
09918ac
Updated Copyright Year to 2025 for new files
Wohlstand Dec 31, 2024
94f11be
MDX: actually save PlayerPoint dimensions in LVLX
ds-sloth Jan 10, 2025
ac1a368
Revert "MDX: actually save PlayerPoint dimensions in LVLX"
ds-sloth Jan 10, 2025
609541f
file_rw_lvlx.cpp: do temporarily set values to 0
ds-sloth Jan 10, 2025
ae21065
Use MDX calls to write numbers (removes iostream dependency)
ds-sloth Apr 19, 2025
0bf6d95
Move url_decode declaration to pge_file_lib_globs.h
ds-sloth Apr 19, 2025
53b62ef
Add PGE-X field engineFeatureLevel (EFL)
ds-sloth Apr 20, 2025
4621428
file_rw_lvlx.cpp: ouch, fix incorrect merge
ds-sloth Apr 21, 2025
6b86181
GamesaveData: add saved layers
ds-sloth May 5, 2025
3826fff
Revert "GamesaveData: add saved layers"
ds-sloth May 5, 2025
9bfd35c
GamesaveData: add saved layers (take 2)
ds-sloth May 5, 2025
d15d8ec
Renamed the section "LAYERS" to "SAVED_LAYERS"
Wohlstand May 5, 2025
ca32197
mdx_section.h: force use of in-place reset
ds-sloth May 6, 2025
17f8334
CMake: Added CXX condition for C++20 option
Wohlstand May 7, 2025
6dcb745
mdx_macros.h: Fixed another warning of extra semicolon
Wohlstand Jun 8, 2025
4515ad5
pge_base_callbacks.h: Allow std::string as argument
Wohlstand Jul 13, 2025
1ea1a86
Revert "pge_base_callbacks.h: Allow std::string as argument"
ds-sloth Jul 13, 2025
3d5e5c6
Attempt to fix the build on some older compilers
Wohlstand Aug 2, 2025
ec91ab8
Fixed the API of the workaround
Wohlstand Aug 2, 2025
23bd253
Better workaround: use strto* functions with similar API
Wohlstand Aug 2, 2025
d43841c
CMake: Tweaked C++20 related warnings
Wohlstand Aug 2, 2025
51c1a86
CMake: Attempt to fix macOS build in some cases
Wohlstand Aug 2, 2025
bf17c6b
MDX: Use relative paths, don't trust include paths
Wohlstand Aug 2, 2025
71cb701
CMake: Fixed Emscripten build
Wohlstand Aug 2, 2025
5cf39e3
Fixed code style
Wohlstand Aug 2, 2025
c2f1c2d
file_rw_lvlx: Fixed set-but-unused warning
Wohlstand Aug 2, 2025
b5fe450
CMake: Added PSP conditions
Wohlstand Sep 23, 2025
f92c8ae
Added missing -fPIC filter
Wohlstand Sep 24, 2025
0f1d61e
Add warp height field
ds-sloth Feb 8, 2026
01fc9f5
mdx_gamesave_file.cpp: allow skipping ID field for visible items
ds-sloth Feb 26, 2026
df18d07
Revert "mdx_gamesave_file.cpp: allow skipping ID field for visible it…
ds-sloth Mar 2, 2026
d41ddd4
SAVX: add lvl_path_count field
ds-sloth Mar 4, 2026
67230a5
AppVeyor: Disable faulty builds
Wohlstand May 31, 2026
c9e19fb
Fixed rebase confusions
Wohlstand Jun 8, 2026
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
32 changes: 16 additions & 16 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ environment:
global:
PLATFORMTOOLSET: "v140"
matrix:
- BUILD_TYPE: Debug
COMPILER: MinGW
COMPILER_FAMILY: MinGW
GENERATOR: "MinGW Makefiles"
PLATFORM: Win32
QT_BUILD: OFF
QT_PATH: C:\Qt\5.15.2\mingw81_32
APPVEYOR_BUILD_WORKER_IMAGE: "Visual Studio 2019"
- BUILD_TYPE: Release
COMPILER: MinGW
COMPILER_FAMILY: MinGW
GENERATOR: "MinGW Makefiles"
PLATFORM: Win32
QT_BUILD: OFF
QT_PATH: C:\Qt\5.15.2\mingw81_32
APPVEYOR_BUILD_WORKER_IMAGE: "Visual Studio 2019"
# - BUILD_TYPE: Debug
# COMPILER: MinGW
# COMPILER_FAMILY: MinGW
# GENERATOR: "MinGW Makefiles"
# PLATFORM: Win32
# QT_BUILD: OFF
# QT_PATH: C:\Qt\5.15.2\mingw81_32
# APPVEYOR_BUILD_WORKER_IMAGE: "Visual Studio 2019"
# - BUILD_TYPE: Release
# COMPILER: MinGW
# COMPILER_FAMILY: MinGW
# GENERATOR: "MinGW Makefiles"
# PLATFORM: Win32
# QT_BUILD: OFF
# QT_PATH: C:\Qt\5.15.2\mingw81_32
# APPVEYOR_BUILD_WORKER_IMAGE: "Visual Studio 2019"
- BUILD_TYPE: Debug
COMPILER: MinGW-w64
COMPILER_FAMILY: MinGW
Expand Down
30 changes: 27 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ if(NOT CMAKE_DEBUG_POSTFIX)
endif()

option(PGEFL_ENABLE_RWOPS "Enable SDL_RWops interfaces (if this option is enabled, then PGE-FL has a build-time dependency on SDL2's headers)" OFF)
option(PGEFL_DISABLE_SMBX38A "Disable loading of SMBX-38A content" OFF)

if(NOT DEFINED PGE_FORCE_QT5 AND NOT DEFINED PGEFL_PREFER_QT5)
option(PGE_FORCE_QT5 "Try to find Qt5 instead of Qt6 if available" ON)
Expand All @@ -47,15 +48,15 @@ macro(pgeflFindQt)
endif()
endmacro()

if(NOT DEFINED PGEFL_QT_SUPPORT AND NOT VITA AND NOT PS2)
if(NOT DEFINED PGEFL_QT_SUPPORT AND NOT VITA AND NOT PSP AND NOT PS2)
pgeflFindQt()
endif()

if(PGEFL_QT_SUPPORT)
pgeflFindQt()
endif()

if(VITA OR PS2 OR PGEFL_USE_QT5 OR PGEFL_USE_QT6)
if(VITA OR PSP OR PS2 OR PGEFL_USE_QT5 OR PGEFL_USE_QT6)
set(OPT_DEF_PGEFL_QT_SUPPORT OFF)
else()
set(OPT_DEF_PGEFL_QT_SUPPORT ON)
Expand All @@ -64,7 +65,7 @@ endif()
if(NOT PGEFL_QT_SUPPORT)
option(PGEFL_QT_SUPPORT "Build also Qt variant" ${OPT_DEF_PGEFL_QT_SUPPORT})
endif()
if(PGEFL_QT_SUPPORT AND NOT VITA AND NOT NINTENDO_3DS AND NOT NINTENDO_WII AND NOT NINTENDO_WIIU AND NOT NINTENDO_SWITCH)
if(PGEFL_QT_SUPPORT AND NOT VITA AND NOT PSP AND NOT NINTENDO_3DS AND NOT NINTENDO_WII AND NOT NINTENDO_WIIU AND NOT NINTENDO_SWITCH)
message("== PGE-FL Qt Edition WILL be built!")
if(POLICY CMP0071) # Automoc
cmake_policy(SET CMP0071 NEW)
Expand Down Expand Up @@ -103,6 +104,25 @@ if(PGEFL_ENABLE_RWOPS)
target_compile_definitions(pgefl PUBLIC -DPGEFL_ENABLE_RWOPS)
endif()

if(PGEFL_DISABLE_SMBX38A)
target_compile_definitions(pgefl PRIVATE -DPGEFL_DISABLE_SMBX38A)
endif()

if(NOT EMSCRIPTEN)
try_compile(HAS_STD_STOX_WRAPPED
${CMAKE_CURRENT_BINARY_DIR}/cmake-checks
${CMAKE_CURRENT_SOURCE_DIR}/cmake/checks/stdstrtoi/has_std_stol.cpp
CMAKE_FLAGS -DCMAKE_CXX_STANDARD=11
)
endif()

if(NOT EMSCRIPTEN AND NOT HAS_STD_STOX_WRAPPED)
target_compile_definitions(pgefl PRIVATE -DPGEFL_MISSING_STD_STOX_FUNCS)
endif()

pgefl_target_disable_cxx_warning_flag(pgefl "c++20-extensions" CPP20EXTENSIONS)
pgefl_target_disable_cxx_warning_flag(pgefl "c++20-attribute-extensions" CPP20ATTRIBEXTENSIONS)

if(PGEFL_QT_SUPPORT)
add_library(pgefl_qt STATIC
${PGE_FILE_LIBRARY_SRCS}
Expand All @@ -118,6 +138,10 @@ if(PGEFL_QT_SUPPORT)
if(PGEFL_ENABLE_RWOPS)
target_compile_definitions(pgefl_qt PUBLIC -DPGEFL_ENABLE_RWOPS)
endif()

if(PGEFL_DISABLE_SMBX38A)
target_compile_definitions(pgefl PRIVATE -DPGEFL_DISABLE_SMBX38A)
endif()
endif()

# Don't install libraries when PGE-FL was built as a part of Moondust master project
Expand Down
3 changes: 0 additions & 3 deletions CSVReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,8 @@
#ifndef CSVReader_H
#define CSVReader_H

#include <iostream>
#include <fstream>
#include <string>
#include <type_traits>
#include <sstream>
#include <array>
#include <exception>
#include <stdexcept>
Expand Down
8 changes: 8 additions & 0 deletions build_props.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ endif()
if(LIBRARY_PROJECT
AND NOT WIN32
AND NOT VITA
AND NOT PSP
AND NOT PS2
AND NOT NINTENDO_DS
AND NOT NINTENDO_3DS
Expand Down Expand Up @@ -156,3 +157,10 @@ macro(pgefl_disable_cxx_warning_flag WARNINGFLAG WARNING_VAR)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-${WARNINGFLAG}")
endif()
endmacro()

macro(pgefl_target_disable_cxx_warning_flag TARGETNAME WARNINGFLAG WARNING_VAR)
check_cxx_compiler_flag("-W${WARNINGFLAG}" HAVE_CXX_W_${WARNING_VAR})
if(HAVE_CXX_W_${WARNING_VAR})
target_compile_options(${TARGETNAME} PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:-Wno-${WARNINGFLAG}>")
endif()
endmacro()
11 changes: 11 additions & 0 deletions cmake/checks/stdstrtoi/has_std_stol.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include <string>

int main()
{
long x1 = std::stol("42");
unsigned long long x2 = std::stoull("42");
float x3 = std::stof("42.0");
double x4 = std::stod("42.0");

return 0;
}
67 changes: 67 additions & 0 deletions file_formats.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
# define PGEFL_DEPRECATED(func) func
#endif

#define PGEFL_CALLBACK_API

/*!
* \brief PGE File library class of static functions.
* Library is buildable in both Qt and STL applications
Expand All @@ -63,6 +65,8 @@ class FileFormats PGE_FILES_INHERED
static const unsigned int c_latest_version_smbx38a = 69;
static const unsigned int c_version_default = 0xFFFFFFFF;

static bool g_use_legacy_pgex_parser;


/******************************non-SMBX64 Meda-data file***********************************/
/*!
Expand Down Expand Up @@ -161,6 +165,13 @@ class FileFormats PGE_FILES_INHERED
* @return true if file successfully opened and parsed, false if error occouped
*/
static bool OpenLevelFileT(PGE_FileFormats_misc::TextInput &file, LevelData &FileData);
/**
* @brief Parses a level file data with auto-detection of a file type (SMBX1...64 LVL or PGE-LVLX)
* @param [__in] file Input file descriptor
* @param [__out] callbacks Callbacks to receive level data
* @return true if file successfully opened and parsed, false if error occouped
*/
static bool OpenLevelFileT(PGE_FileFormats_misc::TextInput &file, const LevelLoadCallbacks &callbacks);
/*!
* \brief Parses a level file header only with auto-detection of a file type (SMBX1...64 LVL or PGE-LVLX)
* \param [__in] filePath Full path to file which must be opened
Expand Down Expand Up @@ -260,6 +271,13 @@ class FileFormats PGE_FILES_INHERED
* \return true if file successfully parsed, false if error occouped
*/
static bool ReadSMBX64LvlFile(PGE_FileFormats_misc::TextInput &in, LevelData /*output*/ &FileData);
/*!
* \brief Parses SMBX1...64 level file data
* \param [__in] in Input file descriptor
* \param [__in] callbacks Callbacks for level load
* \return true if file successfully parsed, false if error occouped
*/
static bool ReadSMBX64LvlFile(PGE_FileFormats_misc::TextInput &in, const LevelLoadCallbacks &callbacks);
/*!
* \brief Generates SMBX1...64 Level file data and saves into file
* \param [__in] filePath Target file path
Expand Down Expand Up @@ -331,6 +349,13 @@ class FileFormats PGE_FILES_INHERED
* \return true if file successfully parsed, false if error occouped
*/
static bool ReadSMBX38ALvlFile(PGE_FileFormats_misc::TextInput &in, LevelData /*output*/ &FileData);
/*!
* \brief Parses SMBX-38A level file data from raw data string
* \param [__in] in File input descriptor
* \param [__out] callbacks LevelLoadCallbacks Level data structure
* \return true if file successfully parsed, false if error occouped
*/
static bool ReadSMBX38ALvlFile(PGE_FileFormats_misc::TextInput &in, const LevelLoadCallbacks &callbacks);
#if 0 // Removed
/*!
* \brief Parses SMBX-38A level file data from raw data string (Old algorithm)
Expand Down Expand Up @@ -390,6 +415,13 @@ class FileFormats PGE_FILES_INHERED
* \return true if file successfully parsed, false if error occouped
*/
static bool ReadExtendedLvlFileHeaderT(PGE_FileFormats_misc::TextInput &inf, LevelData &FileData);
/*!
* \brief Parses PGE-X Level file header from the file
* \param [__in] inf Input file descriptor
* \param [__in] callbacks Level load callbacks (will only attempt to call the load_head and on_error callbacks)
* \return true if file successfully parsed, false if error occouped
*/
static bool ReadExtendedLvlFileHeaderT(PGE_FileFormats_misc::TextInput &inf, const LevelLoadCallbacks &callbacks);
/*!
* \brief Parses PGE-X level file data from file
* \param [__in] filePath Full path to the file
Expand All @@ -412,6 +444,13 @@ class FileFormats PGE_FILES_INHERED
* \return true if file successfully parsed, false if error occouped
*/
static bool ReadExtendedLvlFile(PGE_FileFormats_misc::TextInput &in, LevelData /*output*/ &FileData);
/*!
* \brief Parses PGE-X level file data from file input descriptor
* \param [__in] in File Input descriptor
* \param [__in] callbacks Level load callbacks
* \return true if file successfully parsed, false if error occouped
*/
static bool ReadExtendedLvlFile(PGE_FileFormats_misc::TextInput &in, const LevelLoadCallbacks &callbacks);
/*!
* \brief Generates PGE-X Level file
* \param [__in] filePath Target file path
Expand Down Expand Up @@ -604,6 +643,13 @@ class FileFormats PGE_FILES_INHERED
* @return true if file successfully opened and parsed, false if error occouped
*/
static bool OpenWorldFileT(PGE_FileFormats_misc::TextInput &file, WorldData &data);
/**
* @brief Parses a level world map data with auto-detection of a file type (SMBX1...64 LVL or PGE-LVLX)
* @param [__in] file Input file descriptor
* \param [__out] callbacks WorldLoadCallbacks Callbacks to store loaded world data
* @return true if file successfully opened and parsed, false if error occouped
*/
static bool OpenWorldFileT(PGE_FileFormats_misc::TextInput &file, const WorldLoadCallbacks &data);
/*!
* \brief Parses a world map file header only with auto-detection of a file type (SMBX1...64 LVL or PGE-WLDX)
* \param [__in] filePath Full path to file which must be opened
Expand Down Expand Up @@ -691,6 +737,13 @@ class FileFormats PGE_FILES_INHERED
* \return true if file successfully parsed, false if error occouped
*/
static bool ReadSMBX64WldFile(PGE_FileFormats_misc::TextInput &in, WorldData /*output*/ &FileData);
/*!
* \brief Parses SMBX1...64 World map file from raw data from file input descriptor
* \param [__in] in File Input descriptor
* \param [__out] callbacks WorldLoadCallbacks Callbacks to store loaded world data
* \return true if file successfully parsed, false if error occouped
*/
static bool ReadSMBX64WldFile(PGE_FileFormats_misc::TextInput &in, const WorldLoadCallbacks &callbacks);
/*!
* \brief Saves level data into file of SMBX1...64 World map format
* \param [__in] filePath Target file path
Expand Down Expand Up @@ -761,6 +814,13 @@ class FileFormats PGE_FILES_INHERED
* \return true if file successfully parsed, false if error occouped
*/
static bool ReadSMBX38AWldFile(PGE_FileFormats_misc::TextInput &in, WorldData /*output*/ &FileData);
/*!
* \brief Parses SMBX-38A world map file data from raw data string
* \param [__in] in File input descriptor
* \param [__out] callbacks WorldLoadCallbacks Callbacks to store loaded world data
* \return true if file successfully parsed, false if error occouped
*/
static bool ReadSMBX38AWldFile(PGE_FileFormats_misc::TextInput &in, const WorldLoadCallbacks& callbacks);
/*!
* \brief Generates SMBX-38A Level file data and saves into file
* \param [__in] filePath Target file path
Expand Down Expand Up @@ -831,6 +891,13 @@ class FileFormats PGE_FILES_INHERED
* \return true if file successfully parsed, false if error occouped
*/
static bool ReadExtendedWldFile(PGE_FileFormats_misc::TextInput &in, WorldData /*output*/ &FileData);
/*!
* \brief Parses PGE-X World map file from file input descriptor
* \param [__in] in File Input descriptor
* \param [__out] callbacks WorldLoadCallbacks Callbacks to store loaded world data
* \return true if file successfully parsed, false if error occouped
*/
static bool ReadExtendedWldFile(PGE_FileFormats_misc::TextInput &in, const WorldLoadCallbacks& callbacks);
/*!
* \brief Saves world map data into file of PGE-X World map format
* \param [__in] filePath Target file path
Expand Down
Loading