mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-04-21 21:52:04 +02:00
the not-so-great warning purge
This commit is contained in:
parent
06175fef4b
commit
2fd585393d
12 changed files with 64 additions and 52 deletions
|
@ -31,8 +31,9 @@
|
|||
inline void
|
||||
disposableAddChild(VALUE disp, VALUE child)
|
||||
{
|
||||
if (NIL_P(disp) || NIL_P(child))
|
||||
if (NIL_P(disp) || NIL_P(child)) {
|
||||
return;
|
||||
}
|
||||
|
||||
VALUE children = rb_iv_get(disp, "children");
|
||||
|
||||
|
@ -54,8 +55,9 @@ disposableAddChild(VALUE disp, VALUE child)
|
|||
inline void
|
||||
disposableRemoveChild(VALUE disp, VALUE child)
|
||||
{
|
||||
if (NIL_P(disp) || NIL_P(child))
|
||||
if (NIL_P(disp) || NIL_P(child)) {
|
||||
return;
|
||||
}
|
||||
|
||||
VALUE children = rb_iv_get(disp, "children");
|
||||
if (NIL_P(children))
|
||||
|
|
|
@ -126,12 +126,14 @@ RB_METHOD(fileIntBinmode) {
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
#if RAPI_FULL <= 187
|
||||
RB_METHOD(fileIntPos) {
|
||||
SDL_RWops *ops = getPrivateData<SDL_RWops>(self);
|
||||
|
||||
long long pos = SDL_RWtell(ops); // Will return -1 if it doesn't work
|
||||
return LL2NUM(pos);
|
||||
}
|
||||
#endif
|
||||
|
||||
VALUE
|
||||
kernelLoadDataInt(const char *filename, bool rubyExc, bool raw) {
|
||||
|
|
|
@ -156,6 +156,9 @@ VALUE json2rb(json5pp::value const &v) {
|
|||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
// This should be unreachable
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
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))));
|
||||
|
||||
// This should be unreachable
|
||||
return json5pp::value(0);
|
||||
}
|
||||
|
||||
RB_METHOD(httpJsonParse) {
|
||||
|
|
|
@ -3376,10 +3376,7 @@
|
|||
"$(PROJECT_DIR)/Dependencies/Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.12;
|
||||
OTHER_CFLAGS = (
|
||||
"-fdeclspec",
|
||||
"-w",
|
||||
);
|
||||
OTHER_CFLAGS = "-fdeclspec";
|
||||
OTHER_CODE_SIGN_FLAGS = "--ignore-resources";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.zoro.mkxp-z";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
|
|
|
@ -50,6 +50,9 @@ typedef NSMutableArray<NSNumber*> BindingIndexArray;
|
|||
__weak IBOutlet NSButton *bindingButton3;
|
||||
__weak IBOutlet NSButton *bindingButton4;
|
||||
|
||||
// For keeping track of which buttons to check for
|
||||
int sysver;
|
||||
|
||||
|
||||
// MKXP Keybindings
|
||||
BDescVec *binds;
|
||||
|
@ -84,9 +87,10 @@ typedef NSMutableArray<NSNumber*> BindingIndexArray;
|
|||
return s;
|
||||
}
|
||||
|
||||
-(void)raise {
|
||||
-(SettingsMenu*)raise {
|
||||
if (_window)
|
||||
[_window orderFront:self];
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)closeWindow {
|
||||
|
@ -96,6 +100,7 @@ typedef NSMutableArray<NSNumber*> BindingIndexArray;
|
|||
|
||||
-(SettingsMenu*)setWindow:(NSWindow*)window {
|
||||
_window = window;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (IBAction)acceptButton:(NSButton *)sender {
|
||||
|
@ -117,6 +122,11 @@ typedef NSMutableArray<NSNumber*> BindingIndexArray;
|
|||
- (void)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;
|
||||
keepCurrentButtonSelection = false;
|
||||
|
||||
|
@ -146,15 +156,15 @@ typedef NSMutableArray<NSNumber*> BindingIndexArray;
|
|||
|
||||
#define checkButtonStart if (0) {}
|
||||
#define checkButtonEnd else { return; }
|
||||
#define checkButtonElement(e, b, n) \
|
||||
else if (element == gamepad.e && gamepad.b.isPressed) { \
|
||||
#define checkButtonElement(e, b, n, min) \
|
||||
else if (sysver >= min && element == gamepad.e && gamepad.b.isPressed) { \
|
||||
s.type = JButton; \
|
||||
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) \
|
||||
GCControllerAxisInput *axis = gamepad.a; \
|
||||
|
@ -170,23 +180,31 @@ s.d.ja.dir = (axis.value >= 0) ? AxisDir::Positive : AxisDir::Negative;
|
|||
BindingDesc d;
|
||||
d.target = (Input::ButtonCode)currentButtonCode;
|
||||
SourceDesc s;
|
||||
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunguarded-availability-new"
|
||||
checkButtonStart
|
||||
checkButton(A, 0)
|
||||
checkButton(B, 1)
|
||||
checkButton(X, 2)
|
||||
checkButton(Y, 3)
|
||||
checkButtonElement(dpad, dpad.up, 11)
|
||||
checkButtonElement(dpad, dpad.down, 12)
|
||||
checkButtonElement(dpad, dpad.left, 13)
|
||||
checkButtonElement(dpad, dpad.right, 14)
|
||||
checkButtonAlt(leftShoulder, 9)
|
||||
checkButtonAlt(rightShoulder, 10)
|
||||
checkButtonAlt(leftThumbstickButton, 7)
|
||||
checkButtonAlt(rightThumbstickButton, 8)
|
||||
checkButton(Home, 5)
|
||||
checkButton(Menu, 6)
|
||||
checkButton(Options, 4)
|
||||
checkButton(A, 0, 12)
|
||||
checkButton(B, 1, 12)
|
||||
checkButton(X, 2, 12)
|
||||
checkButton(Y, 3, 12)
|
||||
checkButtonElement(dpad, dpad.up, 11, 12)
|
||||
checkButtonElement(dpad, dpad.down, 12, 12)
|
||||
checkButtonElement(dpad, dpad.left, 13, 12)
|
||||
checkButtonElement(dpad, dpad.right, 14, 12)
|
||||
checkButtonAlt(leftShoulder, 9, 12)
|
||||
checkButtonAlt(rightShoulder, 10, 12)
|
||||
|
||||
// Requires macOS 10.14.1+
|
||||
checkButtonAlt(leftThumbstickButton, 7, 14)
|
||||
checkButtonAlt(rightThumbstickButton, 8, 14)
|
||||
|
||||
// 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, yAxis, 1)
|
||||
|
@ -194,14 +212,12 @@ s.d.ja.dir = (axis.value >= 0) ? AxisDir::Positive : AxisDir::Negative;
|
|||
checkAxis(rightThumbstick, yAxis, 3)
|
||||
|
||||
else if (element == gamepad.leftTrigger && (gamepad.leftTrigger.value >= 0.5 || gamepad.leftTrigger.value <= -0.5)) {
|
||||
GCControllerButtonInput *trigger = gamepad.leftTrigger;
|
||||
s.type = JAxis;
|
||||
s.d.ja.axis = 4;
|
||||
s.d.ja.dir = AxisDir::Positive;
|
||||
}
|
||||
|
||||
else if (element == gamepad.rightTrigger && (gamepad.rightTrigger.value >= 0.5 || gamepad.rightTrigger.value <= -0.5)) {
|
||||
GCControllerButtonInput *trigger = gamepad.rightTrigger;
|
||||
s.type = JAxis;
|
||||
s.d.ja.axis = 5;
|
||||
s.d.ja.dir = AxisDir::Positive;
|
||||
|
@ -209,6 +225,7 @@ s.d.ja.dir = (axis.value >= 0) ? AxisDir::Positive : AxisDir::Negative;
|
|||
|
||||
checkButtonEnd;
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
d.src = s;
|
||||
binds->push_back(d);
|
||||
[self setNotListening:true];
|
||||
|
@ -330,7 +347,7 @@ if (!data.config.kbActionNames.value.empty()) bindingNames[@(Input::code)] = \
|
|||
return cell;
|
||||
}
|
||||
|
||||
int col = tableID.integerValue;
|
||||
long col = tableID.integerValue;
|
||||
|
||||
if (nsbinds[@(buttonCode)].count < col) {
|
||||
cell.textField.stringValue = @"";
|
||||
|
@ -351,7 +368,7 @@ if (!data.config.kbActionNames.value.empty()) bindingNames[@(Input::code)] = \
|
|||
return @(buttonCode);
|
||||
}
|
||||
|
||||
int col = tableID.integerValue;
|
||||
long col = tableID.integerValue;
|
||||
|
||||
if (nsbinds[@(buttonCode)].count < col) {
|
||||
return 0;
|
||||
|
@ -414,7 +431,7 @@ if (!data.config.kbActionNames.value.empty()) bindingNames[@(Input::code)] = \
|
|||
bindingButton4.title = pnames[3];
|
||||
[self enableButtons:true];
|
||||
|
||||
return pnames.count;
|
||||
return (int)pnames.count;
|
||||
}
|
||||
|
||||
- (void)enableButtons:(bool)defaultSetting {
|
||||
|
|
|
@ -40,7 +40,7 @@ void fillStringVec(json::value &item, std::vector<std::string> &vector) {
|
|||
return;
|
||||
}
|
||||
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())
|
||||
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())
|
||||
continue;
|
||||
|
||||
if (it.second.is_array() && destVec[it.first].is_array() ||
|
||||
it.second.is_number() && destVec[it.first].is_number() ||
|
||||
it.second.is_string() && destVec[it.first].is_string() ||
|
||||
it.second.is_boolean() && destVec[it.first].is_boolean())
|
||||
if ((it.second.is_array() && destVec[it.first].is_array()) ||
|
||||
(it.second.is_number() && destVec[it.first].is_number()) ||
|
||||
(it.second.is_string() && destVec[it.first].is_string()) ||
|
||||
(it.second.is_boolean() && destVec[it.first].is_boolean()) )
|
||||
{
|
||||
destVec[it.first] = it.second;
|
||||
}
|
||||
|
|
|
@ -838,7 +838,6 @@ void Graphics::resizeScreen(int width, int height) {
|
|||
|
||||
glState.scissorBox.set(IntRect(0, 0, p->scRes.x, p->scRes.y));
|
||||
|
||||
int cur_sz = p->scSize.x;
|
||||
shState->eThread().requestWindowResize(width, height);
|
||||
usleep(50000);
|
||||
update();
|
||||
|
@ -922,7 +921,6 @@ void Graphics::setScale(double factor) {
|
|||
int widthpx = p->scRes.x * factor;
|
||||
int heightpx = p->scRes.y * factor;
|
||||
|
||||
int cur_sz = p->scSize.x;
|
||||
shState->eThread().requestWindowResize(widthpx, heightpx);
|
||||
usleep(50000);
|
||||
update();
|
||||
|
|
|
@ -61,7 +61,7 @@ static const int autotileCount = 7;
|
|||
static const int atFrames = 8;
|
||||
static const int atFrameDur = 15;
|
||||
static const int atAreaW = autotileW * atFrames;
|
||||
static const int atAreaH = autotileH * autotileCount;
|
||||
//static const int atAreaH = autotileH * autotileCount;
|
||||
|
||||
static const int tsLaneW = tilesetW / 1;
|
||||
|
||||
|
@ -737,7 +737,7 @@ struct TilemapPrivate
|
|||
else
|
||||
{
|
||||
int layerInd = y + prio;
|
||||
if (layerInd >= zlayersMax)
|
||||
if ((size_t)layerInd >= zlayersMax)
|
||||
return;
|
||||
targetArray = &zlayerVert[layerInd];
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ std::string filesystemImpl::normalizePath(const char *path, bool preferred, bool
|
|||
|
||||
stdPath = stdPath.lexically_normal();
|
||||
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_alt;
|
||||
#ifdef __WINDOWS__
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#define NSTOPATH(str) [NSFileManager.defaultManager fileSystemRepresentationWithPath:str]
|
||||
|
||||
bool filesystemImpl::fileExists(const char *path) {
|
||||
NSString *nspath = PATHTONS(path);
|
||||
BOOL isDir;
|
||||
return [NSFileManager.defaultManager fileExistsAtPath:PATHTONS(path) isDirectory: &isDir] && !isDir;
|
||||
}
|
||||
|
|
|
@ -1161,12 +1161,6 @@ std::vector<std::string> Input::getBindings(ButtonCode code) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
std::string &Input::getActionName(int button) {
|
||||
for (const auto &b : p->kbBindings) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
bool Input::isPressed(int button)
|
||||
{
|
||||
return p->getStateCheck(button).pressed;
|
||||
|
|
|
@ -57,9 +57,6 @@ public:
|
|||
|
||||
std::vector<std::string> getBindings(ButtonCode code);
|
||||
|
||||
std::string &getActionName(int button);
|
||||
void setActionName(int button, const char *name);
|
||||
|
||||
bool isPressed(int button);
|
||||
bool isTriggered(int button);
|
||||
bool isRepeated(int button);
|
||||
|
|
Loading…
Add table
Reference in a new issue