Files
source/Utils/INIReader.h
T
00fb898600 Delete builddefines.h
Nothing was left in it but the include of profiler.h, and 132 translation units
were including it for that alone. Fifteen files were leaning on profiler.h to
drag in <set>, <vector> and <ostream> for them; those now include what they use.

This is the commit that moves line numbers. Removing an include line shifts
__LINE__ by one for everything below it, and __LINE__ is an immediate operand in
every Assert() and DebugMsg() call, so the four game executables differ from
their predecessors by roughly a thousand 32-bit constants each. Every one of
those is accounted for: each is a single immediate that moved by -1 where the
builddefines.h include went away, or +1 where a <set>/<vector> include was
added. Nothing else in .text, .rdata or .data moves, no object file's section
sizes change, and symbolize_crash and Ja2Export stay bit-identical.

The one non-immediate difference is that the 24 Editor translation units of the
non-editor apps stop emitting __Avx2WmemEnabledWeakValue, a 4-byte weak COMDAT
they only ever instantiated through profiler.h's <vector>. It is a UCRT weak
default that other translation units still provide.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-22 01:07:26 -03:00

71 lines
3.1 KiB
C++

#ifndef INIREADER_H
#define INIREADER_H
#define NOMINMAX
#include <vector>
#include <algorithm>
#include <windows.h>
#include <types.h>
#include <stack>
#include <string>
#include <vfs/Tools/vfs_property_container.h>
// Kaiden: This will read any value out of
// an INI file as long as the correct type is specified.
// Methods should be fairly self explainatory
//
// Note: readers without valid range parameters will be removed to "encourage" developers to specify
// valid ranges. Consider carefully what those values should be.
//
// Queue of error messages. They are queued because screen is not ready for I/O yet.
extern std::stack<std::string> iniErrorMessages;
class CIniReader
{
public:
CIniReader(const CHAR8* szFileName);
CIniReader(const CHAR8* szFileName, BOOLEAN Force_Custom_Data_Path); // force path for nonexisting INI files
// Warning: the following function will be removed
int ReadInteger(const CHAR8* szSection, const CHAR8* szKey, int iDefaultValue);
int ReadInteger(const CHAR8* szSection, const CHAR8* szKey, int defaultValue, int minValue, int maxValue);
//UINT32 CIniReader::testReadUINT32(void);//various limit tests of UINT and double/float handling
//front end functions that control type interpretation and range control, each calls internal ReadUINT
UINT32 ReadUINT32(const CHAR8* szSection, const CHAR8* szKey, UINT32 defaultValue, UINT32 minValue, UINT32 maxValue);
UINT16 ReadUINT16(const CHAR8* szSection, const CHAR8* szKey, UINT16 defaultValue, UINT16 minValue, UINT16 maxValue);
UINT8 ReadUINT8 (const CHAR8* szSection, const CHAR8* szKey, UINT8 defaultValue, UINT8 minValue, UINT8 maxValue);
// Warning: the following function will be removed
//double ReadDouble(const STR8 szSection, const STR8 szKey, double fltDefaultValue);
// Read_reals
DOUBLE ReadDouble(const CHAR8* szSection, const CHAR8* szKey, DOUBLE defaultValue, DOUBLE minValue, DOUBLE maxValue);
FLOAT ReadFloat (const CHAR8* szSection, const CHAR8* szKey, FLOAT defaultValue, FLOAT minValue, FLOAT maxValue);
void ReadFloatArray(const CHAR8* szSection, const CHAR8* szKey, std::vector<FLOAT>& vec);
void ReadINT32Array(const CHAR8* szSection, const CHAR8* szKey, std::vector<INT32>& vec);
BOOLEAN ReadBoolean(const CHAR8* szSection, const CHAR8* szKey, bool bolDefaultValue, bool bolDisplayError = true);
void ReadString(const CHAR8* szSection, const CHAR8* szKey, const CHAR8* szDefaultValue, STR8 input_buffer, size_t buffer_size);
// WANNE - MP: Old version, currently used by Multiplayer
STR8 ReadString(const CHAR8* szSection, const CHAR8* szKey, const CHAR8* szDefaultValue);
BOOLEAN Is_CIniReader_File_Found(void) {return (CIniReader_File_Found);}
void Clear();
static void RegisterFileForMerging(vfs::Path const& filename);
private:
vfs::PropertyContainer m_oProps;
char m_szFileName[MAX_PATH];
BOOLEAN CIniReader_File_Found;
UINT32 ReadUINT(const CHAR8* szSection, const CHAR8* szKey, UINT32 defaultValue, UINT32 minValue, UINT32 maxValue);
static std::set<vfs::Path, vfs::Path::Less> m_merge_files;
};
#endif//INIREADER_H