osuplusplus/include/config_def.hpp

271 lines
6.8 KiB
C++
Raw Normal View History

2024-03-18 11:25:15 +01:00
#ifndef CONFIG
#define CONFIG_DEFINED
#define CONFIG(name, ...)
#define SECTION(name, ...)
#define VAR_UINT(section, name)
#define VAR_UINT_P(section, name, prefix)
2024-03-18 11:25:15 +01:00
#define VAR_UINT_D(section, name, default)
#define VAR_INT(section, name)
#define VAR_INT_P(section, name, prefix)
2024-03-18 11:25:15 +01:00
#define VAR_INT_D(section, name, default)
#define VAR_STRING(section, name)
#define VAR_STRING_P(section, name, prefix)
2024-03-18 11:25:15 +01:00
#define VAR_STRING_D(section, name, default)
#define VAR_BOOL(section, name)
#define VAR_BOOL_P(section, name, prefix)
2024-03-18 11:25:15 +01:00
#define VAR_BOOL_D(section, name, default)
#define VAR_FLOAT(section, name)
#define VAR_FLOAT_P(section, name, prefix)
2024-03-18 11:25:15 +01:00
#define VAR_FLOAT_D(section, name, default)
2024-04-18 20:29:06 +02:00
2024-03-18 11:25:15 +01:00
#define VAR_COLOUR(section, name)
#define VAR_COLOUR_P(section, name, prefix)
2024-03-18 11:25:15 +01:00
#define VAR_COLOUR_D(section, name, default)
#define ENUM(name, ...)
#define VAR_ENUM(section, name, enum_type)
#define VAR_ENUM_P(section, name, prefix)
2024-03-18 11:25:15 +01:00
#define VAR_ENUM_D(section, name, enum_type, default)
#define STRUCT(name, ...)
#define VAR_STRUCT(section, name, struct_type)
#define VAR_STRUCT_P(section, name, prefix)
2024-03-18 11:25:15 +01:00
#define VAR_STRUCT_D(section, name, struct_type, default)
#define STRUCT_INPUT_STREAM_OP(name, ...)
#define STRUCT_OUTPUT_STREAM_OP(name, ...)
#define STRUCT_STREAM_OPS(name, ...)
2024-03-18 11:25:15 +01:00
#define VAR_LIST(section, name, type)
#define VAR_LIST_SEP(section, name, type, sep)
2024-04-21 10:40:43 +02:00
#define VAR_LIST_SEP_P(section, name, type, sep, prefix)
2024-03-18 11:25:15 +01:00
#define VAR_LIST_NUMBERED(section, name, type)
#endif // CONFIG
ENUM(Countdown,
NONE,
NORMAL,
HALF,
DOUBLE
)
ENUM(SampleSet,
DEFAULT,
NORMAL,
SOFT,
DRUM
)
ENUM(Mode,
STANDARD,
TAIKO,
CATCH,
MANIA
)
ENUM(OverlayPosition,
NO_CHANGE,
BELOW,
ABOVE
)
STRUCT(TimingPoint,
VAR_UINT(, time)
VAR_FLOAT(, beatLength)
VAR_UINT(, meter)
VAR_ENUM(, sampleSet, SampleSet)
VAR_UINT(, sampleIndex)
VAR_UINT(, volume)
VAR_BOOL(, uninherited)
VAR_UINT(, effects)
)
STRUCT_STREAM_OPS(TimingPoint, time, beatLength, meter, sampleSet, sampleIndex, volume, uninherited, effects)
2024-03-18 11:25:15 +01:00
STRUCT(HitObjectType,
VAR_UINT(, hitCircle)
VAR_UINT(, slider)
VAR_UINT(, newCombo)
VAR_UINT(, spinner)
VAR_UINT(, colourHax)
VAR_UINT(, holdNote)
2024-03-18 11:25:15 +01:00
)
STRUCT_STREAM_OPS(HitObjectType, hitCircle, slider, newCombo, spinner, colourHax, holdNote)
2024-03-18 11:25:15 +01:00
STRUCT(HitSound,
VAR_UINT(, normal)
VAR_UINT(, whistle)
VAR_UINT(, finish)
VAR_UINT(, clap)
2024-03-18 11:25:15 +01:00
)
STRUCT_STREAM_OPS(HitSound, normal, whistle, finish, clap)
2024-03-18 11:25:15 +01:00
STRUCT(HitObject,
VAR_INT(, x)
VAR_INT(, y)
VAR_INT(, time)
VAR_STRUCT(, type, HitObjectType)
VAR_STRUCT(, hitSound ,HitSound)
)
STRUCT_STREAM_OPS(HitObject, x, y, time, type, hitSound)
2024-03-18 11:25:15 +01:00
// https://osu.ppy.sh/wiki/en/Client/File_formats/osu_%28file_format%29
CONFIG(Difficulty,
VAR_UINT_P(, formatVersion, "osu file format v")
2024-03-18 11:25:15 +01:00
SECTION(general,
VAR_STRING(.general, audioFilename)
VAR_UINT_D(.general, audioLeadIn, 0)
VAR_INT_D(.general, previewTime, -1)
VAR_ENUM_D(.general, countdown, Countdown, NORMAL)
VAR_ENUM_D(.general, sampleSet, SampleSet, NORMAL)
VAR_FLOAT_D(.general, stackLeniency, 0.7)
VAR_ENUM_D(.general, mode, Mode, STANDARD)
VAR_BOOL_D(.general, letterboxInBreaks, false)
VAR_BOOL_D(.general, useSkinSprites, false)
VAR_ENUM_D(.general, overlayPosition, OverlayPosition, NO_CHANGE)
VAR_STRING(.general, skinPreference)
VAR_BOOL_D(.general, epilepsyWarning, false)
VAR_UINT_D(.general, countdownOffset, 0)
VAR_BOOL_D(.general, specialStyle, false)
VAR_BOOL_D(.general, widescreenStoryboard, false)
VAR_BOOL_D(.general, sampleMatchPlaybackRate, false)
)
SECTION(editor,
VAR_LIST_SEP(.editor, bookmarks, uint, ',')
2024-03-18 11:25:15 +01:00
VAR_FLOAT(.editor, distanceSpacing)
VAR_UINT(.editor, beatDivisor)
VAR_UINT(.editor, gridSize)
VAR_FLOAT(.editor, timelineZoom)
)
SECTION(metadata,
VAR_STRING(.metadata, title)
VAR_STRING(.metadata, titleUnicode)
VAR_STRING(.metadata, artist)
VAR_STRING(.metadata, artistUnicode)
VAR_STRING(.metadata, creator)
VAR_STRING(.metadata, version)
VAR_STRING(.metadata, source)
VAR_LIST_SEP_P(.metadata, tags, std::string, ' ', "Tags:")
2024-03-18 11:25:15 +01:00
VAR_UINT(.metadata, beatmapID)
VAR_UINT(.metadata, beatmapSetID)
)
SECTION(difficulty,
2024-04-25 22:38:12 +02:00
VAR_FLOAT_P(.difficulty, hpDrainRate, "HPDrainRate:")
2024-03-18 11:25:15 +01:00
VAR_FLOAT(.difficulty, circleSize)
VAR_FLOAT(.difficulty, overallDifficulty)
VAR_FLOAT(.difficulty, approachRate)
VAR_FLOAT(.difficulty, sliderMultiplier)
VAR_FLOAT(.difficulty, sliderTickRate)
)
SECTION(timingPoints,
VAR_LIST(.timingPoints, timingPoints, TimingPoint)
)
2024-03-18 11:25:15 +01:00
SECTION(colours,
2024-04-18 20:18:57 +02:00
VAR_LIST_NUMBERED(.colours, combo, sf::Color)
2024-03-18 11:25:15 +01:00
VAR_COLOUR(.colours, sliderTrackOverride)
VAR_COLOUR(.colours, sliderBorder)
)
SECTION(hitObjects,
VAR_LIST(.hitObjects, hitObjects, HitObject)
)
2024-03-18 11:25:15 +01:00
)
STRUCT_OUTPUT_STREAM_OP(Difficulty,
formatVersion,
general.audioFilename,
general.audioLeadIn,
general.previewTime,
general.countdown,
general.sampleSet,
general.stackLeniency,
general.mode,
general.letterboxInBreaks,
general.useSkinSprites,
general.overlayPosition,
general.skinPreference,
general.epilepsyWarning,
general.countdownOffset,
general.specialStyle,
general.widescreenStoryboard,
general.sampleMatchPlaybackRate,
editor.bookmarks,
editor.distanceSpacing,
editor.beatDivisor,
editor.gridSize,
editor.timelineZoom,
metadata.title,
metadata.titleUnicode,
metadata.artist,
metadata.artistUnicode,
metadata.creator,
metadata.version,
metadata.source,
metadata.tags,
metadata.beatmapID,
metadata.beatmapSetID,
difficulty.hpDrainRate,
difficulty.circleSize,
difficulty.overallDifficulty,
difficulty.approachRate,
difficulty.sliderMultiplier,
difficulty.sliderTickRate,
2024-04-21 10:40:07 +02:00
timingPoints.timingPoints,
colours.combo,
colours.sliderTrackOverride,
colours.sliderBorder,
2024-04-21 10:40:07 +02:00
hitObjects.hitObjects
)
2024-03-18 11:25:15 +01:00
#ifdef CONFIG_DEFINED
#undef CONFIG
#undef SECTION
#undef VAR_UINT
#undef VAR_UINT_P
2024-03-18 11:25:15 +01:00
#undef VAR_UINT_D
#undef VAR_INT
#undef VAR_INT_P
2024-03-18 11:25:15 +01:00
#undef VAR_INT_D
#undef VAR_STRING
#undef VAR_STRING_P
2024-03-18 11:25:15 +01:00
#undef VAR_STRING_D
#undef VAR_BOOL
#undef VAR_BOOL_P
2024-03-18 11:25:15 +01:00
#undef VAR_BOOL_D
#undef VAR_FLOAT
#undef VAR_FLOAT_P
2024-03-18 11:25:15 +01:00
#undef VAR_FLOAT_D
2024-04-18 20:29:06 +02:00
2024-03-18 11:25:15 +01:00
#undef VAR_COLOUR
#undef VAR_COLOUR_P
2024-03-18 11:25:15 +01:00
#undef VAR_COLOUR_D
#undef ENUM
#undef VAR_ENUM
#undef VAR_ENUM_P
2024-03-18 11:25:15 +01:00
#undef VAR_ENUM_D
#undef STRUCT
#undef VAR_STRUCT
#undef VAR_STRUCT_P
2024-03-18 11:25:15 +01:00
#undef VAR_STRUCT_D
#undef STRUCT_INPUT_STREAM_OP
#undef STRUCT_OUTPUT_STREAM_OP
#undef STRUCT_STREAM_OPS
2024-03-18 11:25:15 +01:00
#undef VAR_LIST
#undef VAR_LIST_SEP
2024-04-21 10:40:43 +02:00
#undef VAR_LIST_SEP_P
2024-03-18 11:25:15 +01:00
#undef VAR_LIST_NUMBERED
#endif // CONFIG_DEFINED