mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-20 05:49:55 +00:00
meow
This commit is contained in:
parent
4260f23b65
commit
2e9a7f5eb9
8 changed files with 23 additions and 245 deletions
24
MODLOADER.md
24
MODLOADER.md
|
|
@ -1,24 +0,0 @@
|
|||
# wtf is hook?
|
||||
Hook - Ruby script executed in other script, with context(binding) of parent script.
|
||||
|
||||
# Hooks dirs
|
||||
For more information you can read scripts/
|
||||
* hooks/*/init/ - executed in script after initialization (you can change some variables and other)
|
||||
'*' - class like Scene_Title
|
||||
* hooks/Window_NameInput/init2 - Window_NameInput init function
|
||||
* hooks/Scene_Map/main - main function of Map scene
|
||||
* hooks/Main/at_exit - on game exit
|
||||
* hooks/Main/start - at game start
|
||||
|
||||
# How add custom hooks?
|
||||
use RPG::Mod.exec_hooks(path, binding)
|
||||
path - path in game directory like "hooks/Scene_Title/init", you can't load something from other place, only from game direcory.
|
||||
binding - its a Ruby binding.
|
||||
|
||||
# API
|
||||
Custom API for mods:
|
||||
|
||||
work in progress
|
||||
|
||||
# how create mod?
|
||||
First what you need it
|
||||
|
|
@ -193,9 +193,6 @@ static void mriBindingInit(){
|
|||
_rb_define_module_function(mod, "puts", mkxpPuts);
|
||||
_rb_define_module_function(mod, "raw_key_states", mkxpRawKeyStates);
|
||||
_rb_define_module_function(mod, "mouse_in_window", mkxpMouseInWindow);
|
||||
|
||||
/* Load global constants */
|
||||
rb_gv_set("MKXP", Qtrue);
|
||||
}
|
||||
|
||||
static void printP(int argc, VALUE *argv, const char *convMethod, const char *sep){
|
||||
|
|
@ -215,17 +212,13 @@ static void printP(int argc, VALUE *argv, const char *convMethod, const char *se
|
|||
|
||||
RB_METHOD(mriPrint){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
printP(argc, argv, "to_s", "");
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
RB_METHOD(mriP){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
printP(argc, argv, "inspect", "\n");
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
|
|
@ -241,7 +234,6 @@ RB_METHOD(mkxpPuts){
|
|||
RB_UNUSED_PARAM;
|
||||
const char *str;
|
||||
rb_get_args(argc, argv, "z", &str RB_ARG_END);
|
||||
|
||||
Debug() << str;
|
||||
|
||||
return Qnil;
|
||||
|
|
@ -551,6 +543,7 @@ static void mriBindingExecute(){
|
|||
* stdio streams on some platforms (eg. Windows) */
|
||||
int argc = 0;
|
||||
char **argv = 0;
|
||||
//options_argv3[] = "--jit"
|
||||
char options_argv1[] = "oneshot", options_argv2[] = "-ev";
|
||||
char* options_argv[] = {options_argv1, options_argv2, NULL};
|
||||
ruby_sysinit(&argc, &argv);
|
||||
|
|
|
|||
|
|
@ -30,11 +30,7 @@
|
|||
#include "exception.h"
|
||||
|
||||
#include <ruby.h>
|
||||
#ifndef MKXPZ_LEGACY_RUBY
|
||||
#include <ruby/version.h>
|
||||
#else
|
||||
#include <version.h>
|
||||
#endif
|
||||
|
||||
#ifdef RUBY_API_VERSION_MAJOR
|
||||
#define RAPI_MAJOR RUBY_API_VERSION_MAJOR
|
||||
|
|
@ -80,17 +76,9 @@ struct Exception;
|
|||
|
||||
void raiseRbExc(const Exception &exc);
|
||||
|
||||
#if RAPI_FULL > 187
|
||||
#define DECL_TYPE(Klass) extern rb_data_type_t Klass##Type
|
||||
|
||||
#if RAPI_FULL >= 210
|
||||
/* TODO: can mkxp use RUBY_TYPED_FREE_IMMEDIATELY here? */
|
||||
#define DEF_TYPE_FLAGS 0
|
||||
#else
|
||||
#define DEF_TYPE_FLAGS
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/*
|
||||
#define DEF_TYPE_CUSTOMNAME_AND_FREE(Klass, Name, Free) \
|
||||
rb_data_type_t Klass##Type = { Name, { 0, Free, 0, { 0, 0 } }, 0, 0, (void*)DEF_TYPE_FLAGS }
|
||||
|
|
@ -108,88 +96,10 @@ void raiseRbExc(const Exception &exc);
|
|||
|
||||
#define DEF_TYPE(Klass) DEF_TYPE_CUSTOMNAME(Klass, #Klass)
|
||||
|
||||
// Ruby 1.8 helper stuff
|
||||
#if RAPI_MAJOR < 2
|
||||
|
||||
#if RAPI_MINOR < 9
|
||||
#define RUBY_T_FIXNUM T_FIXNUM
|
||||
#define RUBY_T_TRUE T_TRUE
|
||||
#define RUBY_T_FALSE T_FALSE
|
||||
#define RUBY_T_NIL T_NIL
|
||||
#define RUBY_T_UNDEF T_UNDEF
|
||||
#define RUBY_T_SYMBOL T_SYMBOL
|
||||
#define RUBY_T_FLOAT T_FLOAT
|
||||
#define RUBY_T_STRING T_STRING
|
||||
#define RUBY_T_ARRAY T_ARRAY
|
||||
#else
|
||||
#define T_FIXNUM RUBY_T_FIXNUM
|
||||
#define T_TRUE RUBY_T_TRUE
|
||||
#define T_FALSE RUBY_T_FALSE
|
||||
#define T_NIL RUBY_T_NIL
|
||||
#define T_UNDEF RUBY_T_UNDEF
|
||||
#define T_SYMBOL RUBY_T_SYMBOL
|
||||
#define T_FLOAT RUBY_T_FLOAT
|
||||
#define T_STRING RUBY_T_STRING
|
||||
#define T_ARRAY RUBY_T_ARRAY
|
||||
#endif
|
||||
|
||||
#if RAPI_MINOR < 9
|
||||
#define RUBY_Qtrue Qtrue
|
||||
#define RUBY_Qfalse Qfalse
|
||||
#define RUBY_Qnil Qnil
|
||||
#define RUBY_Qundef Qundef
|
||||
#endif
|
||||
|
||||
#if RAPI_MINOR < 9
|
||||
#define RB_FIXNUM_P(obj) FIXNUM_P(obj)
|
||||
#define RB_SYMBOL_P(obj) SYMBOL_P(obj)
|
||||
|
||||
#define RB_TYPE_P(obj, type) \
|
||||
(((type) == RUBY_T_FIXNUM) \
|
||||
? RB_FIXNUM_P(obj) \
|
||||
: ((type) == RUBY_T_TRUE) \
|
||||
? ((obj) == RUBY_Qtrue) \
|
||||
: ((type) == RUBY_T_FALSE) \
|
||||
? ((obj) == RUBY_Qfalse) \
|
||||
: ((type) == RUBY_T_NIL) \
|
||||
? ((obj) == RUBY_Qnil) \
|
||||
: ((type) == RUBY_T_UNDEF) \
|
||||
? ((obj) == RUBY_Qundef) \
|
||||
: ((type) == RUBY_T_SYMBOL) \
|
||||
? RB_SYMBOL_P(obj) \
|
||||
: (!SPECIAL_CONST_P(obj) && \
|
||||
BUILTIN_TYPE(obj) == (type)))
|
||||
#endif
|
||||
|
||||
#define OBJ_INIT_COPY(a, b) rb_obj_init_copy(a, b)
|
||||
|
||||
#define DEF_ALLOCFUNC_CUSTOMFREE(type, free) \
|
||||
static VALUE type##Allocate(VALUE klass) { \
|
||||
return Data_Wrap_Struct(klass, 0, free, 0); \
|
||||
}
|
||||
|
||||
#define DEF_ALLOCFUNC(type) DEF_ALLOCFUNC_CUSTOMFREE(type, freeInstance<type>)
|
||||
|
||||
#if RAPI_MINOR < 9
|
||||
#define rb_utf8_str_new_cstr rb_str_new2
|
||||
#define rb_utf8_str_new rb_str_new
|
||||
#endif
|
||||
|
||||
#define PRIsVALUE "s"
|
||||
|
||||
#endif
|
||||
// end
|
||||
|
||||
#if RAPI_FULL > 187
|
||||
template <rb_data_type_t *rbType> static VALUE classAllocate(VALUE klass) {
|
||||
/* 2.3 has changed the name of this function */
|
||||
#if RAPI_FULL >= 230
|
||||
return rb_data_typed_object_wrap(klass, 0, rbType);
|
||||
#else
|
||||
return rb_data_typed_object_alloc(klass, 0, rbType);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
template <class C> static void freeInstance(void *inst) {
|
||||
delete static_cast<C *>(inst);
|
||||
|
|
@ -197,11 +107,7 @@ template <class C> static void freeInstance(void *inst) {
|
|||
|
||||
void raiseDisposedAccess(VALUE self);
|
||||
template <class C> inline C *getPrivateData(VALUE self) {
|
||||
#if RAPI_FULL > 187
|
||||
C *c = static_cast<C *>(RTYPEDDATA_DATA(self));
|
||||
#else
|
||||
C *c = static_cast<C *>(DATA_PTR(self));
|
||||
#endif
|
||||
if (!c) {
|
||||
raiseRbExc(Exception(Exception::MKXPError, "No instance data for variable (missing call to super?)"));
|
||||
}
|
||||
|
|
@ -209,68 +115,28 @@ template <class C> inline C *getPrivateData(VALUE self) {
|
|||
}
|
||||
|
||||
template <class C>
|
||||
static inline C *
|
||||
#if RAPI_FULL > 187
|
||||
getPrivateDataCheck(VALUE self, const rb_data_type_t &type)
|
||||
#else
|
||||
getPrivateDataCheck(VALUE self, const char *type)
|
||||
#endif
|
||||
{
|
||||
#if RAPI_FULL <= 187
|
||||
rb_check_type(self, T_DATA);
|
||||
VALUE otherObj = rb_const_get(rb_cObject, rb_intern(type));
|
||||
const char *ownname, *othername;
|
||||
if (!rb_obj_is_kind_of(self, otherObj)) {
|
||||
ownname = rb_obj_classname(self);
|
||||
othername = rb_obj_classname(otherObj);
|
||||
rb_raise(rb_eTypeError, "Can't convert %s into %s", othername, ownname);
|
||||
}
|
||||
void *obj = DATA_PTR(self);
|
||||
#else
|
||||
const char *ownname = rb_obj_classname(self);
|
||||
if (!rb_typeddata_is_kind_of(self, &type))
|
||||
rb_raise(rb_eTypeError, "Can't convert %s into %s", ownname,
|
||||
type.wrap_struct_name);
|
||||
static inline C *getPrivateDataCheck(VALUE self, const rb_data_type_t &type){
|
||||
const char *ownname = rb_obj_classname(self);
|
||||
if (!rb_typeddata_is_kind_of(self, &type))
|
||||
rb_raise(rb_eTypeError, "Can't convert %s into %s", ownname, type.wrap_struct_name);
|
||||
|
||||
void *obj = RTYPEDDATA_DATA(self);
|
||||
#endif
|
||||
return static_cast<C *>(obj);
|
||||
void *obj = RTYPEDDATA_DATA(self);
|
||||
return static_cast<C *>(obj);
|
||||
}
|
||||
|
||||
static inline void setPrivateData(VALUE self, void *p) {
|
||||
#if RAPI_FULL > 187
|
||||
RTYPEDDATA_DATA(self) = p;
|
||||
#else
|
||||
DATA_PTR(self) = p;
|
||||
#endif
|
||||
}
|
||||
|
||||
inline VALUE
|
||||
#if RAPI_FULL > 187
|
||||
wrapObject(void *p, const rb_data_type_t &type, VALUE underKlass = rb_cObject)
|
||||
#else
|
||||
wrapObject(void *p, const char *type, VALUE underKlass = rb_cObject)
|
||||
#endif
|
||||
{
|
||||
#if RAPI_FULL > 187
|
||||
VALUE klass = rb_const_get(underKlass, rb_intern(type.wrap_struct_name));
|
||||
#else
|
||||
VALUE klass = rb_const_get(underKlass, rb_intern(type));
|
||||
#endif
|
||||
VALUE obj = rb_obj_alloc(klass);
|
||||
|
||||
setPrivateData(obj, p);
|
||||
inline VALUE wrapObject(void *p, const rb_data_type_t &type, VALUE underKlass = rb_cObject) {
|
||||
VALUE klass = rb_const_get(underKlass, rb_intern(type.wrap_struct_name));
|
||||
VALUE obj = rb_obj_alloc(klass);
|
||||
setPrivateData(obj, p);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
inline VALUE wrapProperty(VALUE self, void *prop, const char *iv,
|
||||
#if RAPI_FULL > 187
|
||||
const rb_data_type_t &type,
|
||||
#else
|
||||
const char *type,
|
||||
#endif
|
||||
VALUE underKlass = rb_cObject) {
|
||||
inline VALUE wrapProperty(VALUE self, void *prop, const char *iv, const rb_data_type_t &type, VALUE underKlass = rb_cObject) {
|
||||
VALUE propObj = wrapObject(prop, type, underKlass);
|
||||
rb_iv_set(self, iv, propObj);
|
||||
return propObj;
|
||||
|
|
@ -390,24 +256,6 @@ inline void rb_check_argc(int actual, int expected){
|
|||
actual, expected);
|
||||
}
|
||||
|
||||
#if RAPI_MAJOR < 2
|
||||
static inline void rb_error_arity(int argc, int min, int max) {
|
||||
if (argc > max || argc < min)
|
||||
rb_raise(rb_eArgError, "Finish me! rb_error_arity()"); // TODO
|
||||
}
|
||||
#if RAPI_MINOR < 9
|
||||
static inline VALUE rb_sprintf(const char *fmt, ...) {
|
||||
return rb_str_new2("Finish me! rb_sprintf()"); // TODO
|
||||
}
|
||||
static inline VALUE rb_str_catf(VALUE obj, const char *fmt, ...) {
|
||||
return rb_str_new2("Finish me! rb_str_catf()"); // TODO
|
||||
}
|
||||
static inline VALUE rb_file_open_str(VALUE filename, const char *mode) {
|
||||
return rb_funcall(rb_cFile, rb_intern("open"), 2, filename, rb_str_new2(mode));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define RB_NA_METHOD(name) \
|
||||
static VALUE name(VALUE self)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,32 +0,0 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Credit to popkirby on GitHub for creating the majority of this file
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
# Colors
|
||||
white="\033[0;37m" # White - Regular
|
||||
bold="\033[1;37m" # White - Bold
|
||||
cyan="\033[1;36m" # Cyan - Bold
|
||||
green="\033[1;32m" # Green - Bold
|
||||
color_reset="\033[0m" # Reset Colors
|
||||
|
||||
ONESHOT_PATH=$HOME/Library/Application\ Support/Steam/steamapps/common/OneShot
|
||||
|
||||
echo "-> ${cyan}Removing old OneShot apps...${color_reset}"
|
||||
rm -rf "$ONESHOT_PATH/OneShot.app"
|
||||
rm -rf "$ONESHOT_PATH/_______.app"
|
||||
rm -f "$ONESHOT_PATH/Data/xScripts.rxdata"
|
||||
rm -rf "$ONESHOT_PATH/*.exe"
|
||||
rm -rf "$ONESHOT_PATH/*.dll"
|
||||
|
||||
echo "-> ${cyan}Install OneShot apps to Steam directory...${color_reset}"
|
||||
cp -rf "." "$ONESHOT_PATH"
|
||||
rm -f "$ONESHOT_PATH/install.command"
|
||||
ln -sfh "$ONESHOT_PATH/OneShot.app" "$HOME/Applications/OneShot.app"
|
||||
|
||||
rm -f /tmp/oneshot-pipe # Important for pre-release version cleanup
|
||||
|
||||
echo "\n${green}Complete! ${white}Please report any issues to https://github.com/ZakatTeamI2P/mkxp-sunshine/issues${color_reset}"
|
||||
open "$ONESHOT_PATH"
|
||||
9
niga.rb
9
niga.rb
|
|
@ -1,9 +0,0 @@
|
|||
tp = TracePoint.new(:call) do |t|
|
||||
# Для Ruby-методов:
|
||||
next unless t.defined_class.is_a?(Module) # обычно всегда
|
||||
puts "CALL #{t.defined_class}##{t.method_id} (line #{t.lineno})"
|
||||
end
|
||||
|
||||
tp.enable
|
||||
p "idi naxui"
|
||||
tp.disable
|
||||
|
|
@ -17,13 +17,13 @@ begin
|
|||
Font.default_size = 20
|
||||
Input.set_led(0, 255, 0)
|
||||
|
||||
if defined?(RubyVM::YJIT)
|
||||
RubyVM::YJIT.enable
|
||||
elsif defined?(RubyVM::ZJIT)
|
||||
RubyVM::ZJIT.enable
|
||||
elsif defined?(RubyVM::RJIT)
|
||||
RubyVM::RJIT.enable
|
||||
end
|
||||
#if defined?(RubyVM::YJIT)
|
||||
# RubyVM::YJIT.enable
|
||||
#elsif defined?(RubyVM::ZJIT)
|
||||
# RubyVM::ZJIT.enable
|
||||
#elsif defined?(RubyVM::RJIT)
|
||||
# RubyVM::RJIT.enable
|
||||
#end
|
||||
|
||||
# Load persistent data
|
||||
Persistent.load
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public:
|
|||
#ifdef __ANDROID__
|
||||
__android_log_write(ANDROID_LOG_DEBUG, "sunshine", buf.str().c_str());
|
||||
#elif __EMSCRIPTEN__
|
||||
emscripten_console_log(buf.str().c_str());
|
||||
emscripten_console_log(buf.str().c_str());
|
||||
#else
|
||||
std::cerr << buf.str() << "\n";
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -123,6 +123,8 @@ void crash(Exception::Type t, const char *fmt, ...){
|
|||
out << "Emscripten end address of the stack: " << emscripten_stack_get_end() << std::endl;
|
||||
out << "Emscripten current stack pointer: " << emscripten_stack_get_current() << std::endl;
|
||||
out << "Emscripten number of free bytes left on the stack: " << emscripten_stack_get_free() << std::endl;
|
||||
#elif __PSP__
|
||||
out << "PSPdev MIPS Stack Trace: " << int pspDebugGetStackTrace() << std::endl;
|
||||
#endif
|
||||
out.close();
|
||||
}else{
|
||||
|
|
|
|||
Loading…
Reference in a new issue