the not-so-great warning purge

This commit is contained in:
Struma 2021-02-22 01:22:26 -05:00 committed by Roza
parent 06175fef4b
commit 2fd585393d
12 changed files with 64 additions and 52 deletions

View file

@ -31,8 +31,9 @@
inline void inline void
disposableAddChild(VALUE disp, VALUE child) disposableAddChild(VALUE disp, VALUE child)
{ {
if (NIL_P(disp) || NIL_P(child)) if (NIL_P(disp) || NIL_P(child)) {
return; return;
}
VALUE children = rb_iv_get(disp, "children"); VALUE children = rb_iv_get(disp, "children");
@ -54,8 +55,9 @@ disposableAddChild(VALUE disp, VALUE child)
inline void inline void
disposableRemoveChild(VALUE disp, VALUE child) disposableRemoveChild(VALUE disp, VALUE child)
{ {
if (NIL_P(disp) || NIL_P(child)) if (NIL_P(disp) || NIL_P(child)) {
return; return;
}
VALUE children = rb_iv_get(disp, "children"); VALUE children = rb_iv_get(disp, "children");
if (NIL_P(children)) if (NIL_P(children))

View file

@ -126,12 +126,14 @@ RB_METHOD(fileIntBinmode) {
return Qnil; return Qnil;
} }
#if RAPI_FULL <= 187
RB_METHOD(fileIntPos) { RB_METHOD(fileIntPos) {
SDL_RWops *ops = getPrivateData<SDL_RWops>(self); SDL_RWops *ops = getPrivateData<SDL_RWops>(self);
long long pos = SDL_RWtell(ops); // Will return -1 if it doesn't work long long pos = SDL_RWtell(ops); // Will return -1 if it doesn't work
return LL2NUM(pos); return LL2NUM(pos);
} }
#endif
VALUE VALUE
kernelLoadDataInt(const char *filename, bool rubyExc, bool raw) { kernelLoadDataInt(const char *filename, bool rubyExc, bool raw) {

View file

@ -156,6 +156,9 @@ VALUE json2rb(json5pp::value const &v) {
} }
return ret; return ret;
} }
// This should be unreachable
return Qnil;
} }
json5pp::value rb2json(VALUE v) { json5pp::value rb2json(VALUE v) {
@ -200,6 +203,9 @@ json5pp::value rb2json(VALUE v) {
} }
raiseRbExc(Exception(Exception::MKXPError, "Invalid value for JSON: %s", RSTRING_PTR(rb_inspect(v)))); raiseRbExc(Exception(Exception::MKXPError, "Invalid value for JSON: %s", RSTRING_PTR(rb_inspect(v))));
// This should be unreachable
return json5pp::value(0);
} }
RB_METHOD(httpJsonParse) { RB_METHOD(httpJsonParse) {

View file

@ -3376,10 +3376,7 @@
"$(PROJECT_DIR)/Dependencies/Frameworks", "$(PROJECT_DIR)/Dependencies/Frameworks",
); );
MACOSX_DEPLOYMENT_TARGET = 10.12; MACOSX_DEPLOYMENT_TARGET = 10.12;
OTHER_CFLAGS = ( OTHER_CFLAGS = "-fdeclspec";
"-fdeclspec",
"-w",
);
OTHER_CODE_SIGN_FLAGS = "--ignore-resources"; OTHER_CODE_SIGN_FLAGS = "--ignore-resources";
PRODUCT_BUNDLE_IDENTIFIER = "org.zoro.mkxp-z"; PRODUCT_BUNDLE_IDENTIFIER = "org.zoro.mkxp-z";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";

View file

@ -50,6 +50,9 @@ typedef NSMutableArray<NSNumber*> BindingIndexArray;
__weak IBOutlet NSButton *bindingButton3; __weak IBOutlet NSButton *bindingButton3;
__weak IBOutlet NSButton *bindingButton4; __weak IBOutlet NSButton *bindingButton4;
// For keeping track of which buttons to check for
int sysver;
// MKXP Keybindings // MKXP Keybindings
BDescVec *binds; BDescVec *binds;
@ -84,9 +87,10 @@ typedef NSMutableArray<NSNumber*> BindingIndexArray;
return s; return s;
} }
-(void)raise { -(SettingsMenu*)raise {
if (_window) if (_window)
[_window orderFront:self]; [_window orderFront:self];
return self;
} }
-(void)closeWindow { -(void)closeWindow {
@ -96,6 +100,7 @@ typedef NSMutableArray<NSNumber*> BindingIndexArray;
-(SettingsMenu*)setWindow:(NSWindow*)window { -(SettingsMenu*)setWindow:(NSWindow*)window {
_window = window; _window = window;
return self;
} }
- (IBAction)acceptButton:(NSButton *)sender { - (IBAction)acceptButton:(NSButton *)sender {
@ -117,6 +122,11 @@ typedef NSMutableArray<NSNumber*> BindingIndexArray;
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
sysver = 12;
if (@available(macOS 10.14, *)) sysver += 2;
if (@available(macOS 10.15, *)) sysver++;
if (@available(macOS 11.0, *)) sysver++;
isListening = false; isListening = false;
keepCurrentButtonSelection = false; keepCurrentButtonSelection = false;
@ -146,15 +156,15 @@ typedef NSMutableArray<NSNumber*> BindingIndexArray;
#define checkButtonStart if (0) {} #define checkButtonStart if (0) {}
#define checkButtonEnd else { return; } #define checkButtonEnd else { return; }
#define checkButtonElement(e, b, n) \ #define checkButtonElement(e, b, n, min) \
else if (element == gamepad.e && gamepad.b.isPressed) { \ else if (sysver >= min && element == gamepad.e && gamepad.b.isPressed) { \
s.type = JButton; \ s.type = JButton; \
s.d.jb = n; \ s.d.jb = n; \
} }
#define checkButtonAlt(b, n) checkButtonElement(b, b, n) #define checkButtonAlt(b, n, min) checkButtonElement(b, b, n, min)
#define checkButton(b, n) checkButtonAlt(button##b, n) #define checkButton(b, n, min) checkButtonAlt(button##b, n, min)
#define setAxisData(a, n) \ #define setAxisData(a, n) \
GCControllerAxisInput *axis = gamepad.a; \ GCControllerAxisInput *axis = gamepad.a; \
@ -170,23 +180,31 @@ s.d.ja.dir = (axis.value >= 0) ? AxisDir::Positive : AxisDir::Negative;
BindingDesc d; BindingDesc d;
d.target = (Input::ButtonCode)currentButtonCode; d.target = (Input::ButtonCode)currentButtonCode;
SourceDesc s; SourceDesc s;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunguarded-availability-new"
checkButtonStart checkButtonStart
checkButton(A, 0) checkButton(A, 0, 12)
checkButton(B, 1) checkButton(B, 1, 12)
checkButton(X, 2) checkButton(X, 2, 12)
checkButton(Y, 3) checkButton(Y, 3, 12)
checkButtonElement(dpad, dpad.up, 11) checkButtonElement(dpad, dpad.up, 11, 12)
checkButtonElement(dpad, dpad.down, 12) checkButtonElement(dpad, dpad.down, 12, 12)
checkButtonElement(dpad, dpad.left, 13) checkButtonElement(dpad, dpad.left, 13, 12)
checkButtonElement(dpad, dpad.right, 14) checkButtonElement(dpad, dpad.right, 14, 12)
checkButtonAlt(leftShoulder, 9) checkButtonAlt(leftShoulder, 9, 12)
checkButtonAlt(rightShoulder, 10) checkButtonAlt(rightShoulder, 10, 12)
checkButtonAlt(leftThumbstickButton, 7)
checkButtonAlt(rightThumbstickButton, 8) // Requires macOS 10.14.1+
checkButton(Home, 5) checkButtonAlt(leftThumbstickButton, 7, 14)
checkButton(Menu, 6) checkButtonAlt(rightThumbstickButton, 8, 14)
checkButton(Options, 4)
// Requires macOS 10.15+
checkButton(Menu, 6, 15)
checkButton(Options, 4, 15)
// Requires macOS 11.0+
checkButton(Home, 5, 16)
checkAxis(leftThumbstick, xAxis, 0) checkAxis(leftThumbstick, xAxis, 0)
checkAxis(leftThumbstick, yAxis, 1) checkAxis(leftThumbstick, yAxis, 1)
@ -194,14 +212,12 @@ s.d.ja.dir = (axis.value >= 0) ? AxisDir::Positive : AxisDir::Negative;
checkAxis(rightThumbstick, yAxis, 3) checkAxis(rightThumbstick, yAxis, 3)
else if (element == gamepad.leftTrigger && (gamepad.leftTrigger.value >= 0.5 || gamepad.leftTrigger.value <= -0.5)) { else if (element == gamepad.leftTrigger && (gamepad.leftTrigger.value >= 0.5 || gamepad.leftTrigger.value <= -0.5)) {
GCControllerButtonInput *trigger = gamepad.leftTrigger;
s.type = JAxis; s.type = JAxis;
s.d.ja.axis = 4; s.d.ja.axis = 4;
s.d.ja.dir = AxisDir::Positive; s.d.ja.dir = AxisDir::Positive;
} }
else if (element == gamepad.rightTrigger && (gamepad.rightTrigger.value >= 0.5 || gamepad.rightTrigger.value <= -0.5)) { else if (element == gamepad.rightTrigger && (gamepad.rightTrigger.value >= 0.5 || gamepad.rightTrigger.value <= -0.5)) {
GCControllerButtonInput *trigger = gamepad.rightTrigger;
s.type = JAxis; s.type = JAxis;
s.d.ja.axis = 5; s.d.ja.axis = 5;
s.d.ja.dir = AxisDir::Positive; s.d.ja.dir = AxisDir::Positive;
@ -209,6 +225,7 @@ s.d.ja.dir = (axis.value >= 0) ? AxisDir::Positive : AxisDir::Negative;
checkButtonEnd; checkButtonEnd;
#pragma clang diagnostic pop
d.src = s; d.src = s;
binds->push_back(d); binds->push_back(d);
[self setNotListening:true]; [self setNotListening:true];
@ -330,7 +347,7 @@ if (!data.config.kbActionNames.value.empty()) bindingNames[@(Input::code)] = \
return cell; return cell;
} }
int col = tableID.integerValue; long col = tableID.integerValue;
if (nsbinds[@(buttonCode)].count < col) { if (nsbinds[@(buttonCode)].count < col) {
cell.textField.stringValue = @""; cell.textField.stringValue = @"";
@ -351,7 +368,7 @@ if (!data.config.kbActionNames.value.empty()) bindingNames[@(Input::code)] = \
return @(buttonCode); return @(buttonCode);
} }
int col = tableID.integerValue; long col = tableID.integerValue;
if (nsbinds[@(buttonCode)].count < col) { if (nsbinds[@(buttonCode)].count < col) {
return 0; return 0;
@ -414,7 +431,7 @@ if (!data.config.kbActionNames.value.empty()) bindingNames[@(Input::code)] = \
bindingButton4.title = pnames[3]; bindingButton4.title = pnames[3];
[self enableButtons:true]; [self enableButtons:true];
return pnames.count; return (int)pnames.count;
} }
- (void)enableButtons:(bool)defaultSetting { - (void)enableButtons:(bool)defaultSetting {

View file

@ -40,7 +40,7 @@ void fillStringVec(json::value &item, std::vector<std::string> &vector) {
return; return;
} }
auto &array = item.as_array(); auto &array = item.as_array();
for (int i = 0; i < array.size(); i++) { for (size_t i = 0; i < array.size(); i++) {
if (!array[i].is_string()) if (!array[i].is_string())
continue; continue;
@ -64,10 +64,10 @@ bool copyObject(json::value &dest, json::value &src, const char *objectName = ""
if (it.second.is_object() && destVec[it.first].is_object()) if (it.second.is_object() && destVec[it.first].is_object())
continue; continue;
if (it.second.is_array() && destVec[it.first].is_array() || if ((it.second.is_array() && destVec[it.first].is_array()) ||
it.second.is_number() && destVec[it.first].is_number() || (it.second.is_number() && destVec[it.first].is_number()) ||
it.second.is_string() && destVec[it.first].is_string() || (it.second.is_string() && destVec[it.first].is_string()) ||
it.second.is_boolean() && destVec[it.first].is_boolean()) (it.second.is_boolean() && destVec[it.first].is_boolean()) )
{ {
destVec[it.first] = it.second; destVec[it.first] = it.second;
} }

View file

@ -838,7 +838,6 @@ void Graphics::resizeScreen(int width, int height) {
glState.scissorBox.set(IntRect(0, 0, p->scRes.x, p->scRes.y)); glState.scissorBox.set(IntRect(0, 0, p->scRes.x, p->scRes.y));
int cur_sz = p->scSize.x;
shState->eThread().requestWindowResize(width, height); shState->eThread().requestWindowResize(width, height);
usleep(50000); usleep(50000);
update(); update();
@ -922,7 +921,6 @@ void Graphics::setScale(double factor) {
int widthpx = p->scRes.x * factor; int widthpx = p->scRes.x * factor;
int heightpx = p->scRes.y * factor; int heightpx = p->scRes.y * factor;
int cur_sz = p->scSize.x;
shState->eThread().requestWindowResize(widthpx, heightpx); shState->eThread().requestWindowResize(widthpx, heightpx);
usleep(50000); usleep(50000);
update(); update();

View file

@ -61,7 +61,7 @@ static const int autotileCount = 7;
static const int atFrames = 8; static const int atFrames = 8;
static const int atFrameDur = 15; static const int atFrameDur = 15;
static const int atAreaW = autotileW * atFrames; static const int atAreaW = autotileW * atFrames;
static const int atAreaH = autotileH * autotileCount; //static const int atAreaH = autotileH * autotileCount;
static const int tsLaneW = tilesetW / 1; static const int tsLaneW = tilesetW / 1;
@ -737,7 +737,7 @@ struct TilemapPrivate
else else
{ {
int layerInd = y + prio; int layerInd = y + prio;
if (layerInd >= zlayersMax) if ((size_t)layerInd >= zlayersMax)
return; return;
targetArray = &zlayerVert[layerInd]; targetArray = &zlayerVert[layerInd];
} }

View file

@ -76,7 +76,7 @@ std::string filesystemImpl::normalizePath(const char *path, bool preferred, bool
stdPath = stdPath.lexically_normal(); stdPath = stdPath.lexically_normal();
std::string ret(stdPath); std::string ret(stdPath);
for (int i = 0; i < ret.length(); i++) { for (size_t i = 0; i < ret.length(); i++) {
char sep; char sep;
char sep_alt; char sep_alt;
#ifdef __WINDOWS__ #ifdef __WINDOWS__

View file

@ -22,7 +22,6 @@
#define NSTOPATH(str) [NSFileManager.defaultManager fileSystemRepresentationWithPath:str] #define NSTOPATH(str) [NSFileManager.defaultManager fileSystemRepresentationWithPath:str]
bool filesystemImpl::fileExists(const char *path) { bool filesystemImpl::fileExists(const char *path) {
NSString *nspath = PATHTONS(path);
BOOL isDir; BOOL isDir;
return [NSFileManager.defaultManager fileExistsAtPath:PATHTONS(path) isDirectory: &isDir] && !isDir; return [NSFileManager.defaultManager fileExistsAtPath:PATHTONS(path) isDirectory: &isDir] && !isDir;
} }

View file

@ -1161,12 +1161,6 @@ std::vector<std::string> Input::getBindings(ButtonCode code) {
return ret; return ret;
} }
std::string &Input::getActionName(int button) {
for (const auto &b : p->kbBindings) {
}
}
bool Input::isPressed(int button) bool Input::isPressed(int button)
{ {
return p->getStateCheck(button).pressed; return p->getStateCheck(button).pressed;

View file

@ -57,9 +57,6 @@ public:
std::vector<std::string> getBindings(ButtonCode code); std::vector<std::string> getBindings(ButtonCode code);
std::string &getActionName(int button);
void setActionName(int button, const char *name);
bool isPressed(int button); bool isPressed(int button);
bool isTriggered(int button); bool isTriggered(int button);
bool isRepeated(int button); bool isRepeated(int button);