Fix some -Wreorder warnings

Use C++11 member initialization, to avoid having to pointlessly reorder
initializations in the constructor.
This commit is contained in:
Link Mauve 2025-06-24 01:51:03 +02:00
parent 36ad64c79b
commit 39bd7fac68
5 changed files with 121 additions and 249 deletions

View File

@ -329,42 +329,26 @@ struct RomBanner
struct GameInfo struct GameInfo
{ {
void *fROM; void *fROM = nullptr;
ROMReader_struct *reader; ROMReader_struct *reader;
u8 *romdataForReader; u8 *romdataForReader = nullptr;
u32 romsize; u32 romsize = 0;
u32 cardSize; u32 cardSize = 0;
u32 mask; u32 mask = 0;
u32 crc; u32 crc = 0;
u32 crcForCheatsDb; u32 crcForCheatsDb;
u32 chipID; u32 chipID = 0x00000FC2;
u32 romType; u32 romType = ROM_NDS;
u32 headerOffset; u32 headerOffset = 0;
char ROMserial[20]; char ROMserial[20] = {};
char ROMname[13]; char ROMname[13] = {};
bool _isDSiEnhanced; bool _isDSiEnhanced = false;
NDS_header header; NDS_header header = {};
//a copy of the pristine secure area from the rom //a copy of the pristine secure area from the rom
u8 secureArea[0x4000]; u8 secureArea[0x4000];
RomBanner banner; RomBanner banner;
const RomBanner& getRomBanner(); const RomBanner& getRomBanner();
GameInfo() : fROM(NULL),
romdataForReader(NULL),
crc(0),
chipID(0x00000FC2),
romsize(0),
cardSize(0),
mask(0),
romType(ROM_NDS),
headerOffset(0),
_isDSiEnhanced(false)
{
memset(&header, 0, sizeof(header));
memset(&ROMserial[0], 0, sizeof(ROMserial));
memset(&ROMname[0], 0, sizeof(ROMname));
}
~GameInfo() { closeROM(); } ~GameInfo() { closeROM(); }
bool IsCode(const char* code) const; bool IsCode(const char* code) const;
@ -497,48 +481,7 @@ extern int lagframecounter;
extern struct TCommonSettings extern struct TCommonSettings
{ {
TCommonSettings() TCommonSettings() {
: GFX3D_HighResolutionInterpolateColor(true)
, GFX3D_EdgeMark(true)
, GFX3D_Fog(true)
, GFX3D_Texture(true)
, GFX3D_LineHack(true)
, GFX3D_Renderer_MultisampleSize(0)
, GFX3D_Renderer_TextureScalingFactor(1) // Possible values: 1, 2, 4
, GFX3D_Renderer_TextureDeposterize(false)
, GFX3D_Renderer_TextureSmoothing(false)
, GFX3D_TXTHack(false)
, OpenGL_Emulation_ShadowPolygon(true)
, OpenGL_Emulation_SpecialZeroAlphaBlending(true)
, OpenGL_Emulation_NDSDepthCalculation(true)
, OpenGL_Emulation_DepthLEqualPolygonFacing(false)
, jit_max_block_size(12)
, loadToMemory(false)
, UseExtBIOS(false)
, SWIFromBIOS(false)
, PatchSWI3(false)
, UseExtFirmware(false)
, UseExtFirmwareSettings(false)
, RetailCardProtection8000(true)
, BootFromFirmware(false)
, DebugConsole(false)
, EnsataEmulation(false)
, cheatsDisable(false)
, rigorous_timing(false)
, advanced_timing(true)
, micMode(InternalNoise)
, spuInterpolationMode(2)
, manualBackupType(0)
, autodetectBackupMethod(0)
, spu_captureMuted(false)
, spu_advanced(true)
, StylusPressure(50)
, ConsoleType(NDS_CONSOLE_TYPE_FAT)
, backupSave(false)
, SPU_sync_mode(1)
, SPU_sync_method(0)
, WifiBridgeDeviceID(0)
{
strcpy(ARM9BIOS, "biosnds9.bin"); strcpy(ARM9BIOS, "biosnds9.bin");
strcpy(ARM7BIOS, "biosnds7.bin"); strcpy(ARM7BIOS, "biosnds7.bin");
strcpy(ExtFirmwarePath, "firmware.bin"); strcpy(ExtFirmwarePath, "firmware.bin");
@ -560,55 +503,53 @@ extern struct TCommonSettings
num_cores = NDS_GetCPUCoreCount(); num_cores = NDS_GetCPUCoreCount();
NDS_SetupDefaultFirmware(); NDS_SetupDefaultFirmware();
} }
bool GFX3D_HighResolutionInterpolateColor; bool GFX3D_HighResolutionInterpolateColor = true;
bool GFX3D_EdgeMark; bool GFX3D_EdgeMark = true;
bool GFX3D_Fog; bool GFX3D_Fog = true;
bool GFX3D_Texture; bool GFX3D_Texture = true;
bool GFX3D_LineHack; bool GFX3D_LineHack = true;
int GFX3D_Renderer_MultisampleSize; int GFX3D_Renderer_MultisampleSize = 0;
int GFX3D_Renderer_TextureScalingFactor; //must be one of {1,2,4} int GFX3D_Renderer_TextureScalingFactor = 1; //must be one of {1,2,4}
bool GFX3D_Renderer_TextureDeposterize; bool GFX3D_Renderer_TextureDeposterize = false;
bool GFX3D_Renderer_TextureSmoothing; bool GFX3D_Renderer_TextureSmoothing = false;
bool GFX3D_TXTHack; bool GFX3D_TXTHack = false;
bool OpenGL_Emulation_ShadowPolygon; bool OpenGL_Emulation_ShadowPolygon = true;
bool OpenGL_Emulation_SpecialZeroAlphaBlending; bool OpenGL_Emulation_SpecialZeroAlphaBlending = true;
bool OpenGL_Emulation_NDSDepthCalculation; bool OpenGL_Emulation_NDSDepthCalculation = true;
bool OpenGL_Emulation_DepthLEqualPolygonFacing; bool OpenGL_Emulation_DepthLEqualPolygonFacing = false;
bool loadToMemory; bool loadToMemory = false;
bool UseExtBIOS; bool UseExtBIOS = false;
char ARM9BIOS[MAX_PATH]; char ARM9BIOS[MAX_PATH];
char ARM7BIOS[MAX_PATH]; char ARM7BIOS[MAX_PATH];
bool SWIFromBIOS; bool SWIFromBIOS = false;
bool PatchSWI3; bool PatchSWI3 = false;
bool RetailCardProtection8000; bool RetailCardProtection8000 = true;
bool UseExtFirmware; bool UseExtFirmware = false;
bool UseExtFirmwareSettings; bool UseExtFirmwareSettings = false;
char ExtFirmwarePath[MAX_PATH]; char ExtFirmwarePath[MAX_PATH];
char ExtFirmwareUserSettingsPath[MAX_PATH]; char ExtFirmwareUserSettingsPath[MAX_PATH];
bool BootFromFirmware; bool BootFromFirmware = false;
FirmwareConfig fwConfig; FirmwareConfig fwConfig;
NDS_CONSOLE_TYPE ConsoleType; NDS_CONSOLE_TYPE ConsoleType = NDS_CONSOLE_TYPE_FAT;
bool DebugConsole; bool DebugConsole = false;
bool EnsataEmulation; bool EnsataEmulation = false;
bool cheatsDisable; bool cheatsDisable = false;
int num_cores; int num_cores;
bool single_core() { return num_cores==1; } bool single_core() { return num_cores==1; }
bool rigorous_timing; bool rigorous_timing = false;
struct GameHacks { struct GameHacks {
GameHacks() GameHacks() {
: en(true)
{
clear(); clear();
} }
bool en; bool en = true;
struct { struct {
bool overclock; bool overclock;
@ -619,16 +560,16 @@ extern struct TCommonSettings
void clear(); void clear();
} gamehacks; } gamehacks;
int StylusPressure; int StylusPressure = 50;
bool dispLayers[2][5]; bool dispLayers[2][5];
FAST_ALIGN bool advanced_timing; FAST_ALIGN bool advanced_timing = true;
bool use_jit; bool use_jit;
u32 jit_max_block_size; u32 jit_max_block_size = 12;
int WifiBridgeDeviceID; int WifiBridgeDeviceID = 0;
enum MicMode enum MicMode
{ {
@ -636,45 +577,44 @@ extern struct TCommonSettings
Sample = 1, Sample = 1,
Random = 2, Random = 2,
Physical = 3 Physical = 3
} micMode; } micMode = InternalNoise;
int spuInterpolationMode; int spuInterpolationMode = 2;
//this is a temporary hack until we straighten out the flushing logic and/or gxfifo //this is a temporary hack until we straighten out the flushing logic and/or gxfifo
//int gfx3d_flushMode; //int gfx3d_flushMode;
int autodetectBackupMethod; int autodetectBackupMethod = 0;
//this is the user's choice of manual backup type, for cases when the autodetection can't be trusted //this is the user's choice of manual backup type, for cases when the autodetection can't be trusted
int manualBackupType; int manualBackupType = 0;
bool backupSave; bool backupSave = false;
int SPU_sync_mode; int SPU_sync_mode = 1;
int SPU_sync_method; int SPU_sync_method = 0;
bool spu_muteChannels[16]; bool spu_muteChannels[16];
bool spu_captureMuted; bool spu_captureMuted = false;
bool spu_advanced; bool spu_advanced = true;
struct _ShowGpu { struct _ShowGpu {
_ShowGpu() : main(true), sub(true) {}
union { union {
struct { bool main,sub; }; struct {
bool main = true;
bool sub = true;
};
bool screens[2]; bool screens[2];
}; };
} showGpu; } showGpu;
struct _Hud { struct _Hud {
_Hud() bool ShowInputDisplay = false;
: ShowInputDisplay(false) bool ShowGraphicalInputDisplay = false;
, ShowGraphicalInputDisplay(false) bool FpsDisplay = false;
, FpsDisplay(false) bool FrameCounterDisplay = false;
, FrameCounterDisplay(false) bool ShowLagFrameCounter = false;
, ShowLagFrameCounter(false) bool ShowMicrophone = false;
, ShowMicrophone(false) bool ShowRTC = false;
, ShowRTC(false)
{}
bool ShowInputDisplay, ShowGraphicalInputDisplay, FpsDisplay, FrameCounterDisplay, ShowLagFrameCounter, ShowMicrophone, ShowRTC;
} hud; } hud;
std::string run_advanscene_import; std::string run_advanscene_import;

View File

@ -36,62 +36,6 @@
int _scanline_filter_a = 0, _scanline_filter_b = 2, _scanline_filter_c = 2, _scanline_filter_d = 4; int _scanline_filter_a = 0, _scanline_filter_b = 2, _scanline_filter_c = 2, _scanline_filter_d = 4;
int _commandline_linux_nojoy = 0; int _commandline_linux_nojoy = 0;
CommandLine::CommandLine()
: is_cflash_configured(false)
, _load_to_memory(-1)
, _play_movie_file(0)
, _record_movie_file(0)
, _cflash_image(0)
, _cflash_path(0)
, _gbaslot_rom(0)
, _bios_arm9(NULL)
, _bios_arm7(NULL)
, _bios_swi(0)
, _fw_path(NULL)
, _fw_boot(0)
, _spu_sync_mode(-1)
, _spu_sync_method(-1)
, _spu_advanced(0)
, _num_cores(-1)
, _rigorous_timing(0)
, _advanced_timing(-1)
, _gamehacks(-1)
, _texture_deposterize(-1)
, _texture_smooth(-1)
, _slot1(NULL)
, _slot1_fat_dir(NULL)
, _slot1_fat_dir_type(false)
, _slot1_no8000prot(0)
#ifdef HAVE_JIT
, _cpu_mode(-1)
, _jit_size(-1)
#endif
, _console_type(NULL)
, _advanscene_import(NULL)
, load_slot(-1)
, arm9_gdb_port(0)
, arm7_gdb_port(0)
, start_paused(FALSE)
, autodetect_method(-1)
, render3d(COMMANDLINE_RENDER3D_DEFAULT)
, texture_upscale(-1)
, gpu_resolution_multiplier(-1)
, language(1) //english by default
, disable_sound(0)
, disable_limiter(0)
, windowed_fullscreen(0)
, frameskip(0)
, horizontal(0)
, scale(1.0)
, _rtc_day(-1)
, _rtc_hour(-1)
{
}
CommandLine::~CommandLine()
{
}
static char mytoupper(char c) { return ::toupper(c); } static char mytoupper(char c) { return ::toupper(c); }
static std::string strtoupper(const std::string& str) static std::string strtoupper(const std::string& str)

View File

@ -43,31 +43,32 @@ class CommandLine
{ {
public: public:
//actual options: these may move to another struct //actual options: these may move to another struct
int load_slot; int load_slot = -1;
int autodetect_method; int autodetect_method = -1;
int render3d; int render3d = COMMANDLINE_RENDER3D_DEFAULT;
int texture_upscale; int texture_upscale = -1;
int gpu_resolution_multiplier; int gpu_resolution_multiplier = -1;
int language; int language = 1; // English by default
float scale; float scale = 1.0;
std::string nds_file; std::string nds_file;
std::string play_movie_file; std::string play_movie_file;
std::string record_movie_file; std::string record_movie_file;
int arm9_gdb_port, arm7_gdb_port; int arm9_gdb_port = 0;
int start_paused; int arm7_gdb_port = 0;
int start_paused = FALSE;
std::string cflash_image; std::string cflash_image;
std::string cflash_path; std::string cflash_path;
std::string gbaslot_rom; std::string gbaslot_rom;
std::string slot1; std::string slot1;
std::string console_type; std::string console_type;
std::string slot1_fat_dir; std::string slot1_fat_dir;
bool _slot1_fat_dir_type; bool _slot1_fat_dir_type = false;
int _slot1_no8000prot; int _slot1_no8000prot = 0;
int disable_sound; int disable_sound = 0;
int disable_limiter; int disable_limiter = 0;
int windowed_fullscreen; int windowed_fullscreen = 0;
int frameskip; int frameskip = 0;
int horizontal; int horizontal = 0;
bool parse(int argc,char **argv); bool parse(int argc,char **argv);
@ -78,44 +79,42 @@ public:
void process_movieCommands(); void process_movieCommands();
//etc. //etc.
void process_addonCommands(); void process_addonCommands();
bool is_cflash_configured; bool is_cflash_configured = false;
//print a little help message for cases when erroneous commandlines are entered //print a little help message for cases when erroneous commandlines are entered
void errorHelp(const char* binName); void errorHelp(const char* binName);
CommandLine(); int _spu_sync_mode = -1;
~CommandLine(); int _spu_sync_method = -1;
int _spu_sync_mode;
int _spu_sync_method;
private: private:
char* _play_movie_file; char* _play_movie_file = 0;
char* _record_movie_file; char* _record_movie_file = 0;
char* _cflash_image; char* _cflash_image = 0;
char* _cflash_path; char* _cflash_path = 0;
char* _gbaslot_rom; char* _gbaslot_rom = 0;
char* _bios_arm9, *_bios_arm7; char* _bios_arm9 = nullptr;
char* _fw_path; char* _bios_arm7 = nullptr;
int _fw_boot; char* _fw_path = nullptr;
int _load_to_memory; int _fw_boot = 0;
int _bios_swi; int _load_to_memory = -1;
int _spu_advanced; int _bios_swi = 0;
int _num_cores; int _spu_advanced = 0;
int _rigorous_timing; int _num_cores = -1;
int _advanced_timing; int _rigorous_timing = 0;
int _gamehacks; int _advanced_timing = -1;
int _texture_deposterize; int _gamehacks = -1;
int _texture_smooth; int _texture_deposterize = -1;
int _texture_smooth = -1;
#ifdef HAVE_JIT #ifdef HAVE_JIT
int _cpu_mode; int _cpu_mode = -1;
int _jit_size; int _jit_size = -1;
#endif #endif
char* _slot1; char* _slot1 = nullptr;
char *_slot1_fat_dir; char* _slot1_fat_dir = nullptr;
char* _console_type; char* _console_type = nullptr;
char* _advanscene_import; char* _advanscene_import = nullptr;
int _rtc_day; int _rtc_day = -1;
int _rtc_hour; int _rtc_hour = -1;
}; };
#endif #endif

View File

@ -425,16 +425,14 @@ class CFIRMWARE
private: private:
FWHeader _header; FWHeader _header;
std::string _fwFilePath; std::string _fwFilePath;
bool _isLoaded; bool _isLoaded = false;
u32 _userDataAddr; u32 _userDataAddr = 0x3FE00;
u16 _getBootCodeCRC16(const u8 *arm9Data, const u32 arm9Size, const u8 *arm7Data, const u32 arm7Size); u16 _getBootCodeCRC16(const u8 *arm9Data, const u32 arm9Size, const u8 *arm7Data, const u32 arm7Size);
u32 _decrypt(const u8 *in, u8* &out); u32 _decrypt(const u8 *in, u8* &out);
u32 _decompress(const u8 *in, u8* &out); u32 _decompress(const u8 *in, u8* &out);
public: public:
CFIRMWARE(): _userDataAddr(0x3FE00), _isLoaded(false) {};
bool load(const char *firmwareFilePath); bool load(const char *firmwareFilePath);
bool unpack(); bool unpack();
bool loadSettings(const char *firmwareUserSettingsFilePath); bool loadSettings(const char *firmwareUserSettingsFilePath);

View File

@ -25,13 +25,13 @@ class ADVANsCEne
private: private:
std::string database_path; std::string database_path;
time_t createTime; time_t createTime;
u32 crc32; u32 crc32 = 0;
char serial[6]; char serial[6] = {};
char version[4]; char version[4] = {};
u8 versionBase[2]; u8 versionBase[2] = {};
u8 saveType; u8 saveType = 0xFF;
bool loaded; bool loaded = false;
bool foundAsCrc, foundAsSerial; bool foundAsCrc, foundAsSerial;
// XML // XML
@ -42,15 +42,6 @@ private:
bool getXMLConfig(const char *in_filename); bool getXMLConfig(const char *in_filename);
public: public:
ADVANsCEne()
: saveType(0xFF),
crc32(0),
loaded(false)
{
memset(versionBase, 0, sizeof(versionBase));
memset(version, 0, sizeof(version));
memset(serial, 0, sizeof(serial));
}
void setDatabase(const char *path); void setDatabase(const char *path);
std::string getDatabase() const { return database_path; } std::string getDatabase() const { return database_path; }
u32 convertDB(const char *in_filename, EMUFILE &output); u32 convertDB(const char *in_filename, EMUFILE &output);