This commit is contained in:
DepressedTWM 2026-08-01 00:13:09 +04:00
commit 6f8ec2f027
23 changed files with 41 additions and 23 deletions

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is SDL_free software: you can redistribute it and/or modify
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 2 of the License, or
** (at your option) any later version.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is SDL_free software: you can redistribute it and/or modify
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 2 of the License, or
** (at your option) any later version.
@ -21,6 +21,8 @@
#include "binding.h"
#include "binding-util.h"
#include "ruby/internal/eval.h"
#include "ruby/internal/memory.h"
#include "sharedstate.h"
#include "eventthread.h"
#include "filesystem.h"
@ -34,6 +36,7 @@
#include "sunshine.h"
#include "modloader.h"
#include <ruby-3.4.0/ruby/internal/gc.h>
#include <ruby.h>
#include <ruby/debug.h>
#include <ruby/encoding.h>
@ -97,6 +100,7 @@ static void tp_cb(VALUE tpval, void *data) {
}
extern const char binding_mri_module_rpg1_rb[];
extern const int binding_mri_module_rpg1_rb_len;
static void mriBindingExecute();
static void mriBindingTerminate();
@ -193,7 +197,13 @@ static void mriBindingInit(){
rb_define_alias(rb_singleton_class(rb_mKernel), "_mkxp_kernel_caller_alias", "caller");
_rb_define_module_function(rb_mKernel, "caller", _kernelCaller);
rb_eval_string(binding_mri_module_rpg1_rb);
char *script = (char*)SDL_malloc(binding_mri_module_rpg1_rb_len + 1);
SDL_memcpy(script, binding_mri_module_rpg1_rb, binding_mri_module_rpg1_rb_len);
script[binding_mri_module_rpg1_rb_len] = '\0';
rb_eval_string(script);
SDL_free(script);
VALUE mod = rb_define_module("MKXP");
_rb_define_module_function(mod, "data_directory", mkxpDataDirectory);
@ -466,6 +476,8 @@ static void runRMXPScripts(BacktraceData &btData){
VALUE scriptDecoded = rb_ary_entry(script, 3);
VALUE string = newStringUTF8(RSTRING_PTR(scriptDecoded), RSTRING_LEN(scriptDecoded));
rb_gc_register_address(&string);
VALUE fname;
const char *scriptName = RSTRING_PTR(rb_ary_entry(script, 1));
char buf[512];
@ -474,9 +486,15 @@ static void runRMXPScripts(BacktraceData &btData){
len = SDL_snprintf(buf, sizeof(buf), "%03ld:%s", i, scriptName);
fname = newStringUTF8(buf, len);
rb_gc_register_address(&fname);
btData.scriptNames.insert(buf, scriptName);
int state;
evalString(string, fname, &state);
rb_gc_unregister_address(&fname);
rb_gc_unregister_address(&string);
if (state)
break;
}

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is SDL_free software: you can redistribute it and/or modify
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 2 of the License, or
** (at your option) any later version.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is SDL_free software: you can redistribute it and/or modify
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 2 of the License, or
** (at your option) any later version.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is SDL_free software: you can redistribute it and/or modify
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 2 of the License, or
** (at your option) any later version.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is SDL_free software: you can redistribute it and/or modify
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 2 of the License, or
** (at your option) any later version.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is SDL_free software: you can redistribute it and/or modify
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 2 of the License, or
** (at your option) any later version.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is SDL_free software: you can redistribute it and/or modify
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 2 of the License, or
** (at your option) any later version.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is SDL_free software: you can redistribute it and/or modify
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 2 of the License, or
** (at your option) any later version.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is SDL_free software: you can redistribute it and/or modify
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 2 of the License, or
** (at your option) any later version.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is SDL_free software: you can redistribute it and/or modify
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 2 of the License, or
** (at your option) any later version.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is SDL_free software: you can redistribute it and/or modify
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 2 of the License, or
** (at your option) any later version.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is SDL_free software: you can redistribute it and/or modify
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 2 of the License, or
** (at your option) any later version.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is SDL_free software: you can redistribute it and/or modify
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 2 of the License, or
** (at your option) any later version.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is SDL_free software: you can redistribute it and/or modify
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 2 of the License, or
** (at your option) any later version.

View file

@ -24,3 +24,4 @@ added icons and way to disable options in settings
fixed segfault while to fast window size changing
updated cg_blue picture
Deleted useless hooks
fix crash on game exit

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2014 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is SDL_free software: you can redistribute it and/or modify
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 2 of the License, or
** (at your option) any later version.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is SDL_free software: you can redistribute it and/or modify
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 2 of the License, or
** (at your option) any later version.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2014 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is SDL_free software: you can redistribute it and/or modify
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 2 of the License, or
** (at your option) any later version.

View file

@ -5,7 +5,7 @@
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp is SDL_free software: you can redistribute it and/or modify
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 2 of the License, or
** (at your option) any later version.

View file

@ -272,7 +272,6 @@ int main(int argc, char *argv[]){
if (dataDir) {
int result = chdir(dataDir);
(void)result;
SDL_free((void*)dataDir); // SDL_GetBasePath returns a heap pointer; SDL_free expects void*
}
#endif

View file

@ -133,7 +133,7 @@ void crash(Exception::Type t, const char *fmt, ...){
o << "Emscripten start address of the stack: " << emscripten_stack_get_base() << std::endl;
o << "Emscripten end address of the stack: " << emscripten_stack_get_end() << std::endl;
o << "Emscripten current stack pointer: " << emscripten_stack_get_current() << std::endl;
o << "Emscripten number of SDL_free bytes left on stack: " << emscripten_stack_get_free() << std::endl;
o << "Emscripten number of free bytes left on stack: " << emscripten_stack_get_free() << std::endl;
#elif __PSP__
o << "PSPdev MIPS Stack Trace: " << int pspDebugGetStackTrace() << std::endl;
#endif

View file

@ -119,7 +119,7 @@ void SoundEmitter::play(const std::string &filename, int volume, int pitch) {
if (!buffer)
return;
/* Try to find first SDL_free source */
/* Try to find first free source */
size_t i;
for (i = 0; i < srcCount; ++i)
if (AL::Source::getState(alSrcs[srcPrio[i]]) != AL_PLAYING)