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
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ if(MSVC AND GITHUB_ACTIONS)
add_link_options(/SAFESEH:NO)
endif()

set(CMAKE_C_STANDARD 17)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_C_STANDARD 23)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON)

Expand Down
1 change: 0 additions & 1 deletion src/Lawn/Board.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
#include "../Sexy.TodLib/EffectSystem.h"
#include "../Sexy.TodLib/TodStringFile.h"
#include "../SexyAppFramework/ImageFont.h"
#include <bass.h>
#include "../SexyAppFramework/SoundManager.h"
#include "../SexyAppFramework/ButtonWidget.h"
#include "../SexyAppFramework/WidgetManager.h"
Expand Down
8 changes: 7 additions & 1 deletion src/Lawn/System/Music.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
#define __MUSIC_H__

#include <string>

// Include windows ourselves to prevent bass.h from including windows and leak macros
// IWYU pragma: begin_exports <- this suppresses clangd warning
#include "../../SexyAppFramework/Platform.h"
// IWYU pragma: end_exports
// this comment exists to prevent formatter from reordering this include

#include <bass.h>

class LawnApp;
Expand Down Expand Up @@ -103,7 +110,6 @@ class Music
void MusicInit();
void MusicDispose()
{
;
}
void MusicUpdate();
void StopAllMusic();
Expand Down
365 changes: 200 additions & 165 deletions src/Sexy.TodLib/Definition.cpp

Large diffs are not rendered by default.

50 changes: 25 additions & 25 deletions src/Sexy.TodLib/Definition.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ enum class DefFieldType : int
class DefSymbol
{
public:
int mSymbolValue; // The value of the flag bit or the numerical value corresponding to the enumeration item; if it is -1, it means that the item does not exist.
int mSymbolValue; // The value of the flag bit or the numerical value corresponding to the enumeration item; if it is -1, it means that the item does not exist.
const char *mSymbolName; // The flag or the name of the enumeration item, when a null pointer indicates that the item does not exist, is used as a marker to indicate the end of the read.
};
extern DefSymbol gParticleFlagSymbols[];
Expand All @@ -55,15 +55,15 @@ extern DefSymbol gParticleTypeSymbols[];
class DefField
{
public:
const char *mFieldName; // The name of _MemVar. Pointing to an empty character array indicates that this variable does not exist, and is therefore used as a marker to indicate the end of reading.
int mFieldOffset; // Offset within the class (understand in conjunction with assembly language)
const char *mFieldName; // The name of _MemVar. Pointing to an empty character array indicates that this variable does not exist, and is therefore used as a marker to indicate the end of reading.
int mFieldOffset; // Offset within the class (understand in conjunction with assembly language)
DefFieldType mFieldType; // *_MemVar The data storage type varies, and the reading method also differs for different types of data.
void *mExtraData; // Additional data. Used for deep copying pointer variables contained in *_MemVar.
// If _MemVar is a pointer variable pointing to other defined data, then mExtraData is a pointer to the definition structure diagram of the class defined by _MemVar;
// If _MemVar is data of a flag or enumeration type, then mExtraData is a pointer to an array of DefSymbol arrays for each of its flag data; otherwise, mExtraData is a null pointer.
// Although by using the definition structure diagram of a _DefClass class, it is possible to read all the data of the _DefClass through relevant functions (i.e., perform a shallow copy).
// However, the data pointed to by some pointer variables in _DefClass still needs to be recursively read (i.e., deep copied) based on the definition structure diagram of the corresponding type.
// In other words, by using a nested definition structure diagram, the pointers of various types of variables that originally had hierarchical relationships are "expanded" until there are no pointers in the current variable's data that can be "expanded", at which point the recursive reading ends.
void *mExtraData; // Additional data. Used for deep copying pointer variables contained in *_MemVar.
// If _MemVar is a pointer variable pointing to other defined data, then mExtraData is a pointer to the definition structure diagram of the class defined by _MemVar;
// If _MemVar is data of a flag or enumeration type, then mExtraData is a pointer to an array of DefSymbol arrays for each of its flag data; otherwise, mExtraData is a null pointer.
// Although by using the definition structure diagram of a _DefClass class, it is possible to read all the data of the _DefClass through relevant functions (i.e., perform a shallow copy).
// However, the data pointed to by some pointer variables in _DefClass still needs to be recursively read (i.e., deep copied) based on the definition structure diagram of the corresponding type.
// In other words, by using a nested definition structure diagram, the pointers of various types of variables that originally had hierarchical relationships are "expanded" until there are no pointers in the current variable's data that can be "expanded", at which point the recursive reading ends.
};

// ====================================================================================================
Expand All @@ -75,8 +75,8 @@ class DefMap
{
public:
DefField
*mMapFields; // An array of structure fields, recording the structure of each member variable in the _DefClass class within _DefClass (each record represents one structure).
int mDefSize; // The memory size occupied by a _DefClass instance, which is also the length of the initial read, is typically sizeof(_DefClass).
*mMapFields; // An array of structure fields, recording the structure of each member variable in the _DefClass class within _DefClass (each record represents one structure).
int mDefSize; // The memory size occupied by a _DefClass instance, which is also the length of the initial read, is typically sizeof(_DefClass).
void *(*mConstructorFunc)(void *); // A pointer to the constructor of an instance of type _DefClass.
};

Expand Down Expand Up @@ -118,9 +118,9 @@ class DefinitionArrayDef
public:
void *mArrayData; // An array consisting of instances of a specific defined data type, such as the "track" definition in an animation definition.
int mArrayCount; // The size of the array, such as the number of "tracks" in an animation definition or the number of "emitters" in a particle system definition.
// Define a combination of "array (pointer) + quantity" in the data class, which will be treated as a DefinitionArrayDef structure by DefField when read.
// For example, *mEmitterDefs and mEmitterDefCount under TodParticleDefinition, and *mParticleFields and mParticleFieldCount under TodEmitterDefinition.
// During reading, data items in mArrayCount are always correctly read on the first read (because they are integers), and therefore will also serve as a verification reference during the subsequent repair process of mArrayData.
// Define a combination of "array (pointer) + quantity" in the data class, which will be treated as a DefinitionArrayDef structure by DefField when read.
// For example, *mEmitterDefs and mEmitterDefCount under TodParticleDefinition, and *mParticleFields and mParticleFieldCount under TodEmitterDefinition.
// During reading, data items in mArrayCount are always correctly read on the first read (because they are integers), and therefore will also serve as a verification reference during the subsequent repair process of mArrayData.
};

// ====================================================================================================
Expand All @@ -131,7 +131,7 @@ class DefinitionArrayDef
class DefLoadResPath
{
public:
const char *mPrefix; // Image prefixes, such as "IMAGE_"
const char *mPrefix; // Image prefixes, such as "IMAGE_"
const char *mDirectory; // The folder containing the textures corresponding to the prefix, such as "images\".
};

Expand All @@ -151,30 +151,30 @@ bool DefinitionReadVector2Field(XMLParser *theXmlParser, SexyVector2 *theValue);
bool DefinitionReadArrayField(XMLParser *theXmlParser, DefinitionArrayDef *theArray, DefField *theField);
bool DefinitionReadFloatTrackField(XMLParser *theXmlParser, FloatParameterTrack *theTrack);
bool DefinitionReadFlagField(XMLParser *theXmlParser,
const SexyString &theElementName,
uintptr_t *theResultValue,
DefSymbol *theSymbolMap);
const SexyString &theElementName,
uintptr_t *theResultValue,
DefSymbol *theSymbolMap);
bool DefinitionReadImageField(XMLParser *theXmlParser, Image **theImage);
bool DefinitionReadFontField(XMLParser *theXmlParser, Font **theFont);
bool DefinitionReadField(XMLParser *theXmlParser, DefMap *theDefMap, void *theDefinition, bool *theDone);
bool DefinitionWriteCompiledFile(const SexyString &theCompiledFilePath, DefMap *theDefMap, void *theDefinition);
bool DefinitionCompileFile(const SexyString theXMLFilePath,
const SexyString &theCompiledFilePath,
DefMap *theDefMap,
void *theDefinition);
const SexyString &theCompiledFilePath,
DefMap *theDefMap,
void *theDefinition);
void *DefinitionAlloc(int theSize);
void DefinitionFree(void *&theMemory);
void *DefinitionUncompressCompiledBuffer(const CompiledDefinitionHeader *aHeader,
void *theCompressedBuffer,
size_t theCompressedBufferSize,
const SexyString &theCompiledFilePath);
void *theCompressedBuffer,
size_t theCompressedBufferSize,
const SexyString &theCompiledFilePath);
uint32_t /*__cdecl*/ DefinitionCalcHashSymbolMap(int aSchemaHash, DefSymbol *theSymbolMap);
uint32_t /*__cdecl*/ DefinitionCalcHashDefMap(int aSchemaHash, DefMap *theDefMap, TodList<DefMap *> &theProgressMaps);
uint32_t /*__cdecl*/ DefinitionCalcHash(DefMap *theDefMap);
bool DefReadFromCacheInt(void *&theReadPtr, int *theInt);
bool DefReadFromCacheFloat(void *&theReadPtr, float *theFloat);
bool DefReadFromCacheFlag(void *&theReadPtr, uint32_t *theFlag);
bool DefReadFromCacheString(void *&theReadPtr, char **theString);
bool DefReadFromCacheString(void *&theReadPtr, const char **theString);
bool DefReadFromCacheVector2(void *&theReadPtr, SexyVector2 *theVector);
bool DefReadFromCacheArray(void *&theReadPtr, DefinitionArrayDef *theArray, DefMap *theDefMap);
bool DefReadFromCacheImage(void *&theReadPtr, Image **theImage);
Expand Down
Loading
Loading