fix some compilation warnings

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Merged #396
This commit is contained in:
Edênis Freindorfer Azevedo 2019-03-25 17:30:16 -03:00 committed by Rafael Kitover
parent d919728138
commit 5540790ff1
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
61 changed files with 14193 additions and 13929 deletions

View File

@ -20,6 +20,7 @@ int g_allocCountTemp = 0;
void* SzAlloc(void* p, size_t size) void* SzAlloc(void* p, size_t size)
{ {
(void)p; // unused param
if (size == 0) if (size == 0)
return 0; return 0;
#ifdef _SZ_ALLOC_DEBUG #ifdef _SZ_ALLOC_DEBUG
@ -31,6 +32,7 @@ void* SzAlloc(void* p, size_t size)
void SzFree(void* p, void* address) void SzFree(void* p, void* address)
{ {
(void)p; // unused param
#ifdef _SZ_ALLOC_DEBUG #ifdef _SZ_ALLOC_DEBUG
if (address != 0) { if (address != 0) {
g_allocCount--; g_allocCount--;
@ -42,6 +44,7 @@ void SzFree(void* p, void* address)
void* SzAllocTemp(void* p, size_t size) void* SzAllocTemp(void* p, size_t size)
{ {
(void)p; // unused param
if (size == 0) if (size == 0)
return 0; return 0;
#ifdef _SZ_ALLOC_DEBUG #ifdef _SZ_ALLOC_DEBUG
@ -56,6 +59,7 @@ void* SzAllocTemp(void* p, size_t size)
void SzFreeTemp(void* p, void* address) void SzFreeTemp(void* p, void* address)
{ {
(void)p; // unused param
#ifdef _SZ_ALLOC_DEBUG #ifdef _SZ_ALLOC_DEBUG
if (address != 0) { if (address != 0) {
g_allocCountTemp--; g_allocCountTemp--;

View File

@ -325,24 +325,30 @@ size_t utf8_encode_char( unsigned wide, char * target )
target[5] = 0x80 | ( wide & 0x3F ); target[5] = 0x80 | ( wide & 0x3F );
wide = wide >> 6; wide = wide >> 6;
wide |= 0x4000000; wide |= 0x4000000;
break;
case 5: case 5:
target[4] = 0x80 | ( wide & 0x3F ); target[4] = 0x80 | ( wide & 0x3F );
wide = wide >> 6; wide = wide >> 6;
wide |= 0x200000; wide |= 0x200000;
break;
case 4: case 4:
target[3] = 0x80 | ( wide & 0x3F ); target[3] = 0x80 | ( wide & 0x3F );
wide = wide >> 6; wide = wide >> 6;
wide |= 0x10000; wide |= 0x10000;
break;
case 3: case 3:
target[2] = 0x80 | ( wide & 0x3F ); target[2] = 0x80 | ( wide & 0x3F );
wide = wide >> 6; wide = wide >> 6;
wide |= 0x800; wide |= 0x800;
break;
case 2: case 2:
target[1] = 0x80 | ( wide & 0x3F ); target[1] = 0x80 | ( wide & 0x3F );
wide = wide >> 6; wide = wide >> 6;
wide |= 0xC0; wide |= 0xC0;
case 1: break;
case 1:
target[0] = wide; target[0] = wide;
break;
} }
return count; return count;

File diff suppressed because it is too large Load Diff

View File

@ -66,7 +66,7 @@ bool FileExists(const char *filename)
// Get user-specific config dir manually. // Get user-specific config dir manually.
// apple: ~/Library/Application Support/ // apple: ~/Library/Application Support/
// windows: %APPDATA%\ // windows: %APPDATA%/
// unix: ${XDG_CONFIG_HOME:-~/.config}/ // unix: ${XDG_CONFIG_HOME:-~/.config}/
std::string get_xdg_user_config_home() std::string get_xdg_user_config_home()
{ {
@ -94,7 +94,7 @@ std::string get_xdg_user_config_home()
// Get user-specific data dir manually. // Get user-specific data dir manually.
// apple: ~/Library/Application Support/ // apple: ~/Library/Application Support/
// windows: %APPDATA%\ // windows: %APPDATA%/
// unix: ${XDG_DATA_HOME:-~/.local/share}/ // unix: ${XDG_DATA_HOME:-~/.local/share}/
std::string get_xdg_user_data_home() std::string get_xdg_user_data_home()
{ {

View File

@ -10,6 +10,8 @@
#define FILE_SEP '/' #define FILE_SEP '/'
#endif #endif
#define FREAD_UNCHECKED(A,B,C,D) (void)(fread(A,B,C,D) + 1)
enum IMAGE_TYPE { IMAGE_UNKNOWN = -1, IMAGE_GBA = 0, IMAGE_GB = 1 }; enum IMAGE_TYPE { IMAGE_UNKNOWN = -1, IMAGE_GBA = 0, IMAGE_GB = 1 };
// save game // save game

File diff suppressed because it is too large Load Diff

View File

@ -1,183 +1,183 @@
#ifndef _CONFIGMANAGER_H #ifndef _CONFIGMANAGER_H
#define _CONFIGMANAGER_H #define _CONFIGMANAGER_H
#pragma once #pragma once
#include "../sdl/filters.h" #include "../sdl/filters.h"
#include <stdio.h> #include <stdio.h>
#ifndef __GNUC__ #ifndef __GNUC__
#define HAVE_DECL_GETOPT 0 #define HAVE_DECL_GETOPT 0
#define __STDC__ 1 #define __STDC__ 1
#ifndef __LIBRETRO__ #ifndef __LIBRETRO__
#include "getopt.h" #include "getopt.h"
#endif #endif
#else // ! __GNUC__ #else // ! __GNUC__
#define HAVE_DECL_GETOPT 1 #define HAVE_DECL_GETOPT 1
#ifndef __LIBRETRO__ #ifndef __LIBRETRO__
#include <getopt.h> #include <getopt.h>
#endif #endif
#endif // ! __GNUC__ #endif // ! __GNUC__
#define MAX_CHEATS 16384 #define MAX_CHEATS 16384
extern bool cpuIsMultiBoot; extern bool cpuIsMultiBoot;
extern bool mirroringEnable; extern bool mirroringEnable;
extern bool parseDebug; extern bool parseDebug;
extern bool speedHack; extern bool speedHack;
extern bool speedup; extern bool speedup;
extern char *rewindMemory; extern char *rewindMemory;
extern const char *aviRecordDir; extern const char *aviRecordDir;
extern const char *biosFileNameGB; extern const char *biosFileNameGB;
extern const char *biosFileNameGBA; extern const char *biosFileNameGBA;
extern const char *biosFileNameGBC; extern const char *biosFileNameGBC;
extern const char *loadDotCodeFile; extern const char *loadDotCodeFile;
extern const char *saveDotCodeFile; extern const char *saveDotCodeFile;
extern const char *linkHostAddr; extern const char *linkHostAddr;
extern const char *movieRecordDir; extern const char *movieRecordDir;
extern const char *romDirGB; extern const char *romDirGB;
extern const char *romDirGBA; extern const char *romDirGBA;
extern const char *romDirGBC; extern const char *romDirGBC;
extern const char *soundRecordDir; extern const char *soundRecordDir;
extern int *rewindSerials; extern int *rewindSerials;
extern int active; extern int active;
extern int agbPrint; extern int agbPrint;
extern int autoFire; extern int autoFire;
extern int autoFireMaxCount; extern int autoFireMaxCount;
extern int autoFireToggle; extern int autoFireToggle;
extern int autoFrameSkip; extern int autoFrameSkip;
extern int autoLoadMostRecent; extern int autoLoadMostRecent;
extern int autoPatch; extern int autoPatch;
extern int autoSaveLoadCheatList; extern int autoSaveLoadCheatList;
extern int aviRecording; extern int aviRecording;
extern int captureFormat; extern int captureFormat;
extern int cheatsEnabled; extern int cheatsEnabled;
extern int cpuDisableSfx; extern int cpuDisableSfx;
extern int cpuSaveType; extern int cpuSaveType;
extern int dinputKeyFocus; extern int dinputKeyFocus;
extern int disableMMX; extern int disableMMX;
extern int disableStatusMessages; extern int disableStatusMessages;
extern int dsoundDisableHardwareAcceleration; extern int dsoundDisableHardwareAcceleration;
extern int filterHeight; extern int filterHeight;
extern int filterMagnification; extern int filterMagnification;
extern int filterMT; // enable multi-threading for pixel filters extern int filterMT; // enable multi-threading for pixel filters
extern int filter; extern int filter;
extern int filterWidth; extern int filterWidth;
extern int frameSkip; extern int frameSkip;
extern int frameskipadjust; extern int frameskipadjust;
extern int fsAdapter; extern int fsAdapter;
extern int fsColorDepth; extern int fsColorDepth;
extern int fsForceChange; extern int fsForceChange;
extern int fsFrequency; extern int fsFrequency;
extern int fsHeight; extern int fsHeight;
extern int fsWidth; extern int fsWidth;
extern int fullScreen; extern int fullScreen;
extern int fullScreenStretch; extern int fullScreenStretch;
extern int gdbBreakOnLoad; extern int gdbBreakOnLoad;
extern int gdbPort; extern int gdbPort;
extern int glFilter; extern int glFilter;
extern int ifbType; extern int ifbType;
extern int joypadDefault; extern int joypadDefault;
extern int languageOption; extern int languageOption;
extern int layerEnable; extern int layerEnable;
extern int layerSettings; extern int layerSettings;
extern int linkAuto; extern int linkAuto;
extern int linkHacks; extern int linkHacks;
extern int linkMode; extern int linkMode;
extern int linkNumPlayers; extern int linkNumPlayers;
extern int linkTimeout; extern int linkTimeout;
extern int maxScale; extern int maxScale;
extern int movieFrame; extern int movieFrame;
extern int moviePlayFrame; extern int moviePlayFrame;
extern int moviePlaying; extern int moviePlaying;
extern int movieRecording; extern int movieRecording;
extern int openGL; extern int openGL;
extern int autoPatch; extern int autoPatch;
extern int optFlashSize; extern int optFlashSize;
extern int optPrintUsage; extern int optPrintUsage;
extern int paused; extern int paused;
extern int pauseWhenInactive; extern int pauseWhenInactive;
extern int recentFreeze; extern int recentFreeze;
extern int renderedFrames; extern int renderedFrames;
extern int rewindCount; extern int rewindCount;
extern int rewindCounter; extern int rewindCounter;
extern int rewindPos; extern int rewindPos;
extern int rewindSaveNeeded; extern int rewindSaveNeeded;
extern int rewindTimer; extern int rewindTimer;
extern int rewindTopPos; extern int rewindTopPos;
// extern int romSize; // extern int romSize;
extern int rtcEnabled; extern int rtcEnabled;
extern int saveType; extern int saveType;
extern int screenMessage; extern int screenMessage;
extern int sensorX; extern int sensorX;
extern int sensorY; extern int sensorY;
extern int showRenderedFrames; extern int showRenderedFrames;
extern int showSpeed; extern int showSpeed;
extern int showSpeedTransparent; extern int showSpeedTransparent;
extern int sizeX; extern int sizeX;
extern int sizeY; extern int sizeY;
extern int skipBios; extern int skipBios;
extern int skipSaveGameBattery; extern int skipSaveGameBattery;
extern int skipSaveGameCheats; extern int skipSaveGameCheats;
extern int soundRecording; extern int soundRecording;
extern int speedupToggle; extern int speedupToggle;
extern int sunBars; extern int sunBars;
extern int surfaceSizeX; extern int surfaceSizeX;
extern int surfaceSizeY; extern int surfaceSizeY;
extern int threadPriority; extern int threadPriority;
extern int tripleBuffering; extern int tripleBuffering;
extern int useBios; extern int useBios;
extern int useBiosFileGB; extern int useBiosFileGB;
extern int useBiosFileGBA; extern int useBiosFileGBA;
extern int useBiosFileGBC; extern int useBiosFileGBC;
extern int videoOption; extern int videoOption;
extern int vsync; extern int vsync;
extern int wasPaused; extern int wasPaused;
extern uint32_t windowHeight; extern uint32_t windowHeight;
extern int windowPositionX; extern int windowPositionX;
extern int windowPositionY; extern int windowPositionY;
extern uint32_t windowWidth; extern uint32_t windowWidth;
extern int winFlashSize; extern int winFlashSize;
extern int winGbBorderOn; extern int winGbBorderOn;
extern int winGbPrinterEnabled; extern int winGbPrinterEnabled;
extern int winPauseNextFrame; extern int winPauseNextFrame;
extern uint32_t autoFrameSkipLastTime; extern uint32_t autoFrameSkipLastTime;
extern uint32_t movieLastJoypad; extern uint32_t movieLastJoypad;
extern uint32_t movieNextJoypad; extern uint32_t movieNextJoypad;
extern uint32_t throttle; extern uint32_t throttle;
extern uint32_t speedup_throttle; extern uint32_t speedup_throttle;
extern uint32_t speedup_frame_skip; extern uint32_t speedup_frame_skip;
extern int preparedCheats; extern int preparedCheats;
extern const char *preparedCheatCodes[MAX_CHEATS]; extern const char *preparedCheatCodes[MAX_CHEATS];
// allow up to 100 IPS/UPS/PPF patches given on commandline // allow up to 100 IPS/UPS/PPF patches given on commandline
#define PATCH_MAX_NUM 100 #define PATCH_MAX_NUM 100
extern int patchNum; extern int patchNum;
extern char *patchNames[PATCH_MAX_NUM]; // and so on extern char *patchNames[PATCH_MAX_NUM]; // and so on
extern int mouseCounter; extern int mouseCounter;
extern FilterFunc filterFunction; extern FilterFunc filterFunction;
extern IFBFilterFunc ifbFunction; extern IFBFilterFunc ifbFunction;
extern char *homeDir; extern char *homeDir;
extern const char *screenShotDir; extern const char *screenShotDir;
extern const char *saveDir; extern const char *saveDir;
extern const char *batteryDir; extern const char *batteryDir;
// Directory within homedir to use for default save location. // Directory within homedir to use for default save location.
#define DOT_DIR "visualboyadvance-m" #define DOT_DIR "visualboyadvance-m"
void SetHome(char *_arg0); void SetHome(char *_arg0);
void SaveConfigFile(); void SaveConfigFile();
void CloseConfig(); void CloseConfig();
uint32_t ReadPrefHex(const char *pref_key, int default_value); uint32_t ReadPrefHex(const char *pref_key, int default_value);
uint32_t ReadPrefHex(const char *pref_key); uint32_t ReadPrefHex(const char *pref_key);
uint32_t ReadPref(const char *pref_key, int default_value); uint32_t ReadPref(const char *pref_key, int default_value);
uint32_t ReadPref(const char *pref_key); uint32_t ReadPref(const char *pref_key);
const char *ReadPrefString(const char *pref_key, const char *default_value); const char *ReadPrefString(const char *pref_key, const char *default_value);
const char *ReadPrefString(const char *pref_key); const char *ReadPrefString(const char *pref_key);
void LoadConfigFile(int argc, char **argv); void LoadConfigFile(int argc, char **argv);
void LoadConfig(); void LoadConfig();
int ReadOpts(int argc, char **argv); int ReadOpts(int argc, char **argv);
#endif #endif

View File

@ -58,7 +58,7 @@ class SoundDriver
*/ */
virtual void write(uint16_t *finalWave, int length) = 0; virtual void write(uint16_t *finalWave, int length) = 0;
virtual void setThrottle(unsigned short throttle){}; virtual void setThrottle(unsigned short throttle) = 0;
}; };
#endif // __VBA_SOUND_DRIVER_H__ #endif // __VBA_SOUND_DRIVER_H__

View File

@ -137,7 +137,7 @@ bool SoundSDL::init(long sampleRate) {
sound_device = SDL_OpenAudioDevice(NULL, 0, &audio, &audio_spec, SDL_AUDIO_ALLOW_ANY_CHANGE); sound_device = SDL_OpenAudioDevice(NULL, 0, &audio, &audio_spec, SDL_AUDIO_ALLOW_ANY_CHANGE);
if(sound_device < 0) { if(sound_device == 0) {
std::cerr << "Failed to open audio: " << SDL_GetError() << std::endl; std::cerr << "Failed to open audio: " << SDL_GetError() << std::endl;
return false; return false;
} }

View File

@ -45,7 +45,7 @@ protected:
private: private:
RingBuffer<uint16_t> samples_buf; RingBuffer<uint16_t> samples_buf;
SDL_AudioDeviceID sound_device = -1; SDL_AudioDeviceID sound_device = 0;
SDL_mutex* mutex; SDL_mutex* mutex;
SDL_sem* data_available; SDL_sem* data_available;

View File

@ -643,7 +643,7 @@ dictionary *iniparser_load(const char *ininame)
char line[ASCIILINESZ + 1]; char line[ASCIILINESZ + 1];
char section[ASCIILINESZ + 1]; char section[ASCIILINESZ + 1];
char key[ASCIILINESZ + 1]; char key[ASCIILINESZ + 1];
char tmp[ASCIILINESZ + 1]; char tmp[2 * ASCIILINESZ + 3];
char val[ASCIILINESZ + 1]; char val[ASCIILINESZ + 1];
int last = 0; int last = 0;

View File

@ -20,7 +20,7 @@ static uint8_t *frm3 = NULL;
extern uint32_t qRGB_COLOR_MASK[2]; extern uint32_t qRGB_COLOR_MASK[2];
static void Init() void InterframeFilterInit()
{ {
frm1 = (uint8_t *)calloc(322*242,4); frm1 = (uint8_t *)calloc(322*242,4);
// 1 frame ago // 1 frame ago
@ -163,8 +163,9 @@ static void SmartIB_MMX(uint8_t *srcPtr, uint32_t srcPitch, int width, int start
void SmartIB(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height) void SmartIB(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height)
{ {
(void)width; // unused param
if(frm1 == NULL) { if(frm1 == NULL) {
Init(); InterframeFilterInit();
} }
#ifdef MMX #ifdef MMX
if(cpu_mmx) { if(cpu_mmx) {
@ -329,8 +330,9 @@ static void SmartIB32_MMX(uint8_t *srcPtr, uint32_t srcPitch, int width, int sta
void SmartIB32(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height) void SmartIB32(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height)
{ {
(void)width; // unused param
if(frm1 == NULL) { if(frm1 == NULL) {
Init(); InterframeFilterInit();
} }
#ifdef MMX #ifdef MMX
if(cpu_mmx) { if(cpu_mmx) {
@ -445,8 +447,9 @@ static void MotionBlurIB_MMX(uint8_t *srcPtr, uint32_t srcPitch, int width, int
void MotionBlurIB(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height) void MotionBlurIB(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height)
{ {
(void)width; // unused param
if(frm1 == NULL) { if(frm1 == NULL) {
Init(); InterframeFilterInit();
} }
#ifdef MMX #ifdef MMX
@ -550,8 +553,9 @@ static void MotionBlurIB32_MMX(uint8_t *srcPtr, uint32_t srcPitch, int width, in
void MotionBlurIB32(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height) void MotionBlurIB32(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height)
{ {
(void)width; // unused param
if(frm1 == NULL) { if(frm1 == NULL) {
Init(); InterframeFilterInit();
} }
#ifdef MMX #ifdef MMX
@ -569,7 +573,7 @@ void MotionBlurIB32(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, i
int sPitch = srcPitch >> 2; int sPitch = srcPitch >> 2;
int pos = 0; int pos = 0;
for (int j = 0; j < height; j++) for (int j = 0; j < height; j++)
for (int i = 0; i < sPitch; i++) { for (int i = 0; i < sPitch; i++) {
uint32_t color = src0[pos]; uint32_t color = src0[pos];
src0[pos] = (((color & colorMask) >> 1) + src0[pos] = (((color & colorMask) >> 1) +

View File

@ -5,7 +5,7 @@
extern int RGB_LOW_BITS_MASK; extern int RGB_LOW_BITS_MASK;
static void Init(); void InterframeFilterInit();
// call ifc to ignore previous frame / when starting new // call ifc to ignore previous frame / when starting new
void InterframeCleanup(); void InterframeCleanup();

View File

@ -1,38 +1,38 @@
// **************************************************************************** // ****************************************************************************
// * This file is part of the HqMAME project. It is distributed under * // * This file is part of the HqMAME project. It is distributed under *
// * GNU General Public License: http://www.gnu.org/licenses/gpl-3.0 * // * GNU General Public License: http://www.gnu.org/licenses/gpl-3.0 *
// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved * // * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// * * // * *
// * Additionally and as a special exception, the author gives permission * // * Additionally and as a special exception, the author gives permission *
// * to link the code of this program with the MAME library (or with modified * // * to link the code of this program with the MAME library (or with modified *
// * versions of MAME that use the same license as MAME), and distribute * // * versions of MAME that use the same license as MAME), and distribute *
// * linked combinations including the two. You must obey the GNU General * // * linked combinations including the two. You must obey the GNU General *
// * Public License in all respects for all of the code used other than MAME. * // * Public License in all respects for all of the code used other than MAME. *
// * If you modify this file, you may extend this exception to your version * // * If you modify this file, you may extend this exception to your version *
// * of the file, but you are not obligated to do so. If you do not wish to * // * of the file, but you are not obligated to do so. If you do not wish to *
// * do so, delete this exception statement from your version. * // * do so, delete this exception statement from your version. *
// **************************************************************************** // ****************************************************************************
#ifndef XBRZ_CONFIG_HEADER_284578425345 #ifndef XBRZ_CONFIG_HEADER_284578425345
#define XBRZ_CONFIG_HEADER_284578425345 #define XBRZ_CONFIG_HEADER_284578425345
// do NOT include any headers here! used by xBRZ_dll!!! // do NOT include any headers here! used by xBRZ_dll!!!
namespace xbrz namespace xbrz
{ {
struct ScalerCfg { struct ScalerCfg {
ScalerCfg() ScalerCfg()
: luminanceWeight(1), equalColorTolerance(30), dominantDirectionThreshold(3.6), : luminanceWeight(1), equalColorTolerance(30), dominantDirectionThreshold(3.6),
steepDirectionThreshold(2.2), newTestAttribute(0) steepDirectionThreshold(2.2), newTestAttribute(0)
{ {
} }
double luminanceWeight; double luminanceWeight;
double equalColorTolerance; double equalColorTolerance;
double dominantDirectionThreshold; double dominantDirectionThreshold;
double steepDirectionThreshold; double steepDirectionThreshold;
double newTestAttribute; // unused; test new parameters double newTestAttribute; // unused; test new parameters
}; };
} }
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -1,102 +1,102 @@
// **************************************************************************** // ****************************************************************************
// * This file is part of the HqMAME project. It is distributed under * // * This file is part of the HqMAME project. It is distributed under *
// * GNU General Public License: http://www.gnu.org/licenses/gpl-3.0 * // * GNU General Public License: http://www.gnu.org/licenses/gpl-3.0 *
// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved * // * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// * * // * *
// * Additionally and as a special exception, the author gives permission * // * Additionally and as a special exception, the author gives permission *
// * to link the code of this program with the MAME library (or with modified * // * to link the code of this program with the MAME library (or with modified *
// * versions of MAME that use the same license as MAME), and distribute * // * versions of MAME that use the same license as MAME), and distribute *
// * linked combinations including the two. You must obey the GNU General * // * linked combinations including the two. You must obey the GNU General *
// * Public License in all respects for all of the code used other than MAME. * // * Public License in all respects for all of the code used other than MAME. *
// * If you modify this file, you may extend this exception to your version * // * If you modify this file, you may extend this exception to your version *
// * of the file, but you are not obligated to do so. If you do not wish to * // * of the file, but you are not obligated to do so. If you do not wish to *
// * do so, delete this exception statement from your version. * // * do so, delete this exception statement from your version. *
// **************************************************************************** // ****************************************************************************
#ifndef XBRZ_HEADER_3847894708239054 #ifndef XBRZ_HEADER_3847894708239054
#define XBRZ_HEADER_3847894708239054 #define XBRZ_HEADER_3847894708239054
#include "config.h" #include "config.h"
#include <cstddef> //size_t #include <cstddef> //size_t
#include <limits> #include <limits>
#include <stdint.h> //uint32_t #include <stdint.h> //uint32_t
namespace xbrz namespace xbrz
{ {
/* /*
------------------------------------------------------------------------- -------------------------------------------------------------------------
| xBRZ: "Scale by rules" - high quality image upscaling filter by Zenju | | xBRZ: "Scale by rules" - high quality image upscaling filter by Zenju |
------------------------------------------------------------------------- -------------------------------------------------------------------------
using a modified approach of xBR: using a modified approach of xBR:
http://board.byuu.org/viewtopic.php?f=10&t=2248 http://board.byuu.org/viewtopic.php?f=10&t=2248
- new rule set preserving small image features - new rule set preserving small image features
- highly optimized for performance - highly optimized for performance
- support alpha channel - support alpha channel
- support multithreading - support multithreading
- support 64-bit architectures - support 64-bit architectures
- support processing image slices - support processing image slices
- support scaling up to 6xBRZ - support scaling up to 6xBRZ
*/ */
enum ColorFormat // from high bits -> low bits, 8 bit per channel enum ColorFormat // from high bits -> low bits, 8 bit per channel
{ RGB, // 8 bit for each red, green, blue, upper 8 bits unused { RGB, // 8 bit for each red, green, blue, upper 8 bits unused
ARGB, // including alpha channel, BGRA byte order on little-endian machines ARGB, // including alpha channel, BGRA byte order on little-endian machines
}; };
/* /*
-> map source (srcWidth * srcHeight) to target (scale * width x scale * height) image, optionally -> map source (srcWidth * srcHeight) to target (scale * width x scale * height) image, optionally
processing a half-open slice of rows [yFirst, yLast) only processing a half-open slice of rows [yFirst, yLast) only
-> support for source/target pitch in bytes! -> support for source/target pitch in bytes!
-> if your emulator changes only a few image slices during each cycle (e.g. DOSBox) then there's no -> if your emulator changes only a few image slices during each cycle (e.g. DOSBox) then there's no
need to run xBRZ on the complete image: need to run xBRZ on the complete image:
Just make sure you enlarge the source image slice by 2 rows on top and 2 on bottom (this is the Just make sure you enlarge the source image slice by 2 rows on top and 2 on bottom (this is the
additional range the xBRZ algorithm is using during analysis) additional range the xBRZ algorithm is using during analysis)
Caveat: If there are multiple changed slices, make sure they do not overlap after adding these Caveat: If there are multiple changed slices, make sure they do not overlap after adding these
additional rows in order to avoid a memory race condition additional rows in order to avoid a memory race condition
in the target image data if you are using multiple threads for processing each enlarged slice! in the target image data if you are using multiple threads for processing each enlarged slice!
THREAD-SAFETY: - parts of the same image may be scaled by multiple threads as long as the [yFirst, THREAD-SAFETY: - parts of the same image may be scaled by multiple threads as long as the [yFirst,
yLast) ranges do not overlap! yLast) ranges do not overlap!
- there is a minor inefficiency for the first row of a slice, so avoid processing - there is a minor inefficiency for the first row of a slice, so avoid processing
single rows only; suggestion: process 8-16 rows at least single rows only; suggestion: process 8-16 rows at least
*/ */
void scale(size_t factor, // valid range: 2 - 6 void scale(size_t factor, // valid range: 2 - 6
const uint32_t *src, int srcWidth, int srcHeight, int srcPitch, uint32_t *trg, const uint32_t *src, int srcWidth, int srcHeight, int srcPitch, uint32_t *trg,
int trgPitch, ColorFormat colFmt, const ScalerCfg &cfg = ScalerCfg(), int yFirst = 0, int trgPitch, ColorFormat colFmt, const ScalerCfg &cfg = ScalerCfg(), int yFirst = 0,
int yLast = std::numeric_limits<int>::max()); // slice of source image int yLast = std::numeric_limits<int>::max()); // slice of source image
void nearestNeighborScale(const uint32_t *src, int srcWidth, int srcHeight, uint32_t *trg, void nearestNeighborScale(const uint32_t *src, int srcWidth, int srcHeight, uint32_t *trg,
int trgWidth, int trgHeight); int trgWidth, int trgHeight);
enum SliceType { enum SliceType {
NN_SCALE_SLICE_SOURCE, NN_SCALE_SLICE_SOURCE,
NN_SCALE_SLICE_TARGET, NN_SCALE_SLICE_TARGET,
}; };
void nearestNeighborScale(const uint32_t *src, int srcWidth, int srcHeight, void nearestNeighborScale(const uint32_t *src, int srcWidth, int srcHeight,
int srcPitch, // pitch in bytes! int srcPitch, // pitch in bytes!
uint32_t *trg, int trgWidth, int trgHeight, int trgPitch, SliceType st, uint32_t *trg, int trgWidth, int trgHeight, int trgPitch, SliceType st,
int yFirst, int yLast); int yFirst, int yLast);
// parameter tuning // parameter tuning
bool equalColorTest(uint32_t col1, uint32_t col2, ColorFormat colFmt, double luminanceWeight, bool equalColorTest(uint32_t col1, uint32_t col2, ColorFormat colFmt, double luminanceWeight,
double equalColorTolerance); double equalColorTolerance);
//########################### implementation ########################### //########################### implementation ###########################
inline void nearestNeighborScale(const uint32_t *src, int srcWidth, int srcHeight, uint32_t *trg, inline void nearestNeighborScale(const uint32_t *src, int srcWidth, int srcHeight, uint32_t *trg,
int trgWidth, int trgHeight) int trgWidth, int trgHeight)
{ {
nearestNeighborScale(src, nearestNeighborScale(src,
srcWidth, srcWidth,
srcHeight, srcHeight,
srcWidth * sizeof(uint32_t), srcWidth * sizeof(uint32_t),
trg, trg,
trgWidth, trgWidth,
trgHeight, trgHeight,
trgWidth * sizeof(uint32_t), trgWidth * sizeof(uint32_t),
NN_SCALE_SLICE_TARGET, NN_SCALE_SLICE_TARGET,
0, 0,
trgHeight); trgHeight);
} }
} }
#endif #endif

View File

@ -2189,7 +2189,7 @@ static void gbSelectColorizationPalette()
} }
// Check if the checksum is in the list. // Check if the checksum is in the list.
int idx; size_t idx;
for (idx = 0; idx < sizeof(gbColorizationChecksums); idx++) { for (idx = 0; idx < sizeof(gbColorizationChecksums); idx++) {
if (gbColorizationChecksums[idx] == checksum) { if (gbColorizationChecksums[idx] == checksum) {
break; break;
@ -2201,7 +2201,7 @@ static void gbSelectColorizationPalette()
// Indexes above 0x40 have to be disambiguated. // Indexes above 0x40 have to be disambiguated.
if (idx > 0x40) { if (idx > 0x40) {
// No idea how that works. But it works. // No idea how that works. But it works.
for (int i = idx - 0x41, j = 0; i < sizeof(gbColorizationDisambigChars); i += 14, j += 14) { for (size_t i = idx - 0x41, j = 0; i < sizeof(gbColorizationDisambigChars); i += 14, j += 14) {
if (gbRom[0x0137] == gbColorizationDisambigChars[i]) { if (gbRom[0x0137] == gbColorizationDisambigChars[i]) {
infoIdx = idx + j; infoIdx = idx + j;
break; break;
@ -3430,7 +3430,7 @@ bool gbReadGSASnapshot(const char* fileName)
fseek(file, 0x4, SEEK_SET); fseek(file, 0x4, SEEK_SET);
char buffer[16]; char buffer[16];
char buffer2[16]; char buffer2[16];
fread(buffer, 1, 15, file); FREAD_UNCHECKED(buffer, 1, 15, file);
buffer[15] = 0; buffer[15] = 0;
memcpy(buffer2, &gbRom[0x134], 15); memcpy(buffer2, &gbRom[0x134], 15);
buffer2[15] = 0; buffer2[15] = 0;
@ -3443,8 +3443,6 @@ bool gbReadGSASnapshot(const char* fileName)
return false; return false;
} }
fseek(file, 0x13, SEEK_SET); fseek(file, 0x13, SEEK_SET);
size_t read = 0;
int toRead = 0;
switch (gbRomType) { switch (gbRomType) {
case 0x03: case 0x03:
case 0x0f: case 0x0f:
@ -3453,13 +3451,11 @@ bool gbReadGSASnapshot(const char* fileName)
case 0x1b: case 0x1b:
case 0x1e: case 0x1e:
case 0xff: case 0xff:
read = fread(gbRam, 1, (gbRamSizeMask + 1), file); FREAD_UNCHECKED(gbRam, 1, (gbRamSizeMask + 1), file);
toRead = (gbRamSizeMask + 1);
break; break;
case 0x06: case 0x06:
case 0x22: case 0x22:
read = fread(&gbMemory[0xa000], 1, 256, file); FREAD_UNCHECKED(&gbMemory[0xa000], 1, 256, file);
toRead = 256;
break; break;
default: default:
systemMessage(MSG_UNSUPPORTED_SNAPSHOT_FILE, systemMessage(MSG_UNSUPPORTED_SNAPSHOT_FILE,

View File

@ -416,10 +416,10 @@ bool gbCheatReadGSCodeFile(const char* fileName)
char code[9]; char code[9];
int i; int i;
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
fread(&dummy, 1, 2, file); FREAD_UNCHECKED(&dummy, 1, 2, file);
fread(desc, 1, 12, file); FREAD_UNCHECKED(desc, 1, 12, file);
desc[12] = 0; desc[12] = 0;
fread(code, 1, 8, file); FREAD_UNCHECKED(code, 1, 8, file);
code[8] = 0; code[8] = 0;
gbAddGsCheat(code, desc); gbAddGsCheat(code, desc);
} }

View File

@ -991,8 +991,17 @@ mapperHuC3 gbDataHuC3 = {
1, // ROM bank 1, // ROM bank
0, // RAM bank 0, // RAM bank
0, // RAM address 0, // RAM address
0, // Address
0, // RAM flag 0, // RAM flag
0 // RAM read value 0, // RAM read value
0, // Register 1
0, // Register 2
0, // Register 3
0, // Register 4
0, // Register 5
0, // Register 6
0, // Register 7
0 // Register 8
}; };
// HuC3 ROM write registers // HuC3 ROM write registers

View File

@ -67,7 +67,7 @@ void gbSgbReset()
gbSgbNextController = 0x0f; gbSgbNextController = 0x0f;
gbSgbReadingController = 0; gbSgbReadingController = 0;
memset(gbSgbSCPPalette, 0, 512 * 4); memset(gbSgbSCPPalette, 0, 512 * 4 * sizeof(uint16_t));
memset(gbSgbATF, 0, 20 * 18); memset(gbSgbATF, 0, 20 * 18);
memset(gbSgbATFList, 0, 45 * 20 * 18); memset(gbSgbATFList, 0, 45 * 20 * 18);
memset(gbSgbPacket, 0, 16 * 7); memset(gbSgbPacket, 0, 16 * 7);

File diff suppressed because it is too large Load Diff

View File

@ -2055,15 +2055,15 @@ bool cheatsImportGSACodeFile(const char* name, int game, bool v3)
found = true; found = true;
break; break;
} }
fread(&len, 1, 4, f); FREAD_UNCHECKED(&len, 1, 4, f);
fseek(f, len, SEEK_CUR); fseek(f, len, SEEK_CUR);
int codes = 0; int codes = 0;
fread(&codes, 1, 4, f); FREAD_UNCHECKED(&codes, 1, 4, f);
while (codes > 0) { while (codes > 0) {
fread(&len, 1, 4, f); FREAD_UNCHECKED(&len, 1, 4, f);
fseek(f, len, SEEK_CUR); fseek(f, len, SEEK_CUR);
fseek(f, 8, SEEK_CUR); fseek(f, 8, SEEK_CUR);
fread(&len, 1, 4, f); FREAD_UNCHECKED(&len, 1, 4, f);
fseek(f, len * 12, SEEK_CUR); fseek(f, len * 12, SEEK_CUR);
codes--; codes--;
} }
@ -2073,26 +2073,26 @@ bool cheatsImportGSACodeFile(const char* name, int game, bool v3)
if (found) { if (found) {
char desc[256]; char desc[256];
char code[17]; char code[17];
fread(&len, 1, 4, f); FREAD_UNCHECKED(&len, 1, 4, f);
fseek(f, len, SEEK_CUR); fseek(f, len, SEEK_CUR);
int codes = 0; int codes = 0;
fread(&codes, 1, 4, f); FREAD_UNCHECKED(&codes, 1, 4, f);
while (codes > 0) { while (codes > 0) {
fread(&len, 1, 4, f); FREAD_UNCHECKED(&len, 1, 4, f);
if (len > 255) if (len > 255)
goto evil_gsa_code_file; //XXX: this functione needs a rewrite in general, so for the short this is better than nothing goto evil_gsa_code_file; //XXX: this functione needs a rewrite in general, so for the short this is better than nothing
fread(desc, 1, len, f); FREAD_UNCHECKED(desc, 1, len, f);
desc[len] = 0; desc[len] = 0;
desc[31] = 0; desc[31] = 0;
fread(&len, 1, 4, f); FREAD_UNCHECKED(&len, 1, 4, f);
fseek(f, len, SEEK_CUR); fseek(f, len, SEEK_CUR);
fseek(f, 4, SEEK_CUR); fseek(f, 4, SEEK_CUR);
fread(&len, 1, 4, f); FREAD_UNCHECKED(&len, 1, 4, f);
while (len) { while (len) {
fseek(f, 4, SEEK_CUR); fseek(f, 4, SEEK_CUR);
fread(code, 1, 8, f); FREAD_UNCHECKED(code, 1, 8, f);
fseek(f, 4, SEEK_CUR); fseek(f, 4, SEEK_CUR);
fread(&code[8], 1, 8, f); FREAD_UNCHECKED(&code[8], 1, 8, f);
code[16] = 0; code[16] = 0;
cheatsAddGSACode(code, desc, v3); cheatsAddGSACode(code, desc, v3);
len -= 2; len -= 2;
@ -2734,16 +2734,16 @@ bool cheatsLoadCheatList(const char* file)
} }
} else if (type == 0) { } else if (type == 0) {
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
fread(&cheatsList[i].code, 1, sizeof(int), f); FREAD_UNCHECKED(&cheatsList[i].code, 1, sizeof(int), f);
fread(&cheatsList[i].size, 1, sizeof(int), f); FREAD_UNCHECKED(&cheatsList[i].size, 1, sizeof(int), f);
fread(&cheatsList[i].status, 1, sizeof(int), f); FREAD_UNCHECKED(&cheatsList[i].status, 1, sizeof(int), f);
fread(&cheatsList[i].enabled, 1, sizeof(int), f); FREAD_UNCHECKED(&cheatsList[i].enabled, 1, sizeof(int), f);
cheatsList[i].enabled = cheatsList[i].enabled ? true : false; cheatsList[i].enabled = cheatsList[i].enabled ? true : false;
fread(&cheatsList[i].address, 1, sizeof(uint32_t), f); FREAD_UNCHECKED(&cheatsList[i].address, 1, sizeof(uint32_t), f);
cheatsList[i].rawaddress = cheatsList[i].address; cheatsList[i].rawaddress = cheatsList[i].address;
fread(&cheatsList[i].value, 1, sizeof(uint32_t), f); FREAD_UNCHECKED(&cheatsList[i].value, 1, sizeof(uint32_t), f);
fread(&cheatsList[i].oldValue, 1, sizeof(uint32_t), f); FREAD_UNCHECKED(&cheatsList[i].oldValue, 1, sizeof(uint32_t), f);
fread(&cheatsList[i].codestring, 1, 20 * sizeof(char), f); FREAD_UNCHECKED(&cheatsList[i].codestring, 1, 20 * sizeof(char), f);
if (fread(&cheatsList[i].desc, 1, 32 * sizeof(char), f) != 32 * sizeof(char)) { if (fread(&cheatsList[i].desc, 1, 32 * sizeof(char), f) != 32 * sizeof(char)) {
fclose(f); fclose(f);
return false; return false;

View File

@ -1007,21 +1007,21 @@ bool CPUReadGSASnapshot(const char* fileName)
// long size = ftell(file); // long size = ftell(file);
fseek(file, 0x0, SEEK_SET); fseek(file, 0x0, SEEK_SET);
fread(&i, 1, 4, file); FREAD_UNCHECKED(&i, 1, 4, file);
fseek(file, i, SEEK_CUR); // Skip SharkPortSave fseek(file, i, SEEK_CUR); // Skip SharkPortSave
fseek(file, 4, SEEK_CUR); // skip some sort of flag fseek(file, 4, SEEK_CUR); // skip some sort of flag
fread(&i, 1, 4, file); // name length FREAD_UNCHECKED(&i, 1, 4, file); // name length
fseek(file, i, SEEK_CUR); // skip name fseek(file, i, SEEK_CUR); // skip name
fread(&i, 1, 4, file); // desc length FREAD_UNCHECKED(&i, 1, 4, file); // desc length
fseek(file, i, SEEK_CUR); // skip desc fseek(file, i, SEEK_CUR); // skip desc
fread(&i, 1, 4, file); // notes length FREAD_UNCHECKED(&i, 1, 4, file); // notes length
fseek(file, i, SEEK_CUR); // skip notes fseek(file, i, SEEK_CUR); // skip notes
int saveSize; int saveSize;
fread(&saveSize, 1, 4, file); // read length FREAD_UNCHECKED(&saveSize, 1, 4, file); // read length
saveSize -= 0x1c; // remove header size saveSize -= 0x1c; // remove header size
char buffer[17]; char buffer[17];
char buffer2[17]; char buffer2[17];
fread(buffer, 1, 16, file); FREAD_UNCHECKED(buffer, 1, 16, file);
buffer[16] = 0; buffer[16] = 0;
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
if (buffer[i] < 32) if (buffer[i] < 32)
@ -1074,7 +1074,7 @@ bool CPUReadGSASPSnapshot(const char* fileName)
// read save name // read save name
fseek(file, namepos, SEEK_SET); fseek(file, namepos, SEEK_SET);
fread(savename, 1, namesz, file); FREAD_UNCHECKED(savename, 1, namesz, file);
savename[namesz] = 0; savename[namesz] = 0;
memcpy(romname, &rom[0xa0], namesz); memcpy(romname, &rom[0xa0], namesz);
@ -1091,7 +1091,7 @@ bool CPUReadGSASPSnapshot(const char* fileName)
// read footer tag // read footer tag
fseek(file, footerpos, SEEK_SET); fseek(file, footerpos, SEEK_SET);
fread(footer, 1, footersz, file); FREAD_UNCHECKED(footer, 1, footersz, file);
footer[footersz] = 0; footer[footersz] = 0;
if (memcmp(footer, gsvfooter, footersz)) { if (memcmp(footer, gsvfooter, footersz)) {
@ -1106,7 +1106,7 @@ bool CPUReadGSASPSnapshot(const char* fileName)
} }
// Read up to 128k save // Read up to 128k save
fread(flashSaveMemory, 1, FLASH_128K_SZ, file); FREAD_UNCHECKED(flashSaveMemory, 1, FLASH_128K_SZ, file);
fclose(file); fclose(file);
CPUReset(); CPUReset();

View File

@ -3,6 +3,7 @@
#include "../common/Types.h" #include "../common/Types.h"
#include "../System.h" #include "../System.h"
#include "../Util.h"
const uint64_t TICKS_PER_SECOND = 16777216; const uint64_t TICKS_PER_SECOND = 16777216;

View File

@ -609,6 +609,7 @@ void EnableSpeedHacks(bool enable)
void BootLink(int m_type, const char* hostAddr, int timeout, bool m_hacks, int m_numplayers) void BootLink(int m_type, const char* hostAddr, int timeout, bool m_hacks, int m_numplayers)
{ {
(void)m_numplayers; // unused param
if (linkDriver) { if (linkDriver) {
// Connection has already been established // Connection has already been established
return; return;
@ -888,7 +889,7 @@ bool CableServer::RecvGB(void)
if (counter == 1) if (counter == 1)
return false; return false;
int numbytes; int numbytes = 0;
if (lanlink.type == 0) { // TCP if (lanlink.type == 0) { // TCP
fdset.clear(); fdset.clear();
@ -1230,6 +1231,7 @@ void StartCableSocket(uint16_t value)
static void UpdateCableSocket(int ticks) static void UpdateCableSocket(int ticks)
{ {
(void)ticks; // unused param
if (linkid && transfer_direction == SENDING && lc.transferring && linktime >= transfer_start_time_from_master) { if (linkid && transfer_direction == SENDING && lc.transferring && linktime >= transfer_start_time_from_master) {
cable_data[linkid] = READ16LE(&ioMem[COMM_SIODATA8]); cable_data[linkid] = READ16LE(&ioMem[COMM_SIODATA8]);
@ -2199,7 +2201,8 @@ static void StartRFUSocket(uint16_t value)
case 0x24: // send [non-important] data (used by server often) case 0x24: // send [non-important] data (used by server often)
rfu_data.rfu_linktime[linkid] = linktime; //save the ticks before reseted to zero rfu_data.rfu_linktime[linkid] = linktime; //save the ticks before reseted to zero
if (rfu_cansend && rfu_qsend2 >= 0) { // rfu_qsend2 >= 0 due to being `uint8_t`
if (rfu_cansend) {
if (rfu_ishost) { if (rfu_ishost) {
for (int j = 0; j < rfu_data.numgbas; j++) for (int j = 0; j < rfu_data.numgbas; j++)
if (j != linkid) { if (j != linkid) {
@ -2560,7 +2563,7 @@ uint16_t gbLinkUpdate(uint8_t b, int gbSerialOn) //used on external clock
rfu_enabled = false; rfu_enabled = false;
if (gbSerialOn) { if (gbSerialOn) {
if (gba_link_enabled) if (gba_link_enabled) {
//Single Computer //Single Computer
if (GetLinkMode() == LINK_GAMEBOY_IPC) { if (GetLinkMode() == LINK_GAMEBOY_IPC) {
#if (defined __WIN32__ || defined _WIN32) #if (defined __WIN32__ || defined _WIN32)
@ -2595,7 +2598,7 @@ uint16_t gbLinkUpdate(uint8_t b, int gbSerialOn) //used on external clock
} }
} }
} }
}
if (dat == 0xff /*||dat==0x00||b==0x00*/) //dat==0xff||dat==0x00 if (dat == 0xff /*||dat==0x00||b==0x00*/) //dat==0xff||dat==0x00
LinkFirstTime = true; LinkFirstTime = true;
} }

View File

@ -59,6 +59,7 @@ char GBASockClient::ReceiveCmd(char* data_in, bool block)
void GBASockClient::ReceiveClock(bool block) void GBASockClient::ReceiveClock(bool block)
{ {
(void)block; // unused param
if (IsDisconnected()) if (IsDisconnected())
return; return;

View File

@ -56,7 +56,7 @@ static inline uint32_t CPUReadMemory(uint32_t address)
} }
} }
#endif #endif
uint32_t value; uint32_t value = 0;
uint32_t oldAddress = address; uint32_t oldAddress = address;
if (address & 3) { if (address & 3) {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,9 @@
extern unsigned char* DotCodeData; extern unsigned char* DotCodeData;
extern char filebuffer[]; extern char filebuffer[];
int OpenDotCodeFile(void); int OpenDotCodeFile(void);
int CheckEReaderRegion(void); int CheckEReaderRegion(void);
int LoadDotCodeData(int size, uint32_t* DCdata, unsigned long MEM1, unsigned long MEM2); int LoadDotCodeData(int size, uint32_t* DCdata, unsigned long MEM1, unsigned long MEM2);
void EReaderWriteMemory(uint32_t address, uint32_t value); void EReaderWriteMemory(uint32_t address, uint32_t value);
void BIOS_EReader_ScanCard(int swi_num); void BIOS_EReader_ScanCard(int swi_num);

View File

@ -349,6 +349,7 @@ void debuggerDontBreak(int n, char** args)
void debuggerDontBreakClear(int n, char** args) void debuggerDontBreakClear(int n, char** args)
{ {
(void)args; // unused params
if (n == 1) { if (n == 1) {
debuggerNumOfDontBreak = 0; debuggerNumOfDontBreak = 0;
{ {
@ -782,7 +783,7 @@ unsigned int AddressToGBA(uint8_t* mem)
void debuggerDoSearch() void debuggerDoSearch()
{ {
int count = 0; unsigned int count = 0;
while (true) { while (true) {
unsigned int final = SearchStart + SearchLength - 1; unsigned int final = SearchStart + SearchLength - 1;
@ -1882,6 +1883,8 @@ void debuggerSymbols(int argc, char** argv)
void debuggerWhere(int n, char** args) void debuggerWhere(int n, char** args)
{ {
(void)n; // unused params
(void)args; // unused params
void elfPrintCallChain(uint32_t); void elfPrintCallChain(uint32_t);
elfPrintCallChain(armNextPC); elfPrintCallChain(armNextPC);
} }
@ -1958,6 +1961,7 @@ void debuggerVar(int n, char** args)
bool debuggerBreakOnExecution(uint32_t address, uint8_t state) bool debuggerBreakOnExecution(uint32_t address, uint8_t state)
{ {
(void)state; // unused params
if (dontBreakNow) if (dontBreakNow)
return false; return false;
if (debuggerInDB(address)) if (debuggerInDB(address))
@ -1975,6 +1979,7 @@ bool debuggerBreakOnExecution(uint32_t address, uint8_t state)
bool debuggerBreakOnRead(uint32_t address, int size) bool debuggerBreakOnRead(uint32_t address, int size)
{ {
(void)size; // unused params
if (dontBreakNow) if (dontBreakNow)
return false; return false;
if (debuggerInDB(armState ? reg[15].I - 4 : reg[15].I - 2)) if (debuggerInDB(armState ? reg[15].I - 4 : reg[15].I - 2))
@ -1996,6 +2001,8 @@ bool debuggerBreakOnRead(uint32_t address, int size)
bool debuggerBreakOnWrite(uint32_t address, uint32_t value, int size) bool debuggerBreakOnWrite(uint32_t address, uint32_t value, int size)
{ {
(void)value; // unused params
(void)size; // unused params
if (dontBreakNow) if (dontBreakNow)
return false; return false;
if (debuggerInDB(armState ? reg[15].I - 4 : reg[15].I - 2)) if (debuggerInDB(armState ? reg[15].I - 4 : reg[15].I - 2))
@ -2019,6 +2026,8 @@ bool debuggerBreakOnWrite(uint32_t address, uint32_t value, int size)
void debuggerBreakOnWrite(uint32_t address, uint32_t oldvalue, uint32_t value, int size, int t) void debuggerBreakOnWrite(uint32_t address, uint32_t oldvalue, uint32_t value, int size, int t)
{ {
(void)oldvalue; // unused params
(void)t; // unused params
debuggerBreakOnWrite(address, value, size); debuggerBreakOnWrite(address, value, size);
//uint32_t lastValue; //uint32_t lastValue;
//dexp_eval("old_value", &lastValue); //dexp_eval("old_value", &lastValue);
@ -2677,6 +2686,8 @@ void deleteBreak(uint32_t address, uint8_t flags, char** expression, int howToDe
} }
void clearBreaks(uint32_t address, uint8_t flags, char** expression, int howToClear) void clearBreaks(uint32_t address, uint8_t flags, char** expression, int howToClear)
{ {
(void)address; // unused params
(void)expression; // unused params
if (howToClear == 2) { if (howToClear == 2) {
removeConditionalWithFlag(flags, true); removeConditionalWithFlag(flags, true);
removeConditionalWithFlag(flags << 4, true); removeConditionalWithFlag(flags << 4, true);
@ -2692,6 +2703,7 @@ void clearBreaks(uint32_t address, uint8_t flags, char** expression, int howToCl
void listBreaks(uint32_t address, uint8_t flags, char** expression, int howToList) void listBreaks(uint32_t address, uint8_t flags, char** expression, int howToList)
{ {
(void)expression; // unused params
flags |= (flags << 4); flags |= (flags << 4);
if (howToList) { if (howToList) {
printAllFlagConditionalsWithAddress(address, flags, true); printAllFlagConditionalsWithAddress(address, flags, true);
@ -2896,8 +2908,7 @@ void executeBreakCommands(int n, char** cmd)
operation(address, flag, cmd + 1, n - 1); operation(address, flag, cmd + 1, n - 1);
return; return;
} }
//brkcmd_special_register:
brkcmd_special_register:
switch (command[4]) { switch (command[4]) {
case 'l': case 'l':
debuggerBreakRegisterList((n > 0) && (tolower(cmd[0][0]) == 'v')); debuggerBreakRegisterList((n > 0) && (tolower(cmd[0][0]) == 'v'));
@ -3786,7 +3797,7 @@ void remoteSetBreakPoint(char* p)
void remoteClearBreakPoint(char* p) void remoteClearBreakPoint(char* p)
{ {
int result; int result = 0;
uint32_t address; uint32_t address;
int count; int count;
sscanf(p, ",%x,%x#", &address, &count); sscanf(p, ",%x,%x#", &address, &count);
@ -3975,6 +3986,7 @@ void remoteReadRegister(char* p)
void remoteReadRegisters(char* p) void remoteReadRegisters(char* p)
{ {
(void)p; // unused params
char buffer[1024]; char buffer[1024];
char* s = buffer; char* s = buffer;
@ -4233,6 +4245,7 @@ void remoteStubMain()
void remoteStubSignal(int sig, int number) void remoteStubSignal(int sig, int number)
{ {
(void)number; // unused params
remoteSignal = sig; remoteSignal = sig;
remoteResumed = false; remoteResumed = false;
remoteSendStatus(); remoteSendStatus();

View File

@ -1,79 +1,79 @@
#ifndef REMOTE_H #ifndef REMOTE_H
#define REMOTE_H #define REMOTE_H
#include "GBA.h" #include "GBA.h"
#define BitSet(array, bit) ((uint8_t*)(array))[(bit) >> 3] |= (1 << ((bit)&7)) #define BitSet(array, bit) ((uint8_t*)(array))[(bit) >> 3] |= (1 << ((bit)&7))
#define BitClear(array, bit) ((uint8_t*)(array))[(bit) >> 3] &= ~(1 << ((bit)&7)) #define BitClear(array, bit) ((uint8_t*)(array))[(bit) >> 3] &= ~(1 << ((bit)&7))
#define BitGet(array, bit) ((uint8_t)((array)[(bit) >> 3]) & (uint8_t)(1 << ((bit)&7))) #define BitGet(array, bit) ((uint8_t)((array)[(bit) >> 3]) & (uint8_t)(1 << ((bit)&7)))
#define BreakSet(array, addr, flag) \ #define BreakSet(array, addr, flag) \
((uint8_t*)(array))[(addr) >> 1] |= ((addr & 1) ? (flag << 4) : (flag & 0xf)) ((uint8_t*)(array))[(addr) >> 1] |= ((addr & 1) ? (flag << 4) : (flag & 0xf))
#define BreakClear(array, addr, flag) \ #define BreakClear(array, addr, flag) \
((uint8_t*)(array))[(addr) >> 1] &= ~((addr & 1) ? (flag << 4) : (flag & 0xf)) ((uint8_t*)(array))[(addr) >> 1] &= ~((addr & 1) ? (flag << 4) : (flag & 0xf))
// check // check
#define BreakThumbCheck(array, addr) ((uint8_t*)(array))[(addr) >> 1] & ((addr & 1) ? 0x80 : 0x8) #define BreakThumbCheck(array, addr) ((uint8_t*)(array))[(addr) >> 1] & ((addr & 1) ? 0x80 : 0x8)
#define BreakARMCheck(array, addr) ((uint8_t*)(array))[(addr) >> 1] & ((addr & 1) ? 0x40 : 0x4) #define BreakARMCheck(array, addr) ((uint8_t*)(array))[(addr) >> 1] & ((addr & 1) ? 0x40 : 0x4)
#define BreakReadCheck(array, addr) ((uint8_t*)(array))[(addr) >> 1] & ((addr & 1) ? 0x20 : 0x2) #define BreakReadCheck(array, addr) ((uint8_t*)(array))[(addr) >> 1] & ((addr & 1) ? 0x20 : 0x2)
#define BreakWriteCheck(array, addr) ((uint8_t*)(array))[(addr) >> 1] & ((addr & 1) ? 0x10 : 0x1) #define BreakWriteCheck(array, addr) ((uint8_t*)(array))[(addr) >> 1] & ((addr & 1) ? 0x10 : 0x1)
#define BreakCheck(array, addr, flag) \ #define BreakCheck(array, addr, flag) \
((uint8_t*)(array))[(addr) >> 1] & ((addr & 1) ? (flag << 4) : (flag & 0xf)) ((uint8_t*)(array))[(addr) >> 1] & ((addr & 1) ? (flag << 4) : (flag & 0xf))
extern bool debugger; extern bool debugger;
extern bool dexp_eval(char*, uint32_t*); extern bool dexp_eval(char*, uint32_t*);
extern void dexp_setVar(char*, uint32_t); extern void dexp_setVar(char*, uint32_t);
extern void dexp_listVars(); extern void dexp_listVars();
extern void dexp_saveVars(char*); extern void dexp_saveVars(char*);
extern void dexp_loadVars(char*); extern void dexp_loadVars(char*);
void debuggerOutput(const char* s, uint32_t addr); void debuggerOutput(const char* s, uint32_t addr);
bool debuggerBreakOnExecution(uint32_t address, uint8_t state); bool debuggerBreakOnExecution(uint32_t address, uint8_t state);
bool debuggerBreakOnWrite(uint32_t address, uint32_t value, int size); bool debuggerBreakOnWrite(uint32_t address, uint32_t value, int size);
void debuggerBreakOnWrite(uint32_t address, uint32_t oldvalue, uint32_t value, int size, int t); void debuggerBreakOnWrite(uint32_t address, uint32_t oldvalue, uint32_t value, int size, int t);
bool debuggerBreakOnRead(uint32_t address, int size); bool debuggerBreakOnRead(uint32_t address, int size);
struct regBreak { struct regBreak {
// uint8_t regNum; /No longer needed // uint8_t regNum; /No longer needed
// bit 0 = equal // bit 0 = equal
// bit 1 = greater // bit 1 = greater
// bit 2 = smaller // bit 2 = smaller
// bit 3 = signed // bit 3 = signed
uint8_t flags; uint8_t flags;
uint32_t intVal; uint32_t intVal;
struct regBreak* next; struct regBreak* next;
}; };
extern uint8_t lowRegBreakCounter[4]; //(r0-r3) extern uint8_t lowRegBreakCounter[4]; //(r0-r3)
extern uint8_t medRegBreakCounter[4]; //(r4-r7) extern uint8_t medRegBreakCounter[4]; //(r4-r7)
extern uint8_t highRegBreakCounter[4]; //(r8-r11) extern uint8_t highRegBreakCounter[4]; //(r8-r11)
extern uint8_t statusRegBreakCounter[4]; //(r12-r15) extern uint8_t statusRegBreakCounter[4]; //(r12-r15)
extern bool enableRegBreak; extern bool enableRegBreak;
extern regBreak* breakRegList[16]; extern regBreak* breakRegList[16];
extern void breakReg_check(int i); extern void breakReg_check(int i);
struct regBreak* getFromBreakRegList(uint8_t regnum, int location); struct regBreak* getFromBreakRegList(uint8_t regnum, int location);
void clearBreakRegList(); void clearBreakRegList();
void clearParticularRegListBreaks(int reg); void clearParticularRegListBreaks(int reg);
void deleteFromBreakRegList(uint8_t regnum, int location); void deleteFromBreakRegList(uint8_t regnum, int location);
void addBreakRegToList(uint8_t regnum, uint8_t flags, uint32_t value); void addBreakRegToList(uint8_t regnum, uint8_t flags, uint32_t value);
void printBreakRegList(bool verbose); void printBreakRegList(bool verbose);
void remoteStubMain(); void remoteStubMain();
void remoteStubSignal(int sig, int number); void remoteStubSignal(int sig, int number);
void remoteOutput(const char* s, uint32_t addr); void remoteOutput(const char* s, uint32_t addr);
void remoteSetProtocol(int p); void remoteSetProtocol(int p);
void remoteSetPort(int port); void remoteSetPort(int port);
#endif // REMOTE_H #endif // REMOTE_H

View File

@ -33,6 +33,7 @@ void SoundRetro::write(uint16_t* finalWave, int length)
bool SoundRetro::init(long sampleRate) bool SoundRetro::init(long sampleRate)
{ {
(void)sampleRate; // unused param
return true; return true;
} }
@ -51,3 +52,8 @@ void SoundRetro::resume()
void SoundRetro::reset() void SoundRetro::reset()
{ {
} }
void SoundRetro::setThrottle(unsigned short throttle)
{
(void)throttle; // unused param
}

View File

@ -30,6 +30,7 @@ public:
virtual void reset(); virtual void reset();
virtual void resume(); virtual void resume();
virtual void write(uint16_t* finalWave, int length); virtual void write(uint16_t* finalWave, int length);
virtual void setThrottle(unsigned short throttle);
}; };
#endif // __VBA_SOUND_RETRO_H__ #endif // __VBA_SOUND_RETRO_H__

View File

@ -192,7 +192,7 @@ uint8_t *utilLoad(const char *file, bool (*accept)(const char *), uint8_t *data,
} }
} }
fread(image, 1, size, fp); // read into buffer FREAD_UNCHECKED(image, 1, size, fp); // read into buffer
fclose(fp); fclose(fp);
return image; return image;
} }

View File

@ -492,7 +492,8 @@ static void sdlOpenGLVideoResize()
void sdlOpenGLInit(int w, int h) void sdlOpenGLInit(int w, int h)
{ {
(void)w; // unused params
(void)h; // unused params
#if 0 #if 0
float screenAspect = (float) sizeX / sizeY, float screenAspect = (float) sizeX / sizeY,
windowAspect = (float) w / h; windowAspect = (float) w / h;
@ -2058,6 +2059,7 @@ int main(int argc, char** argv)
void systemMessage(int num, const char* msg, ...) void systemMessage(int num, const char* msg, ...)
{ {
(void)num; // unused params
va_list valist; va_list valist;
va_start(valist, msg); va_start(valist, msg);
@ -2290,6 +2292,12 @@ uint32_t systemGetClock()
void systemGbPrint(uint8_t* data, int len, int pages, int feed, int palette, int contrast) void systemGbPrint(uint8_t* data, int len, int pages, int feed, int palette, int contrast)
{ {
(void)data; // unused params
(void)len; // unused params
(void)pages; // unused params
(void)feed; // unused params
(void)palette; // unused params
(void)contrast; // unused params
} }
/* xKiv: added timestamp */ /* xKiv: added timestamp */
@ -2412,6 +2420,8 @@ void systemOnSoundShutdown()
void systemOnWriteDataToSoundBuffer(const uint16_t* finalWave, int length) void systemOnWriteDataToSoundBuffer(const uint16_t* finalWave, int length)
{ {
(void)finalWave; // unused params
(void)length; // unused params
} }
void log(const char* defaultMsg, ...) void log(const char* defaultMsg, ...)

View File

@ -1530,6 +1530,7 @@ yyreturn:
int yyerror(const char* s) int yyerror(const char* s)
{ {
(void)s; // unused params
return 0; return 0;
} }

View File

@ -97,6 +97,9 @@ Node* exprNodeNumber()
bool exprNodeNumberResolve(Node* n, Function* f, CompileUnit* u) bool exprNodeNumberResolve(Node* n, Function* f, CompileUnit* u)
{ {
(void)n; // unused params
(void)f; // unused params
(void)u; // unused params
return true; return true;
} }

View File

@ -605,6 +605,7 @@ void (*sdlStretcher24[4])(uint8_t*, uint8_t*, int) = {
bool sdlStretchInit(int colorDepth, int sizeMultiplier, int srcWidth) bool sdlStretchInit(int colorDepth, int sizeMultiplier, int srcWidth)
{ {
(void)srcWidth; // unused params
#ifndef C_CORE #ifndef C_CORE
sdlMakeStretcher(srcWidth, sizeMultiplier); sdlMakeStretcher(srcWidth, sizeMultiplier);
#else #else

View File

@ -50,7 +50,7 @@ void MainFrame::GetMenuOptionBool(const char* menuName, bool& field)
field = !field; field = !field;
int id = wxXmlResource::GetXRCID(wxString(menuName, wxConvUTF8)); int id = wxXmlResource::GetXRCID(wxString(menuName, wxConvUTF8));
for (int i = 0; i < checkable_mi.size(); i++) { for (size_t i = 0; i < checkable_mi.size(); i++) {
if (checkable_mi[i].cmd != id) if (checkable_mi[i].cmd != id)
continue; continue;
@ -65,7 +65,7 @@ void MainFrame::GetMenuOptionInt(const char* menuName, int& field, int mask)
bool is_checked = ((field) & (mask)) != (value); bool is_checked = ((field) & (mask)) != (value);
int id = wxXmlResource::GetXRCID(wxString(menuName, wxConvUTF8)); int id = wxXmlResource::GetXRCID(wxString(menuName, wxConvUTF8));
for (int i = 0; i < checkable_mi.size(); i++) { for (size_t i = 0; i < checkable_mi.size(); i++) {
if (checkable_mi[i].cmd != id) if (checkable_mi[i].cmd != id)
continue; continue;
@ -80,7 +80,7 @@ void MainFrame::SetMenuOption(const char* menuName, int value)
{ {
int id = wxXmlResource::GetXRCID(wxString(menuName, wxConvUTF8)); int id = wxXmlResource::GetXRCID(wxString(menuName, wxConvUTF8));
for (int i = 0; i < checkable_mi.size(); i++) { for (size_t i = 0; i < checkable_mi.size(); i++) {
if (checkable_mi[i].cmd != id) if (checkable_mi[i].cmd != id)
continue; continue;
@ -506,6 +506,7 @@ static bool maker_lt(const rom_maker& r1, const rom_maker& r2)
void SetDialogLabel(wxDialog* dlg, const wxString& id, wxString ts, size_t l) void SetDialogLabel(wxDialog* dlg, const wxString& id, wxString ts, size_t l)
{ {
(void)l; // unused params
ts.Replace(wxT("&"), wxT("&&"), true); ts.Replace(wxT("&"), wxT("&&"), true);
(dynamic_cast<wxControl*>((*dlg).FindWindow(wxXmlResource::GetXRCID(id))))->SetLabel(ts); (dynamic_cast<wxControl*>((*dlg).FindWindow(wxXmlResource::GetXRCID(id))))->SetLabel(ts);
} }
@ -548,7 +549,7 @@ EVT_HANDLER_MASK(RomInformation, "ROM information...", CMDEN_GB | CMDEN_GBA)
s.Printf(wxT("%02x"), gbRom[0x14b]); s.Printf(wxT("%02x"), gbRom[0x14b]);
setlab("MakerCode"); setlab("MakerCode");
const rom_maker m = { s }, *rm; const rom_maker m = { s, wxString() }, *rm;
rm = std::lower_bound(&makers[0], &makers[num_makers], m, maker_lt); rm = std::lower_bound(&makers[0], &makers[num_makers], m, maker_lt);
if (rm < &makers[num_makers] && !wxStrcmp(m.code, rm->code)) if (rm < &makers[num_makers] && !wxStrcmp(m.code, rm->code))
@ -776,7 +777,7 @@ EVT_HANDLER_MASK(RomInformation, "ROM information...", CMDEN_GB | CMDEN_GBA)
SetDialogLabel(dlg, wxT("CRC32"), rom_crc32, 8); SetDialogLabel(dlg, wxT("CRC32"), rom_crc32, 8);
setlabs("GameCode", rom[0xac], 4); setlabs("GameCode", rom[0xac], 4);
setlabs("MakerCode", rom[0xb0], 2); setlabs("MakerCode", rom[0xb0], 2);
const rom_maker m = { s }, *rm; const rom_maker m = { s, wxString() }, *rm;
rm = std::lower_bound(&makers[0], &makers[num_makers], m, maker_lt); rm = std::lower_bound(&makers[0], &makers[num_makers], m, maker_lt);
if (rm < &makers[num_makers] && !wxStrcmp(m.code, rm->code)) if (rm < &makers[num_makers] && !wxStrcmp(m.code, rm->code))
@ -804,6 +805,9 @@ EVT_HANDLER_MASK(RomInformation, "ROM information...", CMDEN_GB | CMDEN_GBA)
dlg->Fit(); dlg->Fit();
ShowModal(dlg); ShowModal(dlg);
} break; } break;
default:
break;
} }
} }
@ -971,7 +975,7 @@ EVT_HANDLER_MASK(ImportGamesharkCodeFile, "Import GameShark code file...", CMDEN
game = lst->GetSelection(); game = lst->GetSelection();
if (game == wxNOT_FOUND) if ((int)game == wxNOT_FOUND)
game = 0; game = 0;
} }
@ -1606,7 +1610,7 @@ EVT_HANDLER_MASK(Rewind, "Rewind", CMDEN_REWIND)
// if within 5 seconds of last one, and > 1 state, delete last state & move back // if within 5 seconds of last one, and > 1 state, delete last state & move back
// FIXME: 5 should actually be user-configurable // FIXME: 5 should actually be user-configurable
// maybe instead of 5, 10% of rewind_interval // maybe instead of 5, 10% of rewind_interval
if (panel->num_rewind_states > 1 && (gopts.rewind_interval <= 5 || panel->rewind_time / 6 > gopts.rewind_interval - 5)) { if (panel->num_rewind_states > 1 && (gopts.rewind_interval <= 5 || (int)panel->rewind_time / 6 > gopts.rewind_interval - 5)) {
--panel->num_rewind_states; --panel->num_rewind_states;
panel->next_rewind_state = rew_st; panel->next_rewind_state = rew_st;
@ -1713,7 +1717,7 @@ EVT_HANDLER_MASK(VideoLayersReset, "Show all video layers", CMDEN_GB | CMDEN_GBA
#define set_vl(s) \ #define set_vl(s) \
do { \ do { \
int id = XRCID(s); \ int id = XRCID(s); \
for (int i = 0; i < checkable_mi.size(); i++) \ for (size_t i = 0; i < checkable_mi.size(); i++) \
if (checkable_mi[i].cmd == id) { \ if (checkable_mi[i].cmd == id) { \
checkable_mi[i].mi->Check(true); \ checkable_mi[i].mi->Check(true); \
break; \ break; \
@ -2291,7 +2295,7 @@ EVT_HANDLER_MASK(ChangeFilter, "Change Pixel Filter", CMDEN_NREC_ANY)
{ {
int filt = gopts.filter; int filt = gopts.filter;
if (filt == FF_PLUGIN || ++gopts.filter == FF_PLUGIN && gopts.filter_plugin.empty()) { if ((filt == FF_PLUGIN || ++gopts.filter == FF_PLUGIN) && gopts.filter_plugin.empty()) {
gopts.filter = 0; gopts.filter = 0;
} }

View File

@ -18,7 +18,7 @@ SET(EVLINES )
FOREACH(EV ${MW}) FOREACH(EV ${MW})
# stripping the wxID_ makes it look better, but it's still all-caps # stripping the wxID_ makes it look better, but it's still all-caps
STRING(REGEX REPLACE "^[^\"]*\\((wxID_|)([^,]*),[^\"]*(\"[^\"]*\")[^,)]*(,[^)]*|).*" STRING(REGEX REPLACE "^[^\"]*\\((wxID_|)([^,]*),[^\"]*(\"[^\"]*\")[^,)]*(,[^)]*|).*"
" {wxT(\"\\2\"), wxTRANSLATE(\\3), XRCID(\"\\1\\2\")\\4 }" " new_cmditem(wxT(\"\\2\"), wxTRANSLATE(\\3), XRCID(\"\\1\\2\")\\4 )"
EV "${EV}") EV "${EV}")
STRING(REGEX REPLACE "XRCID\\(\"(wxID_[^\"]*)\"\\)" "\\1" EV ${EV}) STRING(REGEX REPLACE "XRCID\\(\"(wxID_[^\"]*)\"\\)" "\\1" EV ${EV})
LIST(APPEND EVLINES "${EV},\n") LIST(APPEND EVLINES "${EV},\n")

View File

@ -69,7 +69,7 @@ bool GetFADevices(wxArrayString& names, wxArrayString& ids)
} }
GetFADevices(fa, &names, &ids, NULL); GetFADevices(fa, &names, &ids, NULL);
//fa->Release(); //fa->Release();
FAudio_Release(fa); FAudio_Release(fa);
return true; return true;
} }
@ -371,7 +371,7 @@ bool FAudio_Output::init(long sampleRate)
wfx.nBlockAlign = wfx.nChannels * (wfx.wBitsPerSample / 8); wfx.nBlockAlign = wfx.nChannels * (wfx.wBitsPerSample / 8);
wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign; wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign;
// create sound receiver // create sound receiver
hr = FAudio_CreateMasteringVoice( hr = FAudio_CreateMasteringVoice(
faud, faud,
&mVoice, &mVoice,
FAUDIO_DEFAULT_CHANNELS, FAUDIO_DEFAULT_CHANNELS,
@ -386,9 +386,9 @@ bool FAudio_Output::init(long sampleRate)
return false; return false;
} }
// create sound emitter // create sound emitter
//This should be FAudio_CreateSourceVoice() //This should be FAudio_CreateSourceVoice()
//hr = faud->CreateSourceVoice(&sVoice, &wfx, 0, 4.0f, &notify); //hr = faud->CreateSourceVoice(&sVoice, &wfx, 0, 4.0f, &notify);
hr = FAudio_CreateSourceVoice(faud, &sVoice, (const FAudioWaveFormatEx*)&wfx, 0, 4.0f, &notify, NULL, NULL); hr = FAudio_CreateSourceVoice(faud, &sVoice, (const FAudioWaveFormatEx*)&wfx, 0, 4.0f, &notify, NULL, NULL);
if (hr != S_OK) { if (hr != S_OK) {
@ -516,7 +516,7 @@ bool FAudio_Output::init(long sampleRate)
} }
void FAudio_Output::write(uint16_t* finalWave, int length) void FAudio_Output::write(uint16_t* finalWave, int length)
{ {
UINT32 flags = 0; UINT32 flags = 0;
if (!initialized || failed) if (!initialized || failed)
return; return;

View File

@ -229,7 +229,7 @@ public:
s.Printf(wxT("0x%08X"), address); s.Printf(wxT("0x%08X"), address);
addr->SetLabel(s); addr->SetLabel(s);
if (!mode || (mode < 3 || mode > 5) && bg < 2) { if ((!mode || (mode < 3 || mode > 5)) && bg < 2) {
uint16_t value = *((uint16_t*)&vram[address - 0x6000000]); uint16_t value = *((uint16_t*)&vram[address - 0x6000000]);
s.Printf(wxT("%d"), value & 1023); s.Printf(wxT("%d"), value & 1023);
tile->SetLabel(s); tile->SetLabel(s);
@ -738,6 +738,10 @@ void MainFrame::MapViewer()
case IMAGE_GB: case IMAGE_GB:
LoadXRCViewer(GBMap); LoadXRCViewer(GBMap);
break; break;
case IMAGE_UNKNOWN:
// do nothing
break;
} }
} }
@ -1113,6 +1117,10 @@ void MainFrame::OAMViewer()
case IMAGE_GB: case IMAGE_GB:
LoadXRCViewer(GBOAM); LoadXRCViewer(GBOAM);
break; break;
case IMAGE_UNKNOWN:
// do nothing
break;
} }
} }
@ -1233,11 +1241,13 @@ public:
} }
void SelBG(wxMouseEvent& ev) void SelBG(wxMouseEvent& ev)
{ {
(void)ev; // unused params
spv->SetSel(-1, -1, false); spv->SetSel(-1, -1, false);
ShowSel(); ShowSel();
} }
void SelSprite(wxMouseEvent& ev) void SelSprite(wxMouseEvent& ev)
{ {
(void)ev; // unused params
bpv->SetSel(-1, -1, false); bpv->SetSel(-1, -1, false);
ShowSel(); ShowSel();
} }
@ -1273,14 +1283,17 @@ public:
} }
void SaveBG(wxCommandEvent& ev) void SaveBG(wxCommandEvent& ev)
{ {
(void)ev; // unused params
savepal(this, colbmp, 16 * 16, wxT("bg")); savepal(this, colbmp, 16 * 16, wxT("bg"));
} }
void SaveOBJ(wxCommandEvent& ev) void SaveOBJ(wxCommandEvent& ev)
{ {
(void)ev; // unused params
savepal(this, colbmp + 16 * 16 * 3, 16 * 16, wxT("obj")); savepal(this, colbmp + 16 * 16 * 3, 16 * 16, wxT("obj"));
} }
void ChangeBackdrop(wxCommandEvent& ev) void ChangeBackdrop(wxCommandEvent& ev)
{ {
(void)ev; // unused params
// FIXME: this should really be a preference // FIXME: this should really be a preference
// should also have some way of indicating selection // should also have some way of indicating selection
// perhaps replace w/ checkbox + colorpickerctrl // perhaps replace w/ checkbox + colorpickerctrl
@ -1294,7 +1307,7 @@ public:
*cd = dlg.GetColourData(); *cd = dlg.GetColourData();
wxColour c = cd->GetColour(); wxColour c = cd->GetColour();
//Binary or the upper 5 bits of each color choice //Binary or the upper 5 bits of each color choice
customBackdropColor = (c.Red() >> 3) || ((c.Green() >> 3) << 5) || ((c.Blue() >> 3) << 10); customBackdropColor = ((c.Red() >> 3) != 0) || (((c.Green() >> 3) << 5) != 0) || (((c.Blue() >> 3) << 10) != 0);
} else } else
// kind of an unintuitive way to turn it off... // kind of an unintuitive way to turn it off...
customBackdropColor = -1; customBackdropColor = -1;
@ -1347,11 +1360,13 @@ public:
} }
void SelBG(wxMouseEvent& ev) void SelBG(wxMouseEvent& ev)
{ {
(void)ev; // unused params
spv->SetSel(-1, -1, false); spv->SetSel(-1, -1, false);
ShowSel(); ShowSel();
} }
void SelSprite(wxMouseEvent& ev) void SelSprite(wxMouseEvent& ev)
{ {
(void)ev; // unused params
bpv->SetSel(-1, -1, false); bpv->SetSel(-1, -1, false);
ShowSel(); ShowSel();
} }
@ -1386,10 +1401,12 @@ public:
} }
void SaveBG(wxCommandEvent& ev) void SaveBG(wxCommandEvent& ev)
{ {
(void)ev; // unused params
savepal(this, colbmp, 4 * 8, wxT("bg")); savepal(this, colbmp, 4 * 8, wxT("bg"));
} }
void SaveOBJ(wxCommandEvent& ev) void SaveOBJ(wxCommandEvent& ev)
{ {
(void)ev; // unused params
savepal(this, colbmp + 4 * 8 * 3, 4 * 8, wxT("obj")); savepal(this, colbmp + 4 * 8 * 3, 4 * 8, wxT("obj"));
} }
@ -1419,6 +1436,10 @@ void MainFrame::PaletteViewer()
case IMAGE_GB: case IMAGE_GB:
LoadXRCViewer(GBPalette); LoadXRCViewer(GBPalette);
break; break;
case IMAGE_UNKNOWN:
// do nothing
break;
} }
} }
@ -1687,5 +1708,9 @@ void MainFrame::TileViewer()
case IMAGE_GB: case IMAGE_GB:
LoadXRCViewer(GBTile); LoadXRCViewer(GBTile);
break; break;
case IMAGE_UNKNOWN:
// do nothing
break;
} }
} }

View File

@ -72,10 +72,12 @@ public:
wxButton* okb; wxButton* okb;
void ServerOKButton(wxCommandEvent& ev) void ServerOKButton(wxCommandEvent& ev)
{ {
(void)ev; // unused params
okb->SetLabel(_("Start!")); okb->SetLabel(_("Start!"));
} }
void ClientOKButton(wxCommandEvent& ev) void ClientOKButton(wxCommandEvent& ev)
{ {
(void)ev; // unused params
okb->SetLabel(_("Connect")); okb->SetLabel(_("Connect"));
} }
// attached to OK, so skip when OK // attached to OK, so skip when OK
@ -305,7 +307,7 @@ public:
} break; } break;
case wxID_REMOVE: { case wxID_REMOVE: {
bool asked = false, restore; bool asked = false, restore = false;
for (int i = list->GetItemCount() - 1; i >= 0; i--) for (int i = list->GetItemCount() - 1; i >= 0; i--)
if (list->GetItemState(i, wxLIST_STATE_SELECTED)) { if (list->GetItemState(i, wxLIST_STATE_SELECTED)) {
@ -704,10 +706,14 @@ public:
CheatListFill(const CheatListFill& e) CheatListFill(const CheatListFill& e)
: wxValidator() : wxValidator()
{ {
(void)e; // unused params
} }
wxObject* Clone() const { return new CheatListFill(*this); } wxObject* Clone() const { return new CheatListFill(*this); }
bool TransferFromWindow() { return true; } bool TransferFromWindow() { return true; }
bool Validate(wxWindow* p) { return true; } bool Validate(wxWindow* p) {
(void)p; // unused params
return true;
}
bool TransferToWindow() bool TransferToWindow()
{ {
CheatList_t& clh = cheat_list_handler; CheatList_t& clh = cheat_list_handler;
@ -885,6 +891,7 @@ public:
void UpdateVals(wxCommandEvent& ev) void UpdateVals(wxCommandEvent& ev)
{ {
(void)ev; // unused params
if (cheatSearchData.count) { if (cheatSearchData.count) {
cheatSearchUpdateValues(&cheatSearchData); cheatSearchUpdateValues(&cheatSearchData);
@ -897,6 +904,7 @@ public:
void ResetSearch(wxCommandEvent& ev) void ResetSearch(wxCommandEvent& ev)
{ {
(void)ev; // unused params
if (!cheatSearchData.count) { if (!cheatSearchData.count) {
CheatSearchBlock* block = cheatSearchData.blocks; CheatSearchBlock* block = cheatSearchData.blocks;
@ -988,6 +996,7 @@ public:
void AddCheatB(wxCommandEvent& ev) void AddCheatB(wxCommandEvent& ev)
{ {
(void)ev; // unused params
int idx = list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); int idx = list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
if (idx >= 0) if (idx >= 0)
@ -1194,6 +1203,7 @@ public:
void UpdateView(wxCommandEvent& ev) void UpdateView(wxCommandEvent& ev)
{ {
(void)ev; // unused params
dlg->TransferDataFromWindow(); dlg->TransferDataFromWindow();
if (ofmt != fmt && !val_s.empty()) { if (ofmt != fmt && !val_s.empty()) {
@ -1282,10 +1292,14 @@ public:
CheatFindFill(const CheatFindFill& e) CheatFindFill(const CheatFindFill& e)
: wxValidator() : wxValidator()
{ {
(void)e; // unused params
} }
wxObject* Clone() const { return new CheatFindFill(*this); } wxObject* Clone() const { return new CheatFindFill(*this); }
bool TransferFromWindow() { return true; } bool TransferFromWindow() { return true; }
bool Validate(wxWindow* p) { return true; } bool Validate(wxWindow* p) {
(void)p; // unused params
return true;
}
bool TransferToWindow() bool TransferToWindow()
{ {
CheatFind_t& cfh = cheat_find_handler; CheatFind_t& cfh = cheat_find_handler;
@ -1313,7 +1327,7 @@ wxString CheatListCtrl::OnGetItemText(long item, long column) const
off = (item & ((1 << (cap_size - size)) - 1)) << size; off = (item & ((1 << (cap_size - size)) - 1)) << size;
item >>= cap_size - size; item >>= cap_size - size;
} else if (cap_size < size) { } else if (cap_size < size) {
for (int i = 0; i < addrs.size(); i++) { for (size_t i = 0; i < addrs.size(); i++) {
if (!(addrs[i] & ((1 << size) - 1)) && !item--) { if (!(addrs[i] & ((1 << size) - 1)) && !item--) {
item = i; item = i;
break; break;
@ -1418,6 +1432,7 @@ public:
} }
void ColorReset(wxCommandEvent& ev) void ColorReset(wxCommandEvent& ev)
{ {
(void)ev; // unused params
const uint16_t* color = &systemGbPalette[pno * 8]; const uint16_t* color = &systemGbPalette[pno * 8];
for (int i = 0; i < 8; i++, color++) for (int i = 0; i < 8; i++, color++)
@ -1428,6 +1443,7 @@ public:
void ColorButton(wxCommandEvent& ev) void ColorButton(wxCommandEvent& ev)
{ {
(void)ev; // unused params
c->SetSelection(0); c->SetSelection(0);
} }
} GBColorConfigHandler[3]; } GBColorConfigHandler[3];
@ -1442,10 +1458,14 @@ public:
GBACtrlEnabler(const GBACtrlEnabler& e) GBACtrlEnabler(const GBACtrlEnabler& e)
: wxValidator() : wxValidator()
{ {
(void)e; // unused params
} }
wxObject* Clone() const { return new GBACtrlEnabler(*this); } wxObject* Clone() const { return new GBACtrlEnabler(*this); }
bool TransferFromWindow() { return true; } bool TransferFromWindow() { return true; }
bool Validate(wxWindow* p) { return true; } bool Validate(wxWindow* p) {
(void)p; // unused params
return true;
}
bool TransferToWindow() bool TransferToWindow()
{ {
GetWindow()->Enable(wxGetApp().frame->GetPanel()->game_type() == IMAGE_GBA); GetWindow()->Enable(wxGetApp().frame->GetPanel()->game_type() == IMAGE_GBA);
@ -1464,6 +1484,7 @@ public:
} }
void Detect(wxCommandEvent& ev) void Detect(wxCommandEvent& ev)
{ {
(void)ev; // unused params
uint32_t sz = wxGetApp().frame->GetPanel()->game_size(); uint32_t sz = wxGetApp().frame->GetPanel()->game_size();
utilGBAFindSave(sz); utilGBAFindSave(sz);
type->SetSelection(saveType); type->SetSelection(saveType);
@ -1489,6 +1510,7 @@ public:
void FullVol(wxCommandEvent& ev) void FullVol(wxCommandEvent& ev)
{ {
(void)ev; // unused params
vol->SetValue(100); vol->SetValue(100);
} }
void AdjustFrames(int count) void AdjustFrames(int count)
@ -1499,6 +1521,7 @@ public:
} }
void AdjustFramesEv(wxCommandEvent& ev) void AdjustFramesEv(wxCommandEvent& ev)
{ {
(void)ev; // unused params
AdjustFrames(bufs->GetValue()); AdjustFrames(bufs->GetValue());
} }
@ -1548,7 +1571,7 @@ public:
dev->SetSelection(0); dev->SetSelection(0);
for (int i = 0; i < names.size(); i++) { for (size_t i = 0; i < names.size(); i++) {
dev->Append(names[i]); dev->Append(names[i]);
if (api == gopts.audio_api && gopts.audio_dev == dev_ids[i]) if (api == gopts.audio_api && gopts.audio_dev == dev_ids[i])
@ -1586,9 +1609,13 @@ public:
SoundConfigLoad(const SoundConfigLoad& e) SoundConfigLoad(const SoundConfigLoad& e)
: wxValidator() : wxValidator()
{ {
(void)e; // unused params
} }
wxObject* Clone() const { return new SoundConfigLoad(*this); } wxObject* Clone() const { return new SoundConfigLoad(*this); }
bool Validate(wxWindow* p) { return true; } bool Validate(wxWindow* p) {
(void)p; // unused params
return true;
}
bool TransferToWindow() bool TransferToWindow()
{ {
SoundConfig_t& sch = sound_config_handler; SoundConfig_t& sch = sound_config_handler;
@ -1649,9 +1676,13 @@ public:
ScreenModeList(const ScreenModeList& e) ScreenModeList(const ScreenModeList& e)
: wxValidator() : wxValidator()
{ {
(void)e; // unused params
} }
wxObject* Clone() const { return new ScreenModeList(*this); } wxObject* Clone() const { return new ScreenModeList(*this); }
bool Validate(wxWindow* p) { return true; } bool Validate(wxWindow* p) {
(void)p; // unused params
return true;
}
bool TransferToWindow() bool TransferToWindow()
{ {
wxChoice* c = wxStaticCast(GetWindow(), wxChoice); wxChoice* c = wxStaticCast(GetWindow(), wxChoice);
@ -1665,7 +1696,7 @@ public:
vm = d.GetModes(); vm = d.GetModes();
wxString s; wxString s;
for (int i = 0; i < vm.size(); i++) { for (size_t i = 0; i < vm.size(); i++) {
s.Printf(_("%d x %d - %dbpp @ %dHz"), vm[i].w, vm[i].h, vm[i].bpp, vm[i].refresh); s.Printf(_("%d x %d - %dbpp @ %dHz"), vm[i].w, vm[i].h, vm[i].bpp, vm[i].refresh);
c->Append(s); c->Append(s);
@ -1723,10 +1754,14 @@ public:
PluginEnabler(const PluginEnabler& e) PluginEnabler(const PluginEnabler& e)
: wxValidator() : wxValidator()
{ {
(void)e; // unused params
} }
wxObject* Clone() const { return new PluginEnabler(*this); } wxObject* Clone() const { return new PluginEnabler(*this); }
bool TransferFromWindow() { return true; } bool TransferFromWindow() { return true; }
bool Validate(wxWindow* p) { return true; } bool Validate(wxWindow* p) {
(void)p; // unused params
return true;
}
bool TransferToWindow() bool TransferToWindow()
{ {
GetWindow()->Enable(gopts.filter == FF_PLUGIN); GetWindow()->Enable(gopts.filter == FF_PLUGIN);
@ -1751,22 +1786,25 @@ class PluginListFiller : public PluginEnabler {
public: public:
PluginListFiller(wxDialog* parent, wxControl* lab, wxChoice* ch) PluginListFiller(wxDialog* parent, wxControl* lab, wxChoice* ch)
: PluginEnabler() : PluginEnabler()
, dlg(parent)
, txt(lab) , txt(lab)
, dlg(parent)
, plugins()
, filtch(ch) , filtch(ch)
, plugins()
{ {
} }
PluginListFiller(const PluginListFiller& e) PluginListFiller(const PluginListFiller& e)
: PluginEnabler() : PluginEnabler()
, dlg(e.dlg)
, txt(e.txt) , txt(e.txt)
, dlg(e.dlg)
, plugins(e.plugins)
, filtch(e.filtch) , filtch(e.filtch)
, plugins(e.plugins)
{ {
} }
wxObject* Clone() const { return new PluginListFiller(*this); } wxObject* Clone() const { return new PluginListFiller(*this); }
bool Validate(wxWindow* p) { return true; } bool Validate(wxWindow* p) {
(void)p; // unused params
return true;
}
bool TransferToWindow() bool TransferToWindow()
{ {
PluginEnabler::TransferToWindow(); PluginEnabler::TransferToWindow();
@ -1777,10 +1815,10 @@ public:
const wxString plpath = wxGetApp().GetPluginsDir(); const wxString plpath = wxGetApp().GetPluginsDir();
wxDir::GetAllFiles(plpath, &plugins, wxT("*.rpi"), wxDIR_FILES | wxDIR_DIRS); wxDir::GetAllFiles(plpath, &plugins, wxT("*.rpi"), wxDIR_FILES | wxDIR_DIRS);
for (int i = 0; i < plugins.size(); i++) { for (size_t i = 0; i < plugins.size(); i++) {
wxDynamicLibrary dl(plugins[i], wxDL_VERBATIM | wxDL_NOW); wxDynamicLibrary dl(plugins[i], wxDL_VERBATIM | wxDL_NOW);
RENDPLUG_GetInfo GetInfo; RENDPLUG_GetInfo GetInfo;
const RENDER_PLUGIN_INFO* rpi; const RENDER_PLUGIN_INFO* rpi = NULL;
if (dl.IsLoaded() && (GetInfo = (RENDPLUG_GetInfo)dl.GetSymbol(wxT("RenderPluginGetInfo"))) && if (dl.IsLoaded() && (GetInfo = (RENDPLUG_GetInfo)dl.GetSymbol(wxT("RenderPluginGetInfo"))) &&
// note that in actual kega fusion plugins, rpi->Output is // note that in actual kega fusion plugins, rpi->Output is
@ -1802,8 +1840,10 @@ public:
if (plugins[i] == gopts.filter_plugin) if (plugins[i] == gopts.filter_plugin)
ch->SetSelection(i + 1); ch->SetSelection(i + 1);
} else }
else {
plugins.RemoveAt(i--); plugins.RemoveAt(i--);
}
} }
if (ch->GetCount() == 1) { if (ch->GetCount() == 1) {
@ -1993,7 +2033,7 @@ public:
asb->Enable(!key->GetValue().empty()); asb->Enable(!key->GetValue().empty());
int cmd = id->val; int cmd = id->val;
for (int i = 0; i < accels.size(); i++) for (size_t i = 0; i < accels.size(); i++)
if (accels[i].GetCommand() == cmdtab[cmd].cmd_id) if (accels[i].GetCommand() == cmdtab[cmd].cmd_id)
lb->Append(wxKeyTextCtrl::ToString(accels[i].GetFlags(), lb->Append(wxKeyTextCtrl::ToString(accels[i].GetFlags(),
accels[i].GetKeyCode())); accels[i].GetKeyCode()));
@ -2002,12 +2042,14 @@ public:
// after selecting a key in key list, enable Remove button // after selecting a key in key list, enable Remove button
void KeySel(wxCommandEvent& ev) void KeySel(wxCommandEvent& ev)
{ {
(void)ev; // unused params
remb->Enable(lb->GetSelection() != wxNOT_FOUND); remb->Enable(lb->GetSelection() != wxNOT_FOUND);
} }
// remove selected binding // remove selected binding
void Remove(wxCommandEvent& ev) void Remove(wxCommandEvent& ev)
{ {
(void)ev; // unused params
int lsel = lb->GetSelection(); int lsel = lb->GetSelection();
if (lsel == wxNOT_FOUND) if (lsel == wxNOT_FOUND)
@ -2038,7 +2080,7 @@ public:
// if it's a system accel, disable by assigning to NOOP // if it's a system accel, disable by assigning to NOOP
wxAcceleratorEntry_v& sys_accels = wxGetApp().frame->sys_accels; wxAcceleratorEntry_v& sys_accels = wxGetApp().frame->sys_accels;
for (int i = 0; i < sys_accels.size(); i++) for (size_t i = 0; i < sys_accels.size(); i++)
if (sys_accels[i].GetFlags() == selmod && sys_accels[i].GetKeyCode() == selkey) { if (sys_accels[i].GetFlags() == selmod && sys_accels[i].GetKeyCode() == selkey) {
wxAcceleratorEntry ne(selmod, selkey, XRCID("NOOP")); wxAcceleratorEntry ne(selmod, selkey, XRCID("NOOP"));
user_accels.push_back(ne); user_accels.push_back(ne);
@ -2056,6 +2098,7 @@ public:
// wipe out all user bindings // wipe out all user bindings
void ResetAll(wxCommandEvent& ev) void ResetAll(wxCommandEvent& ev)
{ {
(void)ev; // unused params
if (user_accels.empty() || wxMessageBox(_("This will clear all user-defined accelerators. Are you sure?"), _("Confirm"), wxYES_NO) != wxYES) if (user_accels.empty() || wxMessageBox(_("This will clear all user-defined accelerators. Are you sure?"), _("Confirm"), wxYES_NO) != wxYES)
return; return;
@ -2071,6 +2114,7 @@ public:
// remove old key binding, add new key binding, and update GUI // remove old key binding, add new key binding, and update GUI
void Assign(wxCommandEvent& ev) void Assign(wxCommandEvent& ev)
{ {
(void)ev; // unused params
wxTreeItemId csel = tc->GetSelection(); wxTreeItemId csel = tc->GetSelection();
wxString accel = key->GetValue(); wxString accel = key->GetValue();
@ -2082,7 +2126,7 @@ public:
if (!wxKeyTextCtrl::FromString(accel, acmod, ackey)) if (!wxKeyTextCtrl::FromString(accel, acmod, ackey))
return; // this should never happen return; // this should never happen
for (int i = 0; i < lb->GetCount(); i++) for (unsigned int i = 0; i < lb->GetCount(); i++)
if (lb->GetString(i) == accel) if (lb->GetString(i) == accel)
return; // ignore attempts to add twice return; // ignore attempts to add twice
@ -2111,6 +2155,7 @@ public:
// update curas and maybe enable asb // update curas and maybe enable asb
void CheckKey(wxCommandEvent& ev) void CheckKey(wxCommandEvent& ev)
{ {
(void)ev; // unused params
wxString nkey = key->GetValue(); wxString nkey = key->GetValue();
if (nkey.empty()) { if (nkey.empty()) {
@ -2131,7 +2176,7 @@ public:
asb->Enable(tc->GetSelection().IsOk()); asb->Enable(tc->GetSelection().IsOk());
int cmd = -1; int cmd = -1;
for (int i = 0; i < accels.size(); i++) for (size_t i = 0; i < accels.size(); i++)
if (accels[i].GetFlags() == acmod && accels[i].GetKeyCode() == ackey) { if (accels[i].GetFlags() == acmod && accels[i].GetKeyCode() == ackey) {
int cmdid = accels[i].GetCommand(); int cmdid = accels[i].GetCommand();
@ -2218,6 +2263,7 @@ public:
// set thrsel from thr // set thrsel from thr
void SetThrottleSel(wxSpinEvent& evt) void SetThrottleSel(wxSpinEvent& evt)
{ {
(void)evt; // unused params
DoSetThrottleSel(thr->GetValue()); DoSetThrottleSel(thr->GetValue());
} }
@ -2232,6 +2278,7 @@ public:
// set thr from thrsel // set thr from thrsel
void SetThrottle(wxCommandEvent& evt) void SetThrottle(wxCommandEvent& evt)
{ {
(void)evt; // unused params
uint32_t val = thrsel->GetSelection() * 25; uint32_t val = thrsel->GetSelection() * 25;
if (val <= 600) if (val <= 600)
@ -2271,6 +2318,7 @@ public:
// set speedup_throttle_sel from speedup_throttle // set speedup_throttle_sel from speedup_throttle
void SetSpeedupThrottleSel(wxSpinEvent& evt) void SetSpeedupThrottleSel(wxSpinEvent& evt)
{ {
(void)evt; // unused params
DoSetSpeedupThrottleSel(speedup_throttle_spin->GetValue()); DoSetSpeedupThrottleSel(speedup_throttle_spin->GetValue());
} }
@ -2289,6 +2337,7 @@ public:
// set speedup_throttle from speedup_throttle_sel // set speedup_throttle from speedup_throttle_sel
void SetSpeedupThrottle(wxCommandEvent& evt) void SetSpeedupThrottle(wxCommandEvent& evt)
{ {
(void)evt; // unused params
uint32_t val = speedup_throttle_sel->GetSelection() * 25; uint32_t val = speedup_throttle_sel->GetSelection() * 25;
if (val > 0 && val <= 600) { if (val > 0 && val <= 600) {
@ -2311,6 +2360,7 @@ public:
// set speedup_frame_skip_sel from speedup_frame_skip // set speedup_frame_skip_sel from speedup_frame_skip
void SpeedupFrameSkipCtrl_t::SetSpeedupFrameSkipSel(wxSpinEvent& evt) void SpeedupFrameSkipCtrl_t::SetSpeedupFrameSkipSel(wxSpinEvent& evt)
{ {
(void)evt; // unused params
DoSetSpeedupFrameSkipSel(speedup_frame_skip_spin->GetValue()); DoSetSpeedupFrameSkipSel(speedup_frame_skip_spin->GetValue());
} }
@ -2329,6 +2379,7 @@ void SpeedupFrameSkipCtrl_t::DoSetSpeedupFrameSkipSel(uint32_t val)
// set speedup_frame_skip from speedup_frame_skip_sel // set speedup_frame_skip from speedup_frame_skip_sel
void SpeedupFrameSkipCtrl_t::SetSpeedupFrameSkip(wxCommandEvent& evt) void SpeedupFrameSkipCtrl_t::SetSpeedupFrameSkip(wxCommandEvent& evt)
{ {
(void)evt; // unused params
uint32_t val = speedup_frame_skip_sel->GetSelection(); uint32_t val = speedup_frame_skip_sel->GetSelection();
if (val > 0 && val <= 30) { if (val > 0 && val <= 30) {
@ -2450,7 +2501,7 @@ wxAcceleratorEntry_v MainFrame::get_accels(wxAcceleratorEntry_v user_accels)
// then user overrides // then user overrides
// silently keep only last defined binding // silently keep only last defined binding
// same horribly inefficent O(n*m) search for duplicates as above.. // same horribly inefficent O(n*m) search for duplicates as above..
for (int i = 0; i < user_accels.size(); i++) { for (size_t i = 0; i < user_accels.size(); i++) {
const wxAcceleratorEntry& ae = user_accels[i]; const wxAcceleratorEntry& ae = user_accels[i];
for (wxAcceleratorEntry_v::iterator e = accels.begin(); e < accels.end(); ++e) for (wxAcceleratorEntry_v::iterator e = accels.begin(); e < accels.end(); ++e)
@ -2476,7 +2527,7 @@ void MainFrame::set_global_accels()
// the menus will be added now // the menus will be added now
// first, zero out menu item on all accels // first, zero out menu item on all accels
for (int i = 0; i < accels.size(); i++) for (size_t i = 0; i < accels.size(); i++)
accels[i].Set(accels[i].GetFlags(), accels[i].GetKeyCode(), accels[i].Set(accels[i].GetFlags(), accels[i].GetKeyCode(),
accels[i].GetCommand()); accels[i].GetCommand());
@ -2494,7 +2545,7 @@ void MainFrame::set_global_accels()
int cmd = cmdtab[i].cmd_id; int cmd = cmdtab[i].cmd_id;
int last_accel = -1; int last_accel = -1;
for (int j = 0; j < accels.size(); j++) for (size_t j = 0; j < accels.size(); j++)
if (cmd == accels[j].GetCommand()) if (cmd == accels[j].GetCommand())
last_accel = j; last_accel = j;
@ -2511,14 +2562,14 @@ void MainFrame::set_global_accels()
// Finally, install a global accelerator table for any non-menu accels // Finally, install a global accelerator table for any non-menu accels
int len = 0; int len = 0;
for (int i = 0; i < accels.size(); i++) for (size_t i = 0; i < accels.size(); i++)
if (!accels[i].GetMenuItem()) if (!accels[i].GetMenuItem())
len++; len++;
if (len) { if (len) {
wxAcceleratorEntry tab[1000]; wxAcceleratorEntry tab[1000];
for (int i = 0, j = 0; i < accels.size(); i++) for (size_t i = 0, j = 0; i < accels.size(); i++)
if (!accels[i].GetMenuItem()) if (!accels[i].GetMenuItem())
tab[j++] = accels[i]; tab[j++] = accels[i];
@ -2533,7 +2584,7 @@ void MainFrame::set_global_accels()
for (int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
recent_accel[i] = wxAcceleratorEntry(); recent_accel[i] = wxAcceleratorEntry();
for (int i = 0; i < accels.size(); i++) for (size_t i = 0; i < accels.size(); i++)
if (accels[i].GetCommand() >= wxID_FILE1 && accels[i].GetCommand() <= wxID_FILE10) if (accels[i].GetCommand() >= wxID_FILE1 && accels[i].GetCommand() <= wxID_FILE10)
recent_accel[accels[i].GetCommand() - wxID_FILE1] = accels[i]; recent_accel[accels[i].GetCommand() - wxID_FILE1] = accels[i];
@ -2544,7 +2595,7 @@ void MainFrame::MenuOptionBool(const char* menuName, bool& field)
{ {
int id = wxXmlResource::GetXRCID(wxString(menuName, wxConvUTF8)); int id = wxXmlResource::GetXRCID(wxString(menuName, wxConvUTF8));
for (int i = 0; i < checkable_mi.size(); i++) { for (size_t i = 0; i < checkable_mi.size(); i++) {
if (checkable_mi[i].cmd != id) if (checkable_mi[i].cmd != id)
continue; continue;
@ -2559,7 +2610,7 @@ void MainFrame::MenuOptionIntMask(const char* menuName, int& field, int mask)
int id = wxXmlResource::GetXRCID(wxString(menuName, wxConvUTF8)); int id = wxXmlResource::GetXRCID(wxString(menuName, wxConvUTF8));
int value = mask; int value = mask;
for (int i = 0; i < checkable_mi.size(); i++) { for (size_t i = 0; i < checkable_mi.size(); i++) {
if (checkable_mi[i].cmd != id) if (checkable_mi[i].cmd != id)
continue; continue;
@ -2575,7 +2626,7 @@ void MainFrame::MenuOptionIntRadioValue(const char* menuName, int& field, int va
{ {
int id = wxXmlResource::GetXRCID(wxString(menuName, wxConvUTF8)); int id = wxXmlResource::GetXRCID(wxString(menuName, wxConvUTF8));
for (int i = 0; i < checkable_mi.size(); i++) { for (size_t i = 0; i < checkable_mi.size(); i++) {
if (checkable_mi[i].cmd != id) if (checkable_mi[i].cmd != id)
continue; continue;
@ -2793,7 +2844,7 @@ bool MainFrame::BindControls()
// store checkable items // store checkable items
if (mi->IsCheckable()) { if (mi->IsCheckable()) {
checkable_mi_t cmi = { cmdtab[i].cmd_id, mi }; checkable_mi_t cmi = { cmdtab[i].cmd_id, mi, NULL, NULL, 0, 0 };
checkable_mi.push_back(cmi); checkable_mi.push_back(cmi);
for (int j = 0; j < num_opts; j++) { for (int j = 0; j < num_opts; j++) {
@ -2876,7 +2927,7 @@ bool MainFrame::BindControls()
MenuOptionIntRadioValue("LinkType4Gameboy", gopts.gba_link_type, 4); MenuOptionIntRadioValue("LinkType4Gameboy", gopts.gba_link_type, 4);
} }
for (int i = 0; i < checkable_mi.size(); i++) for (size_t i = 0; i < checkable_mi.size(); i++)
if (!checkable_mi[i].boolopt && !checkable_mi[i].intopt) { if (!checkable_mi[i].boolopt && !checkable_mi[i].intopt) {
wxLogError(_("Invalid menu item %s; removing"), wxLogError(_("Invalid menu item %s; removing"),
checkable_mi[i].mi->GetItemLabelText().c_str()); checkable_mi[i].mi->GetItemLabelText().c_str());
@ -3313,6 +3364,7 @@ bool MainFrame::BindControls()
} }
#define getcbbe(n, o) getbe(n, o, cb, wxCheckBox, CB) #define getcbbe(n, o) getbe(n, o, cb, wxCheckBox, CB)
wxBoolIntEnValidator* bienval; wxBoolIntEnValidator* bienval;
(void)bienval; // not used yet
#define getbie(n, o, v, cv, t, wt) \ #define getbie(n, o, v, cv, t, wt) \
do { \ do { \
cv = SafeXRCCTRL<t>(d, n); \ cv = SafeXRCCTRL<t>(d, n); \
@ -3655,7 +3707,7 @@ bool MainFrame::BindControls()
if (menubar) { if (menubar) {
wxTreeItemId mid = tc->AppendItem(rid, _("Menu commands")); wxTreeItemId mid = tc->AppendItem(rid, _("Menu commands"));
for (int i = 0; i < menubar->GetMenuCount(); i++) { for (size_t i = 0; i < menubar->GetMenuCount(); i++) {
#if wxCHECK_VERSION(2, 8, 8) #if wxCHECK_VERSION(2, 8, 8)
wxTreeItemId id = tc->AppendItem(mid, menubar->GetMenuLabelText(i)); wxTreeItemId id = tc->AppendItem(mid, menubar->GetMenuLabelText(i));
#else #else

View File

@ -27,7 +27,8 @@
#ifdef winlog #ifdef winlog
#undef winlog #undef winlog
#endif #endif
#define winlog // // https://stackoverflow.com/a/1306690/262458
#define winlog(x,...) do {} while(0)
#define debugState() // #define debugState() //
#endif #endif
@ -133,6 +134,7 @@ void OpenAL::debugState()
break; break;
} }
alGetSourcei(source, AL_BUFFERS_QUEUED, &value); alGetSourcei(source, AL_BUFFERS_QUEUED, &value);
ASSERT_SUCCESS; ASSERT_SUCCESS;
winlog(" Buffers in queue: %i\n", value); winlog(" Buffers in queue: %i\n", value);
@ -252,6 +254,7 @@ void OpenAL::reset()
void OpenAL::write(uint16_t* finalWave, int length) void OpenAL::write(uint16_t* finalWave, int length)
{ {
(void)length; // unused param
if (!initialized) if (!initialized)
return; return;

View File

@ -13,31 +13,30 @@
-p/--profile=hz -p/--profile=hz
*/ */
#define WJKB newWxJoyKeyBinding
/* not sure how well other compilers support field-init syntax */ /* not sure how well other compilers support field-init syntax */
#define STROPT(c, n, d, v) \ #define STROPT(c, n, d, v) \
{ \ new_opt_desc(wxT(c), (n), d, &v)
wxT(c), (n), d, &v \
} #define INTOPT(c, n, d, v, min, max) \
#define INTOPT(c, n, d, v, min, max) \ new_opt_desc(wxT(c), (n), d, NULL, &v, wxT(""), min, max)
{ \
wxT(c), (n), d, NULL, &v, wxT(""), min, max \ #define DOUBLEOPT(c, n, d, v, min, max) \
} new_opt_desc(wxT(c), (n), d, NULL, NULL, wxT(""), min, max, NULL, &v)
#define DOUBLEOPT(c, n, d, v, min, max) \
{ \ #define UINTOPT(c, n, d, v, min, max) \
wxT(c), (n), d, NULL, NULL, wxT(""), min, max, NULL, &v \ new_opt_desc(wxT(c), (n), d, NULL, NULL, wxT(""), min, max, NULL, NULL, &v)
}
#define UINTOPT(c, n, d, v, min, max) \ #define BOOLOPT(c, n, d, v) \
{ \ new_opt_desc(wxT(c), (n), d, NULL, NULL, wxT(""), 0, 0, &v)
wxT(c), (n), d, NULL, NULL, wxT(""), min, max, NULL, NULL, &v \
} #define ENUMOPT(c, n, d, v, e) \
#define BOOLOPT(c, n, d, v) \ new_opt_desc(wxT(c), (n), d, NULL, &v, e)
{ \
wxT(c), (n), d, NULL, NULL, wxT(""), 0, 0, &v \ #define NOOPT(c, n, d) \
} new_opt_desc(c, (n), d)
#define ENUMOPT(c, n, d, v, e) \
{ \
wxT(c), (n), d, NULL, &v, e \
}
opts_t gopts; opts_t gopts;
@ -137,21 +136,34 @@ const wxString joynames[NUM_KEYS] = {
}; };
wxJoyKeyBinding defkeys[NUM_KEYS * 2] = { wxJoyKeyBinding defkeys[NUM_KEYS * 2] = {
{ WXK_UP }, { 1, WXJB_AXIS_MINUS, 1 }, { WXK_DOWN }, { 1, WXJB_AXIS_PLUS, 1 }, WJKB(WXK_UP), WJKB(1, WXJB_AXIS_MINUS, 1), WJKB(WXK_DOWN), WJKB(1, WXJB_AXIS_PLUS, 1),
{ WXK_LEFT }, { 0, WXJB_AXIS_MINUS, 1 }, { WXK_RIGHT }, { 0, WXJB_AXIS_PLUS, 1 }, WJKB(WXK_LEFT), WJKB(0, WXJB_AXIS_MINUS, 1), WJKB(WXK_RIGHT), WJKB(0, WXJB_AXIS_PLUS, 1),
{ wxT('X') }, { 0, WXJB_BUTTON, 1 }, { wxT('Z') }, { 1, WXJB_BUTTON, 1 }, WJKB(wxT('X')), WJKB(0, WXJB_BUTTON, 1), WJKB(wxT('Z')), WJKB(1, WXJB_BUTTON, 1),
{ wxT('A') }, { 2, WXJB_BUTTON, 1 }, { wxT('S') }, { 3, WXJB_BUTTON, 1 }, WJKB(wxT('A')), WJKB(2, WXJB_BUTTON, 1), WJKB(wxT('S')), WJKB(3, WXJB_BUTTON, 1),
{ WXK_BACK }, { 4, WXJB_BUTTON, 1 }, { WXK_RETURN }, { 5, WXJB_BUTTON, 1 }, WJKB(WXK_BACK), WJKB(4, WXJB_BUTTON, 1), WJKB(WXK_RETURN), WJKB(5, WXJB_BUTTON, 1),
{ WXK_NUMPAD_UP }, { 0 }, { WXK_NUMPAD_DOWN }, { 0 }, WJKB(WXK_NUMPAD_UP), WJKB(0), WJKB(WXK_NUMPAD_DOWN), WJKB(0),
{ WXK_NUMPAD_LEFT }, { 0 }, { WXK_NUMPAD_RIGHT }, { 0 }, WJKB(WXK_NUMPAD_LEFT), WJKB(0), WJKB(WXK_NUMPAD_RIGHT), WJKB(0),
{ WXK_NUMPAD_PAGEUP }, { 0 }, { WXK_NUMPAD_PAGEDOWN }, { 0 }, WJKB(WXK_NUMPAD_PAGEUP), WJKB(0), WJKB(WXK_NUMPAD_PAGEDOWN), WJKB(0),
{ wxT('W') }, { 0 }, { wxT('Q') }, { 0 }, WJKB(wxT('W')), WJKB(0), WJKB(wxT('Q')), WJKB(0),
{ WXK_SPACE }, { 0 }, { 0 }, { 0 }, WJKB(WXK_SPACE), WJKB(0), WJKB(0), WJKB(0),
{ 0 }, { 0 } WJKB(0), WJKB(0)
}; };
wxAcceleratorEntry_v sys_accels; wxAcceleratorEntry_v sys_accels;
// Initializer for struct opt_desc
opt_desc new_opt_desc(wxString opt, const char* cmd, wxString desc,
wxString* stropt, int* intopt, wxString enumvals,
double min, double max, bool* boolopt,
double* doubleopt, uint32_t* uintopt, wxString curstr,
int curint, double curdouble, uint32_t curuint)
{
struct opt_desc new_opt = {opt, cmd, desc, stropt, intopt, enumvals,
min, max, boolopt, doubleopt, uintopt,
curstr, curint, curdouble, curuint};
return new_opt;
}
// Note: this table must be sorted in option name order // Note: this table must be sorted in option name order
// Both for better user display and for (fast) searching by name // Both for better user display and for (fast) searching by name
opt_desc opts[] = { opt_desc opts[] = {
@ -178,9 +190,9 @@ opt_desc opts[] = {
/// GB /// GB
STROPT("GB/BiosFile", "", wxTRANSLATE("BIOS file to use for GB, if enabled"), gopts.gb_bios), STROPT("GB/BiosFile", "", wxTRANSLATE("BIOS file to use for GB, if enabled"), gopts.gb_bios),
STROPT("GB/GBCBiosFile", "", wxTRANSLATE("BIOS file to use for GBC, if enabled"), gopts.gbc_bios), STROPT("GB/GBCBiosFile", "", wxTRANSLATE("BIOS file to use for GBC, if enabled"), gopts.gbc_bios),
{ wxT("GB/Palette0"), "", wxTRANSLATE("The default palette, as 8 comma-separated 4-digit hex integers (rgb555).") }, NOOPT(wxT("GB/Palette0"), "", wxTRANSLATE("The default palette, as 8 comma-separated 4-digit hex integers (rgb555).")),
{ wxT("GB/Palette1"), "", wxTRANSLATE("The first user palette, as 8 comma-separated 4-digit hex integers (rgb555).") }, NOOPT(wxT("GB/Palette1"), "", wxTRANSLATE("The first user palette, as 8 comma-separated 4-digit hex integers (rgb555).")),
{ wxT("GB/Palette2"), "", wxTRANSLATE("The second user palette, as 8 comma-separated 4-digit hex integers (rgb555).") }, NOOPT(wxT("GB/Palette2"), "", wxTRANSLATE("The second user palette, as 8 comma-separated 4-digit hex integers (rgb555).")),
BOOLOPT("GB/PrintAutoPage", "PrintGather", wxTRANSLATE("Automatically gather a full page before printing"), gopts.print_auto_page), BOOLOPT("GB/PrintAutoPage", "PrintGather", wxTRANSLATE("Automatically gather a full page before printing"), gopts.print_auto_page),
BOOLOPT("GB/PrintScreenCap", "PrintSnap", wxTRANSLATE("Automatically save printouts as screen captures with -print suffix"), gopts.print_screen_cap), BOOLOPT("GB/PrintScreenCap", "PrintSnap", wxTRANSLATE("Automatically save printouts as screen captures with -print suffix"), gopts.print_screen_cap),
STROPT("GB/ROMDir", "", wxTRANSLATE("Directory to look for ROM files"), gopts.gb_rom_dir), STROPT("GB/ROMDir", "", wxTRANSLATE("Directory to look for ROM files"), gopts.gb_rom_dir),
@ -210,14 +222,14 @@ opt_desc opts[] = {
INTOPT("General/StatusBar", "StatusBar", wxTRANSLATE("Enable status bar"), gopts.statusbar, 0, 1), INTOPT("General/StatusBar", "StatusBar", wxTRANSLATE("Enable status bar"), gopts.statusbar, 0, 1),
/// Joypad /// Joypad
{ wxT("Joypad/*/*"), "", wxTRANSLATE("The parameter Joypad/<n>/<button> contains a comma-separated list of key names which map to joypad #<n> button <button>. Button is one of Up, Down, Left, Right, A, B, L, R, Select, Start, MotionUp, MotionDown, MotionLeft, MotionRight, AutoA, AutoB, Speed, Capture, GS") }, NOOPT(wxT("Joypad/*/*"), "", wxTRANSLATE("The parameter Joypad/<n>/<button> contains a comma-separated list of key names which map to joypad #<n> button <button>. Button is one of Up, Down, Left, Right, A, B, L, R, Select, Start, MotionUp, MotionDown, MotionLeft, MotionRight, AutoA, AutoB, Speed, Capture, GS")),
INTOPT("Joypad/AutofireThrottle", "", wxTRANSLATE("The autofire toggle period, in frames (1/60 s)"), gopts.autofire_rate, 1, 1000), INTOPT("Joypad/AutofireThrottle", "", wxTRANSLATE("The autofire toggle period, in frames (1/60 s)"), gopts.autofire_rate, 1, 1000),
/// Keyboard /// Keyboard
INTOPT("Joypad/Default", "", wxTRANSLATE("The number of the stick to use in single-player mode"), gopts.default_stick, 1, 4), INTOPT("Joypad/Default", "", wxTRANSLATE("The number of the stick to use in single-player mode"), gopts.default_stick, 1, 4),
/// Keyboard /// Keyboard
{ wxT("Keyboard/*"), "", wxTRANSLATE("The parameter Keyboard/<cmd> contains a comma-separated list of key names (e.g. Alt-Shift-F1). When the named key is pressed, the command <cmd> is executed.") }, NOOPT(wxT("Keyboard/*"), "", wxTRANSLATE("The parameter Keyboard/<cmd> contains a comma-separated list of key names (e.g. Alt-Shift-F1). When the named key is pressed, the command <cmd> is executed.")),
// Core // Core
INTOPT("preferences/agbPrint", "AGBPrinter", wxTRANSLATE("Enable AGB debug print"), agbPrint, 0, 1), INTOPT("preferences/agbPrint", "AGBPrinter", wxTRANSLATE("Enable AGB debug print"), agbPrint, 0, 1),
@ -344,7 +356,6 @@ bool opt_lt(const opt_desc& opt1, const opt_desc& opt2)
} }
// FIXME: simulate MakeInstanceFilename(vbam.ini) using subkeys (Slave%d/*) // FIXME: simulate MakeInstanceFilename(vbam.ini) using subkeys (Slave%d/*)
void load_opts() void load_opts()
{ {
// just for sanity... // just for sanity...
@ -449,7 +460,7 @@ void load_opts()
cont = cfg->GetNextEntry(e, entry_idx)) { cont = cfg->GetNextEntry(e, entry_idx)) {
// kb options come from a different list // kb options come from a different list
if (s == wxT("Keyboard")) { if (s == wxT("Keyboard")) {
const cmditem dummy = { e }; const cmditem dummy = new_cmditem(e);
if (!std::binary_search(&cmdtab[0], &cmdtab[ncmds], dummy, cmditem_lt)) { if (!std::binary_search(&cmdtab[0], &cmdtab[ncmds], dummy, cmditem_lt)) {
s.append(wxT('/')); s.append(wxT('/'));
@ -461,7 +472,7 @@ void load_opts()
} else { } else {
s.append(wxT('/')); s.append(wxT('/'));
s.append(e); s.append(e);
const opt_desc dummy = { s }; opt_desc dummy = new_opt_desc(s);
wxString opt_name(dummy.opt); wxString opt_name(dummy.opt);
if (!std::binary_search(&opts[0], &opts[num_opts], dummy, opt_lt) && opt_name != wxT("General/LastUpdated") && opt_name != wxT("General/LastUpdatedFileName")) { if (!std::binary_search(&opts[0], &opts[num_opts], dummy, opt_lt) && opt_name != wxT("General/LastUpdated") && opt_name != wxT("General/LastUpdatedFileName")) {
@ -476,10 +487,10 @@ void load_opts()
cfg->SetPath(wxT("/")); cfg->SetPath(wxT("/"));
} }
for (int i = 0; i < item_del.size(); i++) for (size_t i = 0; i < item_del.size(); i++)
cfg->DeleteEntry(item_del[i]); cfg->DeleteEntry(item_del[i]);
for (int i = 0; i < grp_del.size(); i++) for (size_t i = 0; i < grp_del.size(); i++)
cfg->DeleteGroup(grp_del[i]); cfg->DeleteGroup(grp_del[i]);
// now read actual values and set to default if unset // now read actual values and set to default if unset
@ -500,7 +511,7 @@ void load_opts()
if (gotit && !s.empty()) { if (gotit && !s.empty()) {
const auto found_pos = vec_find(enum_opts, s); const auto found_pos = vec_find(enum_opts, s);
const bool matched = found_pos != wxNOT_FOUND; const bool matched = ((int)found_pos != wxNOT_FOUND);
if (!matched) { if (!matched) {
opt.curint = 0; opt.curint = 0;
@ -556,7 +567,7 @@ void load_opts()
wxString optn; wxString optn;
optn.Printf(wxT("GB/Palette%d"), i); optn.Printf(wxT("GB/Palette%d"), i);
wxString val; wxString val;
const opt_desc dummy = { optn }; const opt_desc dummy = new_opt_desc(optn);
opt_desc* opt = std::lower_bound(&opts[0], &opts[num_opts], dummy, opt_lt); opt_desc* opt = std::lower_bound(&opts[0], &opts[num_opts], dummy, opt_lt);
wxString entry; wxString entry;
@ -574,7 +585,7 @@ void load_opts()
int start = cpos; int start = cpos;
cpos = val.find(wxT(','), cpos); cpos = val.find(wxT(','), cpos);
if (cpos == wxString::npos) if ((size_t)cpos == wxString::npos)
cpos = val.size(); cpos = val.size();
long ival; long ival;
@ -585,7 +596,7 @@ void load_opts()
entry.ToLong(&ival, 16); entry.ToLong(&ival, 16);
systemGbPalette[i * 8 + j] = ival; systemGbPalette[i * 8 + j] = ival;
if (cpos != val.size()) if ((size_t)cpos != val.size())
cpos++; cpos++;
} }
} }
@ -624,7 +635,7 @@ void load_opts()
if (!val.size()) if (!val.size())
wxLogWarning(_("Invalid key binding %s for %s"), s.c_str(), kbopt.c_str()); wxLogWarning(_("Invalid key binding %s for %s"), s.c_str(), kbopt.c_str());
else { else {
for (int j = 0; j < val.size(); j++) for (size_t j = 0; j < val.size(); j++)
val[j].Set(val[j].GetFlags(), val[j].GetKeyCode(), val[j].Set(val[j].GetFlags(), val[j].GetKeyCode(),
cmdtab[i].cmd_id); cmdtab[i].cmd_id);
@ -682,7 +693,7 @@ void update_opts()
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
wxString optn; wxString optn;
optn.Printf(wxT("GB/Palette%d"), i); optn.Printf(wxT("GB/Palette%d"), i);
const opt_desc dummy = { optn }; const opt_desc dummy = new_opt_desc(optn);
opt_desc* opt = std::lower_bound(&opts[0], &opts[num_opts], dummy, opt_lt); opt_desc* opt = std::lower_bound(&opts[0], &opts[num_opts], dummy, opt_lt);
wxString val; wxString val;
wxString entry; wxString entry;
@ -726,9 +737,9 @@ void update_opts()
for (bool cont = cfg->GetFirstEntry(s, entry_idx); cont; for (bool cont = cfg->GetFirstEntry(s, entry_idx); cont;
cont = cfg->GetNextEntry(s, entry_idx)) { cont = cfg->GetNextEntry(s, entry_idx)) {
const cmditem dummy = { s }; const cmditem dummy = new_cmditem(s);
cmditem* cmd = std::lower_bound(&cmdtab[0], &cmdtab[ncmds], dummy, cmditem_lt); cmditem* cmd = std::lower_bound(&cmdtab[0], &cmdtab[ncmds], dummy, cmditem_lt);
int i; size_t i;
for (i = 0; i < gopts.accels.size(); i++) for (i = 0; i < gopts.accels.size(); i++)
if (gopts.accels[i].GetCommand() == cmd->cmd_id) if (gopts.accels[i].GetCommand() == cmd->cmd_id)
@ -738,7 +749,7 @@ void update_opts()
item_del.push_back(s); item_del.push_back(s);
} }
for (int i = 0; i < item_del.size(); i++) for (size_t i = 0; i < item_del.size(); i++)
cfg->DeleteEntry(item_del[i]); cfg->DeleteEntry(item_del[i]);
} }
@ -777,7 +788,7 @@ void update_opts()
bool opt_set(const wxString& name, const wxString& val) bool opt_set(const wxString& name, const wxString& val)
{ {
const opt_desc dummy = { name }; const opt_desc dummy = new_opt_desc(name);
const opt_desc* opt = std::lower_bound(&opts[0], &opts[num_opts], dummy, opt_lt); const opt_desc* opt = std::lower_bound(&opts[0], &opts[num_opts], dummy, opt_lt);
if (!wxStrcmp(name, opt->opt)) { if (!wxStrcmp(name, opt->opt)) {
@ -795,7 +806,7 @@ bool opt_set(const wxString& name, const wxString& val)
auto enum_opts = str_split(ev, wxT("|")); auto enum_opts = str_split(ev, wxT("|"));
const std::size_t found_pos = vec_find(enum_opts, s); const std::size_t found_pos = vec_find(enum_opts, s);
const bool matched = found_pos != wxNOT_FOUND; const bool matched = ((int)found_pos != wxNOT_FOUND);
if (!matched) { if (!matched) {
const wxString evx = wxGetTranslation(opt->enumvals); const wxString evx = wxGetTranslation(opt->enumvals);
@ -844,7 +855,7 @@ bool opt_set(const wxString& name, const wxString& val)
wxString vals(val); wxString vals(val);
for (int j = 0, cpos = 0; j < 8; j++) { for (size_t j = 0, cpos = 0; j < 8; j++) {
int start = cpos; int start = cpos;
cpos = vals.find(wxT(','), cpos); cpos = vals.find(wxT(','), cpos);
@ -873,7 +884,7 @@ bool opt_set(const wxString& name, const wxString& val)
auto parts = str_split(name, wxT("/")); auto parts = str_split(name, wxT("/"));
if (parts[0] != wxT("Keyboard")) { if (parts[0] != wxT("Keyboard")) {
cmditem* cmd = std::lower_bound(&cmdtab[0], &cmdtab[ncmds], cmditem{parts[1]}, cmditem_lt); cmditem* cmd = std::lower_bound(&cmdtab[0], &cmdtab[ncmds], cmditem{parts[1],wxString(),0,0,NULL}, cmditem_lt);
if (cmd == &cmdtab[ncmds] || wxStrcmp(parts[1], cmd->cmd)) if (cmd == &cmdtab[ncmds] || wxStrcmp(parts[1], cmd->cmd))
return false; return false;
@ -894,7 +905,7 @@ bool opt_set(const wxString& name, const wxString& val)
if (!val.empty()) { if (!val.empty()) {
auto aval = wxKeyTextCtrl::FromString(val); auto aval = wxKeyTextCtrl::FromString(val);
for (int i = 0; i < aval.size(); i++) for (size_t i = 0; i < aval.size(); i++)
aval[i].Set(aval[i].GetFlags(), aval[i].GetKeyCode(), aval[i].Set(aval[i].GetFlags(), aval[i].GetKeyCode(),
cmd->cmd_id); cmd->cmd_id);

View File

@ -101,6 +101,14 @@ extern struct opt_desc {
uint32_t curuint; uint32_t curuint;
#define curbool curint #define curbool curint
} opts[]; } opts[];
// Initializer for struct opt_desc
opt_desc new_opt_desc(wxString opt = "", const char* cmd = NULL, wxString desc = "",
wxString* stropt = NULL, int* intopt = NULL, wxString enumvals = "",
double min = 0, double max = 0, bool* boolopt = NULL,
double* doubleopt = NULL, uint32_t* uintopt = NULL, wxString curstr = "",
int curint = 0, double curdouble = 0, uint32_t curuint = 0);
extern const int num_opts; extern const int num_opts;
extern const wxAcceleratorEntry default_accels[]; extern const wxAcceleratorEntry default_accels[];

View File

@ -22,17 +22,17 @@ IMPLEMENT_DYNAMIC_CLASS(GameArea, wxPanel)
GameArea::GameArea() GameArea::GameArea()
: wxPanel() : wxPanel()
, loaded(IMAGE_UNKNOWN)
, panel(NULL) , panel(NULL)
, emusys(NULL) , emusys(NULL)
, basic_width(GBAWidth)
, basic_height(GBAHeight)
, fullscreen(false)
, paused(false)
, was_paused(false) , was_paused(false)
, rewind_time(0) , rewind_time(0)
, do_rewind(false) , do_rewind(false)
, rewind_mem(0) , rewind_mem(0)
, loaded(IMAGE_UNKNOWN)
, basic_width(GBAWidth)
, basic_height(GBAHeight)
, fullscreen(false)
, paused(false)
, pointer_blanked(false) , pointer_blanked(false)
, mouse_active_time(0) , mouse_active_time(0)
{ {
@ -155,7 +155,7 @@ void GameArea::LoadGame(const wxString& name)
wxCharBuffer pfnb(pfn.GetFullPath().mb_fn_str()); wxCharBuffer pfnb(pfn.GetFullPath().mb_fn_str());
applyPatch(pfnb.data(), &gbRom, &size); applyPatch(pfnb.data(), &gbRom, &size);
if (size != rom_size) if (size != (int)rom_size)
gbUpdateSizes(); gbUpdateSizes();
rom_size = size; rom_size = size;
@ -372,6 +372,7 @@ void GameArea::LoadGame(const wxString& name)
case 0x10000: case 0x10000:
if (saveType == GBA_SAVE_EEPROM || saveType == GBA_SAVE_SRAM) if (saveType == GBA_SAVE_EEPROM || saveType == GBA_SAVE_SRAM)
break; break;
break;
case 0x20000: case 0x20000:
saveType = GBA_SAVE_FLASH; saveType = GBA_SAVE_FLASH;
@ -843,7 +844,7 @@ void GameArea::ShowFullScreen(bool full)
// in particular, unix does Matches() in wrong direction // in particular, unix does Matches() in wrong direction
wxArrayVideoModes vm = d.GetModes(); wxArrayVideoModes vm = d.GetModes();
int best_mode = -1; int best_mode = -1;
int i; size_t i;
for (i = 0; i < vm.size(); i++) { for (i = 0; i < vm.size(); i++) {
if (vm[i].w != gopts.fs_mode.w || vm[i].h != gopts.fs_mode.h) if (vm[i].w != gopts.fs_mode.w || vm[i].h != gopts.fs_mode.h)
@ -1156,9 +1157,9 @@ static std::vector<game_key>* game_keys_pressed(int key, int mod, int joy)
for (int key_num = 0; key_num < NUM_KEYS; key_num++) { for (int key_num = 0; key_num < NUM_KEYS; key_num++) {
wxJoyKeyBinding_v& b = gopts.joykey_bindings[player][key_num]; wxJoyKeyBinding_v& b = gopts.joykey_bindings[player][key_num];
for (int bind_num = 0; bind_num < b.size(); bind_num++) for (size_t bind_num = 0; bind_num < b.size(); bind_num++)
if (b[bind_num].key == key && b[bind_num].mod == mod && b[bind_num].joy == joy) if (b[bind_num].key == key && b[bind_num].mod == mod && b[bind_num].joy == joy)
vec->push_back({player, key_num, bind_num, b}); vec->push_back({player, key_num, (int)bind_num, b});
} }
return vec; return vec;
@ -1186,7 +1187,7 @@ static bool process_key_press(bool down, int key, int mod, int joy = 0)
} }
// check if key is already pressed // check if key is already pressed
int kpno; size_t kpno;
for (kpno = 0; kpno < keys_pressed.size(); kpno++) for (kpno = 0; kpno < keys_pressed.size(); kpno++)
if (keys_pressed[kpno].key == key && keys_pressed[kpno].mod == mod && keys_pressed[kpno].joy == joy) if (keys_pressed[kpno].key == key && keys_pressed[kpno].mod == mod && keys_pressed[kpno].joy == joy)
@ -1219,11 +1220,11 @@ static bool process_key_press(bool down, int key, int mod, int joy = 0)
} }
else { else {
// only release if no others pressed // only release if no others pressed
int bind2; size_t bind2;
auto b = game_key.b; auto b = game_key.b;
for (bind2 = 0; bind2 < game_key.b.size(); bind2++) { for (bind2 = 0; bind2 < game_key.b.size(); bind2++) {
if (game_key.bind_num == bind2 || (b[bind2].key == key && b[bind2].mod == mod && b[bind2].joy == joy)) if ((size_t)game_key.bind_num == bind2 || (b[bind2].key == key && b[bind2].mod == mod && b[bind2].joy == joy))
continue; continue;
for (kpno = 0; kpno < keys_pressed.size(); kpno++) for (kpno = 0; kpno < keys_pressed.size(); kpno++)
@ -1356,8 +1357,8 @@ DrawingPanelBase::DrawingPanelBase(int _width, int _height)
, todraw(0) , todraw(0)
, pixbuf1(0) , pixbuf1(0)
, pixbuf2(0) , pixbuf2(0)
, rpi(0)
, nthreads(0) , nthreads(0)
, rpi(0)
{ {
memset(delta, 0xff, sizeof(delta)); memset(delta, 0xff, sizeof(delta));
@ -1453,6 +1454,7 @@ void DrawingPanelBase::DrawingPanelInit()
void DrawingPanelBase::PaintEv(wxPaintEvent& ev) void DrawingPanelBase::PaintEv(wxPaintEvent& ev)
{ {
(void)ev; // unused params
wxPaintDC dc(GetWindow()); wxPaintDC dc(GetWindow());
if (!todraw) { if (!todraw) {
@ -1470,6 +1472,7 @@ void DrawingPanelBase::PaintEv(wxPaintEvent& ev)
void DrawingPanelBase::EraseBackground(wxEraseEvent& ev) void DrawingPanelBase::EraseBackground(wxEraseEvent& ev)
{ {
(void)ev; // unused params
// do nothing, do not allow propagation // do nothing, do not allow propagation
} }
@ -1911,7 +1914,7 @@ void DrawingPanelBase::DrawOSD(wxWindowDC& dc)
// find amt of text that will fit on a line is to search // find amt of text that will fit on a line is to search
wxArrayInt llen; // length of each line, in chars wxArrayInt llen; // length of each line, in chars
for (int off = 0; off < msg.size();) { for (size_t off = 0; off < msg.size();) {
// One way would be to bsearch on GetTextExtent() looking for // One way would be to bsearch on GetTextExtent() looking for
// best fit. // best fit.
// Another would be to use GetPartialTextExtents and search // Another would be to use GetPartialTextExtents and search
@ -2238,6 +2241,7 @@ void GLDrawingPanel::AdjustViewport()
void GLDrawingPanel::DrawArea(wxWindowDC& dc) void GLDrawingPanel::DrawArea(wxWindowDC& dc)
{ {
(void)dc; // unused params
#ifndef wxGL_IMPLICIT_CONTEXT #ifndef wxGL_IMPLICIT_CONTEXT
SetCurrent(*ctx); SetCurrent(*ctx);
#else #else

View File

@ -39,6 +39,7 @@ bool soundBufferLow;
void systemMessage(int id, const char* fmt, ...) void systemMessage(int id, const char* fmt, ...)
{ {
(void)id; // unused params
static char* buf = NULL; static char* buf = NULL;
static int buflen = 80; static int buflen = 80;
va_list args; va_list args;
@ -359,7 +360,7 @@ void system10Frames(int rate)
static int speedadj = 0; static int speedadj = 0;
uint32_t t = systemGetClock(); uint32_t t = systemGetClock();
if (!panel->was_paused && prevclock && (t - prevclock) != 10000 / rate) { if (!panel->was_paused && prevclock && (t - prevclock) != (uint32_t)(10000 / rate)) {
int speed = t == prevclock ? 100 * 10000 / rate - (t - prevclock) : 100; int speed = t == prevclock ? 100 * 10000 / rate - (t - prevclock) : 100;
// why 98?? // why 98??
@ -691,11 +692,11 @@ private:
IMPLEMENT_CLASS(PrintDialog, wxEvtHandler) IMPLEMENT_CLASS(PrintDialog, wxEvtHandler)
PrintDialog::PrintDialog(const uint16_t* data, int lines, bool cont) PrintDialog::PrintDialog(const uint16_t* data, int lines, bool cont):
: img(160, lines) wxPrintout(wxGetApp().frame->GetPanel()->game_name() + wxT(" Printout")),
, npw(1) img(160, lines),
, nph(1) npw(1),
, wxPrintout(wxGetApp().frame->GetPanel()->game_name() + wxT(" Printout")) nph(1)
{ {
dlg = wxStaticCast(wxGetApp().frame->FindWindow(XRCID("GBPrinter")), wxDialog); dlg = wxStaticCast(wxGetApp().frame->FindWindow(XRCID("GBPrinter")), wxDialog);
p = XRCCTRL(*dlg, "Preview", wxPanel); p = XRCCTRL(*dlg, "Preview", wxPanel);
@ -769,6 +770,7 @@ void PrintDialog::ShowImg(wxPaintEvent& evt)
void PrintDialog::ChangeMag(wxCommandEvent& evt) void PrintDialog::ChangeMag(wxCommandEvent& evt)
{ {
(void)evt; // unused params
int m = mag->GetSelection() + 1; int m = mag->GetSelection() + 1;
wxScrolledWindow* pp = wxStaticCast(p->GetParent(), wxScrolledWindow); wxScrolledWindow* pp = wxStaticCast(p->GetParent(), wxScrolledWindow);
wxSize sz(m * 160, m * img.GetHeight()); wxSize sz(m * 160, m * img.GetHeight());
@ -891,6 +893,8 @@ void PrintDialog::DoPrint(wxCommandEvent&)
void systemGbPrint(uint8_t* data, int len, int pages, int feed, int pal, int cont) void systemGbPrint(uint8_t* data, int len, int pages, int feed, int pal, int cont)
{ {
(void)pages; // unused params
(void)cont; // unused params
ModalPause mp; // this might take a while, so signal a pause ModalPause mp; // this might take a while, so signal a pause
GameArea* panel = wxGetApp().frame->GetPanel(); GameArea* panel = wxGetApp().frame->GetPanel();
static uint16_t* accum_prdata; static uint16_t* accum_prdata;
@ -1111,6 +1115,8 @@ SoundDriver* systemSoundInit()
void systemOnWriteDataToSoundBuffer(const uint16_t* finalWave, int length) void systemOnWriteDataToSoundBuffer(const uint16_t* finalWave, int length)
{ {
(void)finalWave; // unused params
(void)length; // unused params
#ifndef NO_FFMPEG #ifndef NO_FFMPEG
GameArea* panel = wxGetApp().frame->GetPanel(); GameArea* panel = wxGetApp().frame->GetPanel();

View File

@ -82,11 +82,13 @@ public:
} }
void Next(wxCommandEvent& ev) void Next(wxCommandEvent& ev)
{ {
(void)ev; // unused params
CPULoop(1); CPULoop(1);
GotoPC(); GotoPC();
} }
void Goto(wxCommandEvent& ev) void Goto(wxCommandEvent& ev)
{ {
(void)ev; // unused params
wxString as = goto_addr->GetValue(); wxString as = goto_addr->GetValue();
if (!as.size()) if (!as.size())
@ -100,6 +102,7 @@ public:
// wx-2.8.4 or MacOSX compiler can't resolve overloads in evt table // wx-2.8.4 or MacOSX compiler can't resolve overloads in evt table
void GotoPCEv(wxCommandEvent& ev) void GotoPCEv(wxCommandEvent& ev)
{ {
(void)ev; // unused params
GotoPC(); GotoPC();
} }
void GotoPC() void GotoPC()
@ -120,6 +123,7 @@ public:
} }
void RefreshCmd(wxCommandEvent& ev) void RefreshCmd(wxCommandEvent& ev)
{ {
(void)ev; // unused params
UpdateDis(); UpdateDis();
} }
void UpdateDis() void UpdateDis()
@ -143,6 +147,7 @@ public:
void RefillListEv(wxCommandEvent& ev) void RefillListEv(wxCommandEvent& ev)
{ {
(void)ev; // unused params
// what an unsafe calling convention // what an unsafe calling convention
// examination of disArm shows that max len is 69 chars // examination of disArm shows that max len is 69 chars
// (e.g. 0x081cb6db), and I assume disThumb is shorter // (e.g. 0x081cb6db), and I assume disThumb is shorter
@ -221,11 +226,13 @@ public:
} }
void Next(wxCommandEvent& ev) void Next(wxCommandEvent& ev)
{ {
(void)ev; // unused params
gbEmulate(1); gbEmulate(1);
GotoPC(); GotoPC();
} }
void Goto(wxCommandEvent& ev) void Goto(wxCommandEvent& ev)
{ {
(void)ev; // unused params
wxString as = goto_addr->GetValue(); wxString as = goto_addr->GetValue();
if (!as.size()) if (!as.size())
@ -239,6 +246,7 @@ public:
// wx-2.8.4 or MacOSX compiler can't resolve overloads in evt table // wx-2.8.4 or MacOSX compiler can't resolve overloads in evt table
void GotoPCEv(wxCommandEvent& ev) void GotoPCEv(wxCommandEvent& ev)
{ {
(void)ev; // unused params
GotoPC(); GotoPC();
} }
void GotoPC() void GotoPC()
@ -248,6 +256,7 @@ public:
} }
void RefreshCmd(wxCommandEvent& ev) void RefreshCmd(wxCommandEvent& ev)
{ {
(void)ev; // unused params
UpdateDis(); UpdateDis();
} }
void UpdateDis() void UpdateDis()
@ -278,6 +287,7 @@ public:
void RefillListEv(wxCommandEvent& ev) void RefillListEv(wxCommandEvent& ev)
{ {
(void)ev; // unused params
// what an unsafe calling convention // what an unsafe calling convention
// examination of gbDis shows that max len is 26 chars // examination of gbDis shows that max len is 26 chars
// (e.g. 0xe2) // (e.g. 0xe2)
@ -322,6 +332,10 @@ void MainFrame::Disassemble(void)
case IMAGE_GB: case IMAGE_GB:
LoadXRCViewer(GBDisassemble); LoadXRCViewer(GBDisassemble);
break; break;
case IMAGE_UNKNOWN:
// do nothing
break;
} }
} }
@ -357,7 +371,7 @@ public:
wxString longline = lline; wxString longline = lline;
int lwidth = 0; int lwidth = 0;
for (int i = 0; i < NUM_IOREGS; i++) { for (long unsigned int i = 0; i < NUM_IOREGS; i++) {
addr->Append(wxGetTranslation(ioregs[i].name)); addr->Append(wxGetTranslation(ioregs[i].name));
// find longest label // find longest label
@ -391,6 +405,7 @@ public:
void SelectEv(wxCommandEvent& ev) void SelectEv(wxCommandEvent& ev)
{ {
(void)ev; // unused params
Select(addr->GetSelection()); Select(addr->GetSelection());
} }
@ -450,11 +465,13 @@ public:
void RefreshEv(wxCommandEvent& ev) void RefreshEv(wxCommandEvent& ev)
{ {
(void)ev; // unused params
Update(); Update();
} }
void Apply(wxCommandEvent& ev) void Apply(wxCommandEvent& ev)
{ {
(void)ev; // unused params
int sel = addr->GetSelection(); int sel = addr->GetSelection();
uint16_t* addr = ioregs[sel].address ? ioregs[sel].address : (uint16_t*)&ioMem[ioregs[sel].offset]; uint16_t* addr = ioregs[sel].address ? ioregs[sel].address : (uint16_t*)&ioMem[ioregs[sel].offset];
uint16_t mask, reg = *addr; uint16_t mask, reg = *addr;
@ -534,6 +551,7 @@ void LogDialog::Update()
void LogDialog::Save(wxCommandEvent& ev) void LogDialog::Save(wxCommandEvent& ev)
{ {
(void)ev; // unused params
static wxString logdir = wxEmptyString, def_name = wxEmptyString; static wxString logdir = wxEmptyString, def_name = wxEmptyString;
if (def_name.empty()) if (def_name.empty())
@ -560,6 +578,7 @@ void LogDialog::Save(wxCommandEvent& ev)
void LogDialog::Clear(wxCommandEvent& ev) void LogDialog::Clear(wxCommandEvent& ev)
{ {
(void)ev; // unused params
wxGetApp().log.clear(); wxGetApp().log.clear();
Update(); Update();
} }
@ -641,12 +660,14 @@ public:
} }
void BlockStart(wxCommandEvent& ev) void BlockStart(wxCommandEvent& ev)
{ {
(void)ev; // unused params
unsigned long l; unsigned long l;
bs->GetStringSelection().ToULong(&l, 0); bs->GetStringSelection().ToULong(&l, 0);
Goto(l); Goto(l);
} }
void GotoEv(wxCommandEvent& ev) void GotoEv(wxCommandEvent& ev)
{ {
(void)ev; // unused params
unsigned long l; unsigned long l;
wxString v = goto_addr->GetValue(); wxString v = goto_addr->GetValue();
@ -662,6 +683,7 @@ public:
} }
void RefreshCmd(wxCommandEvent& ev) void RefreshCmd(wxCommandEvent& ev)
{ {
(void)ev; // unused params
Update(); Update();
} }
@ -669,6 +691,7 @@ public:
void Load(wxCommandEvent& ev) void Load(wxCommandEvent& ev)
{ {
(void)ev; // unused params
if (memsave_fn.empty()) if (memsave_fn.empty())
memsave_fn = wxGetApp().frame->GetPanel()->game_name() + wxT(".dmp"); memsave_fn = wxGetApp().frame->GetPanel()->game_name() + wxT(".dmp");
@ -720,6 +743,7 @@ public:
void Save(wxCommandEvent& ev) void Save(wxCommandEvent& ev)
{ {
(void)ev; // unused params
wxString s; wxString s;
s.Printf(addrlen == 4 ? wxT("%04X") : wxT("%08X"), mv->GetAddr()); s.Printf(addrlen == 4 ? wxT("%04X") : wxT("%08X"), mv->GetAddr());
selreg_addr->SetValue(s); selreg_addr->SetValue(s);
@ -802,6 +826,7 @@ public:
// wx-2.8.4 or MacOSX compiler can't resolve overloads in evt table // wx-2.8.4 or MacOSX compiler can't resolve overloads in evt table
void RefillListEv(wxCommandEvent& ev) void RefillListEv(wxCommandEvent& ev)
{ {
(void)ev; // unused params
Update(); Update();
} }
@ -823,6 +848,7 @@ public:
void WriteVal(wxCommandEvent& ev) void WriteVal(wxCommandEvent& ev)
{ {
(void)ev; // unused params
switch (mv->fmt) { switch (mv->fmt) {
case 0: case 0:
CPUWriteByteQuick(mv->writeaddr, mv->writeval); CPUWriteByteQuick(mv->writeaddr, mv->writeval);
@ -849,7 +875,7 @@ public:
while (len > 0) { while (len > 0) {
memoryMap m = map[addr >> 24]; memoryMap m = map[addr >> 24];
uint32_t off = addr & m.mask; uint32_t off = addr & m.mask;
uint32_t wlen = (off + len) > m.mask ? m.mask + 1 - off : len; int wlen = (off + len) > m.mask ? m.mask + 1 - off : len;
wlen = f.Read(m.address + off, wlen); wlen = f.Read(m.address + off, wlen);
if (wlen < 0) if (wlen < 0)
@ -871,7 +897,7 @@ public:
while (len > 0) { while (len > 0) {
memoryMap m = map[addr >> 24]; memoryMap m = map[addr >> 24];
uint32_t off = addr & m.mask; uint32_t off = addr & m.mask;
uint32_t wlen = (off + len) > m.mask ? m.mask + 1 - off : len; int wlen = (off + len) > m.mask ? m.mask + 1 - off : len;
wlen = f.Write(m.address + off, wlen); wlen = f.Write(m.address + off, wlen);
if (wlen < 0) if (wlen < 0)
@ -910,6 +936,7 @@ public:
// wx-2.8.4 or MacOSX compiler can't resolve overloads in evt table // wx-2.8.4 or MacOSX compiler can't resolve overloads in evt table
void RefillListEv(wxCommandEvent& ev) void RefillListEv(wxCommandEvent& ev)
{ {
(void)ev; // unused params
Update(); Update();
} }
@ -931,6 +958,7 @@ public:
void WriteVal(wxCommandEvent& ev) void WriteVal(wxCommandEvent& ev)
{ {
(void)ev; // unused params
switch (mv->fmt) { switch (mv->fmt) {
case 0: case 0:
GBWriteByteQuick(mv->writeaddr, mv->writeval); GBWriteByteQuick(mv->writeaddr, mv->writeval);
@ -957,7 +985,7 @@ public:
while (len > 0) { while (len > 0) {
uint8_t* maddr = gbMemoryMap[addr >> 12]; uint8_t* maddr = gbMemoryMap[addr >> 12];
uint32_t off = addr & 0xfff; uint32_t off = addr & 0xfff;
uint32_t wlen = (off + len) > 0xfff ? 0x1000 - off : len; int wlen = (off + len) > 0xfff ? 0x1000 - off : len;
wlen = f.Read(maddr + off, wlen); wlen = f.Read(maddr + off, wlen);
if (wlen < 0) if (wlen < 0)
@ -979,7 +1007,7 @@ public:
while (len > 0) { while (len > 0) {
uint8_t* maddr = gbMemoryMap[addr >> 12]; uint8_t* maddr = gbMemoryMap[addr >> 12];
uint32_t off = addr & 0xfff; uint32_t off = addr & 0xfff;
uint32_t wlen = (off + len) > 0xfff ? 0x1000 - off : len; int wlen = (off + len) > 0xfff ? 0x1000 - off : len;
wlen = f.Write(maddr + off, wlen); wlen = f.Write(maddr + off, wlen);
if (wlen < 0) if (wlen < 0)
@ -1009,5 +1037,8 @@ void MainFrame::MemViewer()
case IMAGE_GB: case IMAGE_GB:
LoadXRCViewer(GBMem); LoadXRCViewer(GBMem);
break; break;
default:
break;
} }
} }

View File

@ -5,6 +5,7 @@
namespace Viewers { namespace Viewers {
void Viewer::CloseDlg(wxCloseEvent& ev) void Viewer::CloseDlg(wxCloseEvent& ev)
{ {
(void)ev; // unused params
// stop tracking dialog // stop tracking dialog
MainFrame* f = wxGetApp().frame; MainFrame* f = wxGetApp().frame;
@ -76,12 +77,12 @@ IMPLEMENT_DYNAMIC_CLASS(DisList, wxPanel)
DisList::DisList() DisList::DisList()
: wxPanel() : wxPanel()
, nlines(0)
, topaddr(0)
, tc() , tc()
, sb() , sb()
, didinit(false) , didinit(false)
, nlines(0)
, issel(false) , issel(false)
, topaddr(0)
{ {
} }
@ -191,7 +192,7 @@ void DisList::Refill()
MoveSB(); MoveSB();
wxString val; wxString val;
for (int i = 0; i < nlines && i < strings.size(); i++) { for (size_t i = 0; i < (size_t)nlines && i < strings.size(); i++) {
val += strings[i]; val += strings[i];
val += wxT('\n'); val += wxT('\n');
} }
@ -203,6 +204,7 @@ void DisList::Refill()
// on resize, recompute shown lines and refill if necessary // on resize, recompute shown lines and refill if necessary
void DisList::Resize(wxSizeEvent& ev) void DisList::Resize(wxSizeEvent& ev)
{ {
(void)ev; // unused params
if (!didinit) // prevent crash on win32 if (!didinit) // prevent crash on win32
return; return;
@ -215,10 +217,10 @@ void DisList::Resize(wxSizeEvent& ev)
wxString val; wxString val;
tc.SetSize(sz.GetWidth(), (nlines + 1) * lineheight + extraheight); tc.SetSize(sz.GetWidth(), (nlines + 1) * lineheight + extraheight);
if (nlines > strings.size()) if ((size_t)nlines > strings.size())
RefillNeeded(); RefillNeeded();
else { else {
for (int i = 0; i < nlines && i < strings.size(); i++) { for (size_t i = 0; i < (size_t)nlines && i < strings.size(); i++) {
val += strings[i]; val += strings[i];
val += wxT('\n'); val += wxT('\n');
} }
@ -236,7 +238,7 @@ void DisList::SetSel()
if (!issel) if (!issel)
return; return;
if (nlines > addrs.size() || (uint32_t)addrs[0] > seladdr || (uint32_t)addrs[nlines - 1] <= seladdr) if ((size_t)nlines > addrs.size() || (uint32_t)addrs[0] > seladdr || (uint32_t)addrs[nlines - 1] <= seladdr)
return; return;
for (int i = 0, start = 0; i < nlines; i++) { for (int i = 0, start = 0; i < nlines; i++) {
@ -262,7 +264,7 @@ void DisList::SetSel(uint32_t addr)
seladdr = addr; seladdr = addr;
issel = true; issel = true;
if (addrs.size() < 4 || addrs.size() < nlines || topaddr > addr || (uint32_t)addrs[addrs.size() - 4] < addr) { if (addrs.size() < 4 || addrs.size() < (size_t)nlines || topaddr > addr || (uint32_t)addrs[addrs.size() - 4] < addr) {
topaddr = addr; topaddr = addr;
strings.clear(); strings.clear();
addrs.clear(); addrs.clear();
@ -282,13 +284,13 @@ IMPLEMENT_DYNAMIC_CLASS(MemView, wxPanel)
MemView::MemView() MemView::MemView()
: wxPanel() : wxPanel()
, nlines(0)
, topaddr(0)
, addrlab(0)
, disp() , disp()
, sb() , sb()
, didinit(false) , didinit(false)
, nlines(0)
, selnib(-1) , selnib(-1)
, topaddr(0)
, addrlab(0)
{ {
} }
@ -370,7 +372,7 @@ void MemView::MouseEvent(wxMouseEvent& ev)
void MemView::ShowCaret() void MemView::ShowCaret()
{ {
if (seladdr < topaddr || seladdr >= topaddr + nlines * 16) if (seladdr < (int)topaddr || seladdr >= (int)topaddr + nlines * 16)
selnib = -1; selnib = -1;
if (selnib < 0) { if (selnib < 0) {
@ -429,7 +431,7 @@ void MemView::KeyEvent(wxKeyEvent& ev)
selnib--; selnib--;
if (selnib >= 32) { if (selnib >= 32) {
if (seladdr == maxaddr - 16) if (seladdr == (int)maxaddr - 16)
selnib = 32 - nnib; selnib = 32 - nnib;
else { else {
selnib -= 32; selnib -= 32;
@ -461,7 +463,7 @@ void MemView::KeyEvent(wxKeyEvent& ev)
case WXK_DOWN: case WXK_DOWN:
case WXK_NUMPAD_DOWN: case WXK_NUMPAD_DOWN:
if (seladdr < maxaddr - 16) if (seladdr < (int)maxaddr - 16)
seladdr += 16; seladdr += 16;
break; break;
@ -493,7 +495,7 @@ void MemView::KeyEvent(wxKeyEvent& ev)
selnib--; selnib--;
if (selnib >= 32) { if (selnib >= 32) {
if (seladdr == maxaddr - 16) if (seladdr == (int)maxaddr - 16)
selnib = 32 - nnib; selnib = 32 - nnib;
else { else {
selnib -= 32; selnib -= 32;
@ -507,7 +509,7 @@ void MemView::KeyEvent(wxKeyEvent& ev)
mask = 0xff << bno * 8; mask = 0xff << bno * 8;
val = k << bno * 8; val = k << bno * 8;
} else { } else {
mask = 0xf << bno * 8 + nibno * 4; mask = 8 * (0xf << bno) + 4 * nibno;
val = isdigit(k) ? k - '0' : tolower(k) + 10 - 'a'; val = isdigit(k) ? k - '0' : tolower(k) + 10 - 'a';
val <<= bno * 8 + nibno * 4; val <<= bno * 8 + nibno * 4;
} }
@ -515,7 +517,7 @@ void MemView::KeyEvent(wxKeyEvent& ev)
if ((words[wno] & mask) == val) if ((words[wno] & mask) == val)
break; break;
words[wno] = words[wno] & ~mask | val; words[wno] = ((words[wno] & ~mask) | val);
writeaddr = topaddr + 4 * wno; writeaddr = topaddr + 4 * wno;
val = words[wno]; val = words[wno];
@ -631,6 +633,7 @@ void MemView::Repaint()
void MemView::RepaintEv(wxPaintEvent& ev) void MemView::RepaintEv(wxPaintEvent& ev)
{ {
(void)ev; // unused params
wxPaintDC dc(&disp); wxPaintDC dc(&disp);
dc.SetBackgroundMode(wxSOLID); dc.SetBackgroundMode(wxSOLID);
Refill(dc); Refill(dc);
@ -644,7 +647,7 @@ void MemView::Refill(wxDC& dc)
// doesn't seem to inherit font properly // doesn't seem to inherit font properly
dc.SetFont(GetFont()); dc.SetFont(GetFont());
for (int i = 0; i < nlines && i < words.size() / 4; i++) { for (size_t i = 0; i < (size_t)nlines && i < words.size() / 4; i++) {
wxString line, word; wxString line, word;
line.Printf(maxaddr > 0xffff ? wxT("%08X ") : wxT("%04X "), topaddr + i * 16); line.Printf(maxaddr > 0xffff ? wxT("%08X ") : wxT("%04X "), topaddr + i * 16);
@ -693,6 +696,7 @@ void MemView::Refill(wxDC& dc)
// on resize, recompute shown lines and refill if necessary // on resize, recompute shown lines and refill if necessary
void MemView::Resize(wxSizeEvent& ev) void MemView::Resize(wxSizeEvent& ev)
{ {
(void)ev; // unused params
if (!didinit) // prevent crash on win32 if (!didinit) // prevent crash on win32
return; return;
@ -705,7 +709,7 @@ void MemView::Resize(wxSizeEvent& ev)
wxString val; wxString val;
disp.SetSize(sz.GetWidth(), (nlines + 1) * charheight); disp.SetSize(sz.GetWidth(), (nlines + 1) * charheight);
if (nlines > words.size() / 4) { if ((size_t)nlines > words.size() / 4) {
if (topaddr + nlines * 16 > maxaddr) if (topaddr + nlines * 16 > maxaddr)
topaddr = maxaddr - nlines * 16 + 1; topaddr = maxaddr - nlines * 16 + 1;
@ -889,6 +893,7 @@ void PixView::SetSel(int x, int y, bool desel_cview_update)
void PixView::Redraw(wxPaintEvent& ev) void PixView::Redraw(wxPaintEvent& ev)
{ {
(void)ev; // unused params
if (!bm) if (!bm)
return; return;
@ -988,6 +993,7 @@ void PixViewEvt::click()
IMPLEMENT_DYNAMIC_CLASS(GfxPanel, wxPanel) IMPLEMENT_DYNAMIC_CLASS(GfxPanel, wxPanel)
void GfxPanel::DrawBitmap(wxPaintEvent& ev) void GfxPanel::DrawBitmap(wxPaintEvent& ev)
{ {
(void)ev; // unused params
if (!bm) if (!bm)
return; return;
@ -1122,6 +1128,7 @@ void GfxViewer::BMPSize(int w, int h)
void GfxViewer::StretchTog(wxCommandEvent& ev) void GfxViewer::StretchTog(wxCommandEvent& ev)
{ {
(void)ev; // unused params
wxSize sz; wxSize sz;
if (str->GetValue()) { if (str->GetValue()) {
@ -1138,6 +1145,7 @@ void GfxViewer::StretchTog(wxCommandEvent& ev)
void GfxViewer::SaveBMP(wxCommandEvent& ev) void GfxViewer::SaveBMP(wxCommandEvent& ev)
{ {
(void)ev; // unused params
GameArea* panel = wxGetApp().frame->GetPanel(); GameArea* panel = wxGetApp().frame->GetPanel();
bmp_save_dir = wxGetApp().frame->GetGamePath(gopts.scrshot_dir); bmp_save_dir = wxGetApp().frame->GetGamePath(gopts.scrshot_dir);
// no attempt is made here to translate the dialog type name // no attempt is made here to translate the dialog type name
@ -1175,6 +1183,7 @@ void GfxViewer::SaveBMP(wxCommandEvent& ev)
void GfxViewer::RefreshEv(wxCommandEvent& ev) void GfxViewer::RefreshEv(wxCommandEvent& ev)
{ {
(void)ev; // unused params
Update(); Update();
} }

View File

@ -141,6 +141,7 @@ protected:
// assigned to textctrl to avoid mouse input // assigned to textctrl to avoid mouse input
void MouseEvent(wxMouseEvent& ev) void MouseEvent(wxMouseEvent& ev)
{ {
(void)ev; // unused param
} }
// the subwidgets // the subwidgets
wxTextCtrl tc; wxTextCtrl tc;
@ -412,6 +413,7 @@ public:
} }
void MouseEvent(wxMouseEvent& ev) void MouseEvent(wxMouseEvent& ev)
{ {
(void)ev; // unused param
} }
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS(DispCheckBox) DECLARE_DYNAMIC_CLASS(DispCheckBox)

View File

@ -8,6 +8,13 @@ BEGIN_EVENT_TABLE(wxJoyKeyTextCtrl, wxKeyTextCtrl)
EVT_SDLJOY(wxJoyKeyTextCtrl::OnJoy) EVT_SDLJOY(wxJoyKeyTextCtrl::OnJoy)
END_EVENT_TABLE() END_EVENT_TABLE()
// Initializer for struct wxJoyKeyBinding
wxJoyKeyBinding newWxJoyKeyBinding(int key, int mod, int joy)
{
struct wxJoyKeyBinding tmp = {key, mod, joy};
return tmp;
}
int wxJoyKeyTextCtrl::DigitalButton(wxSDLJoyEvent& event) int wxJoyKeyTextCtrl::DigitalButton(wxSDLJoyEvent& event)
{ {
int sdlval = event.GetControlValue(); int sdlval = event.GetControlValue();
@ -151,7 +158,7 @@ wxString wxJoyKeyTextCtrl::ToString(wxJoyKeyBinding_v keys, wxChar sep)
{ {
wxString ret; wxString ret;
for (int i = 0; i < keys.size(); i++) { for (size_t i = 0; i < keys.size(); i++) {
if (i > 0) if (i > 0)
ret += sep; ret += sep;
@ -213,7 +220,7 @@ static bool ParseJoy(const wxString& s, int len, int& mod, int& key, int& joy)
return false; return false;
const wxString p = s.Mid(l); const wxString p = s.Mid(l);
int alen = len - l; size_t alen = len - l;
joyre.GetMatch(&b, &l, 1); joyre.GetMatch(&b, &l, 1);
joy = simple_atoi(s.Mid(b), l); joy = simple_atoi(s.Mid(b), l);
#define is_ctrl(re) re.Matches(p) && re.GetMatch(&b, &l) && l == alen && !b #define is_ctrl(re) re.Matches(p) && re.GetMatch(&b, &l) && l == alen && !b
@ -268,12 +275,12 @@ wxJoyKeyBinding_v wxJoyKeyTextCtrl::FromString(const wxString& s, wxChar sep)
{ {
wxJoyKeyBinding_v ret, empty; wxJoyKeyBinding_v ret, empty;
int mod, key, joy; int mod, key, joy;
int len = s.size(); size_t len = s.size();
if (!len) if (!len)
return empty; return empty;
for (int lastkey = len - 1; (lastkey = s.rfind(sep, lastkey)) != wxString::npos; lastkey--) { for (size_t lastkey = len - 1; (lastkey = s.rfind(sep, lastkey)) != wxString::npos; lastkey--) {
if (lastkey == len - 1) { if (lastkey == len - 1) {
// sep as accel // sep as accel
if (!lastkey) if (!lastkey)

View File

@ -16,6 +16,7 @@ void wxKeyTextCtrl::OnKeyDown(wxKeyEvent& event)
void wxKeyTextCtrl::OnKeyUp(wxKeyEvent& event) void wxKeyTextCtrl::OnKeyUp(wxKeyEvent& event)
{ {
(void)event; // unused param
int mod = lastmod; int mod = lastmod;
int key = lastkey; int key = lastkey;
lastmod = lastkey = 0; lastmod = lastkey = 0;
@ -30,7 +31,7 @@ void wxKeyTextCtrl::OnKeyUp(wxKeyEvent& event)
// if blank or backspace is modified, add normally instead // if blank or backspace is modified, add normally instead
if (clearable && !mod && key == WXK_BACK && !GetValue().empty()) { if (clearable && !mod && key == WXK_BACK && !GetValue().empty()) {
wxString val = GetValue(); wxString val = GetValue();
int lastkey = val.rfind(multikey); size_t lastkey = val.rfind(multikey);
if (lastkey && lastkey != wxString::npos) { if (lastkey && lastkey != wxString::npos) {
// if this was actually a ,-accel, delete instead // if this was actually a ,-accel, delete instead
@ -79,7 +80,7 @@ wxString wxKeyTextCtrl::ToString(int mod, int key)
wxString s = ae.ToString(); wxString s = ae.ToString();
if (char_override || mod_override) { if (char_override || mod_override) {
int l = s.rfind(wxT('-')); size_t l = s.rfind(wxT('-'));
if (l == wxString::npos) if (l == wxString::npos)
l = 0; l = 0;
@ -150,7 +151,7 @@ wxString wxKeyTextCtrl::ToString(wxAcceleratorEntry_v keys, wxChar sep)
{ {
wxString ret; wxString ret;
for (int i = 0; i < keys.size(); i++) { for (size_t i = 0; i < keys.size(); i++) {
if (i > 0) if (i > 0)
ret += sep; ret += sep;
@ -176,16 +177,16 @@ bool wxKeyTextCtrl::ParseString(const wxString& s, int len, int& mod, int& key)
a.Append(s.Left(len)); a.Append(s.Left(len));
wxAcceleratorEntry ae; wxAcceleratorEntry ae;
#ifndef __WXMAC__ #ifndef __WXMAC__
#define check_meta(str) \ #define check_meta(str) \
do { \ do { \
wxString meta = str; \ wxString meta = str; \
for (int ml = 0; (ml = a.find(meta, ml)) != wxString::npos; ml++) { \ for (size_t ml = 0; (ml = a.find(meta, ml)) != wxString::npos; ml++) { \
if (!ml || a[ml - 1] == wxT('-') || a[ml - 1] == wxT('+')) { \ if (!ml || a[ml - 1] == wxT('-') || a[ml - 1] == wxT('+')) { \
mod |= wxMOD_META; \ mod |= wxMOD_META; \
a.erase(ml, meta.size()); \ a.erase(ml, meta.size()); \
ml = -1; \ ml = -1; \
} \ } \
} \ } \
} while (0) } while (0)
check_meta(wxT("Meta-")); check_meta(wxT("Meta-"));
check_meta(wxT("Meta+")); check_meta(wxT("Meta+"));
@ -252,9 +253,9 @@ wxAcceleratorEntry_v wxKeyTextCtrl::FromString(const wxString& s, wxChar sep)
{ {
wxAcceleratorEntry_v ret, empty; wxAcceleratorEntry_v ret, empty;
int mod, key; int mod, key;
int len = s.size(); size_t len = s.size();
for (int lastkey = len - 1; (lastkey = s.rfind(sep, lastkey)) != wxString::npos; lastkey--) { for (size_t lastkey = len - 1; (lastkey = s.rfind(sep, lastkey)) != wxString::npos; lastkey--) {
if (lastkey == len - 1) { if (lastkey == len - 1) {
// sep as accel // sep as accel
if (!lastkey) if (!lastkey)

View File

@ -14,13 +14,19 @@ struct wxSDLJoyState {
if (dev) if (dev)
SDL_JoystickClose(dev); SDL_JoystickClose(dev);
} }
wxSDLJoyState()
{
dev = NULL;
nax = nhat = nbut = 0;
curval = NULL;
}
}; };
wxSDLJoy::wxSDLJoy(bool analog) wxSDLJoy::wxSDLJoy(bool analog)
: wxTimer() : wxTimer()
, digital(!analog) , digital(!analog)
, evthandler(0)
, joystate(0) , joystate(0)
, evthandler(0)
, nosticks(true) , nosticks(true)
{ {
// Start up joystick if not already started // Start up joystick if not already started
@ -37,7 +43,6 @@ wxSDLJoy::wxSDLJoy(bool analog)
return; return;
joystate = new wxSDLJoyState[njoy]; joystate = new wxSDLJoyState[njoy];
memset(joystate, 0, njoy * sizeof(*joystate));
for (int i = 0; i < njoy; i++) { for (int i = 0; i < njoy; i++) {
SDL_Joystick* dev = joystate[i].dev = SDL_JoystickOpen(i); SDL_Joystick* dev = joystate[i].dev = SDL_JoystickOpen(i);

View File

@ -15,6 +15,9 @@ typedef struct wxJoyKeyBinding {
// if joy is non-0, key = control number, and mod = control type // if joy is non-0, key = control number, and mod = control type
} wxJoyKeyBinding; } wxJoyKeyBinding;
// Initializer for struct wxJoyKeyBinding
wxJoyKeyBinding newWxJoyKeyBinding(int key = 0, int mod = 0, int joy = 0);
typedef std::vector<wxJoyKeyBinding> wxJoyKeyBinding_v; typedef std::vector<wxJoyKeyBinding> wxJoyKeyBinding_v;
// joystick control types // joystick control types
@ -87,6 +90,7 @@ public:
bool TransferFromWindow(); bool TransferFromWindow();
bool Validate(wxWindow* p) bool Validate(wxWindow* p)
{ {
(void)p; // unused params
return true; return true;
} }

View File

@ -99,6 +99,7 @@ public:
bool TransferFromWindow(); bool TransferFromWindow();
bool Validate(wxWindow* p) bool Validate(wxWindow* p)
{ {
(void)p; // unused params
return true; return true;
} }

View File

@ -33,16 +33,16 @@ class wxBoolIntValidator : public wxValidator {
public: public:
wxBoolIntValidator(int* _vptr, int _val, int _mask = ~0) wxBoolIntValidator(int* _vptr, int _val, int _mask = ~0)
: wxValidator() : wxValidator()
, vptr(_vptr)
, val(_val) , val(_val)
, mask(_mask) , mask(_mask)
, vptr(_vptr)
{ {
} }
wxBoolIntValidator(const wxBoolIntValidator& v) wxBoolIntValidator(const wxBoolIntValidator& v)
: wxValidator() : wxValidator()
, vptr(v.vptr)
, val(v.val) , val(v.val)
, mask(v.mask) , mask(v.mask)
, vptr(v.vptr)
{ {
} }
wxObject* Clone() const wxObject* Clone() const
@ -53,6 +53,7 @@ public:
bool TransferFromWindow(); bool TransferFromWindow();
bool Validate(wxWindow* p) bool Validate(wxWindow* p)
{ {
(void)p; // unused params
return true; return true;
} }
@ -105,6 +106,7 @@ public:
bool TransferFromWindow(); bool TransferFromWindow();
bool Validate(wxWindow* p) bool Validate(wxWindow* p)
{ {
(void)p; // unused params
return true; return true;
} }
@ -133,6 +135,7 @@ public:
bool TransferFromWindow(); bool TransferFromWindow();
bool Validate(wxWindow* p) bool Validate(wxWindow* p)
{ {
(void)p; // unused params
return true; return true;
} }
@ -156,8 +159,8 @@ public:
} }
wxColorValidator(uint16_t* vptr) wxColorValidator(uint16_t* vptr)
: wxValidator() : wxValidator()
, ptr16(vptr)
, ptr32(0) , ptr32(0)
, ptr16(vptr)
{ {
} }
wxColorValidator(const wxColorValidator& v) wxColorValidator(const wxColorValidator& v)
@ -174,6 +177,7 @@ public:
bool TransferFromWindow(); bool TransferFromWindow();
bool Validate(wxWindow* p) bool Validate(wxWindow* p)
{ {
(void)p; // unused params
return true; return true;
} }

View File

@ -289,7 +289,7 @@ bool wxColorValidator::TransferFromWindow()
static void enable(wxWindow_v controls, std::vector<int> reverse, bool en) static void enable(wxWindow_v controls, std::vector<int> reverse, bool en)
{ {
for (int i = 0; i < controls.size(); i++) for (size_t i = 0; i < controls.size(); i++)
controls[i]->Enable(reverse.size() <= i || !reverse[i] ? en : !en); controls[i]->Enable(reverse.size() <= i || !reverse[i] ? en : !en);
} }
@ -461,6 +461,7 @@ bool wxUIntValidator::TransferFromWindow()
bool wxUIntValidator::Validate(wxWindow* parent) bool wxUIntValidator::Validate(wxWindow* parent)
{ {
(void)parent; // unused params
wxSpinCtrl* ctrl = wxDynamicCast(GetWindow(), wxSpinCtrl); wxSpinCtrl* ctrl = wxDynamicCast(GetWindow(), wxSpinCtrl);
if (ctrl) { if (ctrl) {

View File

@ -32,6 +32,14 @@
IMPLEMENT_APP(wxvbamApp) IMPLEMENT_APP(wxvbamApp)
IMPLEMENT_DYNAMIC_CLASS(MainFrame, wxFrame) IMPLEMENT_DYNAMIC_CLASS(MainFrame, wxFrame)
// Initializer for struct cmditem
cmditem new_cmditem(const wxString cmd, const wxString name, int cmd_id,
int mask_flags, wxMenuItem* mi)
{
struct cmditem tmp = {cmd, name, cmd_id, mask_flags, mi};
return tmp;
}
// generate config file path // generate config file path
static void get_config_path(wxPathList& path, bool exists = true) static void get_config_path(wxPathList& path, bool exists = true)
{ {
@ -109,7 +117,7 @@ static void tack_full_path(wxString& s, const wxString& app = wxEmptyString)
wxPathList full_config_path; wxPathList full_config_path;
get_config_path(full_config_path, false); get_config_path(full_config_path, false);
for (int i = 0; i < full_config_path.size(); i++) for (size_t i = 0; i < full_config_path.size(); i++)
s += wxT("\n\t") + full_config_path[i] + app; s += wxT("\n\t") + full_config_path[i] + app;
} }
@ -140,7 +148,7 @@ wxString wxvbamApp::GetConfigurationPath()
// dir or parent to create it in in OnInit in normal order // dir or parent to create it in in OnInit in normal order
// (from user paths to system paths.) // (from user paths to system paths.)
if (data_path.empty()) { if (data_path.empty()) {
for (int i = 0; i < config_path.size(); i++) { for (size_t i = 0; i < config_path.size(); i++) {
// Check if path is writeable // Check if path is writeable
if (wxIsWritable(config_path[i])) { if (wxIsWritable(config_path[i])) {
data_path = config_path[i]; data_path = config_path[i];
@ -221,7 +229,7 @@ bool wxvbamApp::OnInit()
// 2.9 has LoadAllFiles(), but this is 2.8, so we'll do it manually // 2.9 has LoadAllFiles(), but this is 2.8, so we'll do it manually
wxString cwd = wxGetCwd(); wxString cwd = wxGetCwd();
for (int i = 0; i < config_path.size(); i++) for (size_t i = 0; i < config_path.size(); i++)
if (wxDirExists(config_path[i]) && wxSetWorkingDirectory(config_path[i])) { if (wxDirExists(config_path[i]) && wxSetWorkingDirectory(config_path[i])) {
// *.xr[cs] doesn't work (double the number of scans) // *.xr[cs] doesn't work (double the number of scans)
// 2.9 gives errors for no files found, so manual precheck needed // 2.9 gives errors for no files found, so manual precheck needed
@ -299,7 +307,7 @@ bool wxvbamApp::OnInit()
} }
// process command-line options // process command-line options
for (int i = 0; i < pending_optset.size(); i++) { for (size_t i = 0; i < pending_optset.size(); i++) {
auto parts = str_split(pending_optset[i], wxT('=')); auto parts = str_split(pending_optset[i], wxT('='));
opt_set(parts[0], parts[1]); opt_set(parts[0], parts[1]);
} }
@ -470,28 +478,33 @@ void wxvbamApp::OnInitCmdLine(wxCmdLineParser& cl)
// locale // locale
static wxCmdLineEntryDesc opttab[] = { static wxCmdLineEntryDesc opttab[] = {
{ wxCMD_LINE_OPTION, NULL, t("save-xrc"), { wxCMD_LINE_OPTION, NULL, t("save-xrc"),
N_("Save built-in XRC file and exit") }, N_("Save built-in XRC file and exit"),
wxCMD_LINE_VAL_NONE, wxCMD_LINE_VAL_NONE },
{ wxCMD_LINE_OPTION, NULL, t("save-over"), { wxCMD_LINE_OPTION, NULL, t("save-over"),
N_("Save built-in vba-over.ini and exit") }, N_("Save built-in vba-over.ini and exit"),
wxCMD_LINE_VAL_NONE, wxCMD_LINE_VAL_NONE },
{ wxCMD_LINE_SWITCH, NULL, t("print-cfg-path"), { wxCMD_LINE_SWITCH, NULL, t("print-cfg-path"),
N_("Print configuration path and exit") }, N_("Print configuration path and exit"),
wxCMD_LINE_VAL_NONE, wxCMD_LINE_VAL_NONE },
{ wxCMD_LINE_SWITCH, t("f"), t("fullscreen"), { wxCMD_LINE_SWITCH, t("f"), t("fullscreen"),
N_("Start in full-screen mode") }, N_("Start in full-screen mode"),
wxCMD_LINE_VAL_NONE, wxCMD_LINE_VAL_NONE },
#if !defined(NO_LINK) && !defined(__WXMSW__) #if !defined(NO_LINK) && !defined(__WXMSW__)
{ wxCMD_LINE_SWITCH, t("s"), t("delete-shared-state"), { wxCMD_LINE_SWITCH, t("s"), t("delete-shared-state"),
N_("Delete shared link state first, if it exists") }, N_("Delete shared link state first, if it exists"),
wxCMD_LINE_VAL_NONE, wxCMD_LINE_VAL_NONE },
#endif #endif
// stupid wx cmd line parser doesn't support duplicate options // stupid wx cmd line parser doesn't support duplicate options
// { wxCMD_LINE_OPTION, t("o"), t("option"), // { wxCMD_LINE_OPTION, t("o"), t("option"),
// _("Set configuration option; <opt>=<value> or help for list"), // _("Set configuration option; <opt>=<value> or help for list"),
{ { wxCMD_LINE_SWITCH, t("o"), t("list-options"),
wxCMD_LINE_SWITCH, t("o"), t("list-options"), N_("List all settable options and exit"),
N_("List all settable options and exit") }, wxCMD_LINE_VAL_NONE, wxCMD_LINE_VAL_NONE },
{ wxCMD_LINE_PARAM, NULL, NULL, { wxCMD_LINE_PARAM, NULL, NULL,
N_("ROM file"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, N_("ROM file"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
{ wxCMD_LINE_PARAM, NULL, NULL, { wxCMD_LINE_PARAM, NULL, NULL,
N_("<config>=<value>"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_MULTIPLE | wxCMD_LINE_PARAM_OPTIONAL }, N_("<config>=<value>"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_MULTIPLE | wxCMD_LINE_PARAM_OPTIONAL },
{ wxCMD_LINE_NONE } { wxCMD_LINE_NONE, NULL, NULL, NULL, wxCMD_LINE_VAL_NONE, wxCMD_LINE_VAL_NONE }
}; };
// 2.9 automatically translates desc, but 2.8 doesn't // 2.9 automatically translates desc, but 2.8 doesn't
#if !wxCHECK_VERSION(2, 9, 0) #if !wxCHECK_VERSION(2, 9, 0)
@ -667,10 +680,10 @@ wxvbamApp::~wxvbamApp() {
MainFrame::MainFrame() MainFrame::MainFrame()
: wxFrame() : wxFrame()
, focused(false)
, paused(false) , paused(false)
, menus_opened(0) , menus_opened(0)
, dialog_opened(0) , dialog_opened(0)
, focused(false)
{ {
} }
@ -749,6 +762,7 @@ void MainFrame::OnMenu(wxContextMenuEvent& event)
void MainFrame::OnMove(wxMoveEvent& event) void MainFrame::OnMove(wxMoveEvent& event)
{ {
(void)event; // unused params
wxRect pos = GetRect(); wxRect pos = GetRect();
int x = pos.GetX(), y = pos.GetY(); int x = pos.GetX(), y = pos.GetY();
if (x >= 0 && y >= 0 && !IsFullScreen()) if (x >= 0 && y >= 0 && !IsFullScreen())
@ -815,7 +829,7 @@ void MainFrame::SetJoystick()
for (int j = 0; j < NUM_KEYS; j++) { for (int j = 0; j < NUM_KEYS; j++) {
wxJoyKeyBinding_v b = gopts.joykey_bindings[i][j]; wxJoyKeyBinding_v b = gopts.joykey_bindings[i][j];
for (int k = 0; k < b.size(); k++) { for (size_t k = 0; k < b.size(); k++) {
int jn = b[k].joy; int jn = b[k].joy;
if (jn) { if (jn) {
@ -884,7 +898,7 @@ void MainFrame::update_state_ts(bool force)
wxString df = fts.Format(wxT("0&0 %x %X")); wxString df = fts.Format(wxT("0&0 %x %X"));
if (!ts.IsValid()) if (!ts.IsValid())
for (int j = 0; j < df.size(); j++) for (size_t j = 0; j < df.size(); j++)
if (wxIsdigit(df[j])) if (wxIsdigit(df[j]))
df[j] = wxT('-'); df[j] = wxT('-');

View File

@ -656,6 +656,11 @@ extern struct cmditem {
wxMenuItem* mi; // the menu item to invoke command, if present wxMenuItem* mi; // the menu item to invoke command, if present
} cmdtab[]; } cmdtab[];
extern const int ncmds; extern const int ncmds;
// Initializer for struct cmditem
cmditem new_cmditem(const wxString cmd = "", const wxString name = "",
int cmd_id = 0, int mask_flags = 0, wxMenuItem* mi = NULL);
// for binary search // for binary search
extern bool cmditem_lt(const struct cmditem& cmd1, const struct cmditem& cmd2); extern bool cmditem_lt(const struct cmditem& cmd1, const struct cmditem& cmd2);