Manually rebased over latest mkxp commit. Some features, such as lighting, are not reimplemented yet.
This commit is contained in:
		
							parent
							
								
									5a7480a406
								
							
						
					
					
						commit
						3b64e7871b
					
				
					 24 changed files with 722 additions and 320 deletions
				
			
		| 
						 | 
				
			
			@ -75,6 +75,8 @@ void graphicsBindingInit();
 | 
			
		|||
 | 
			
		||||
void fileIntBindingInit();
 | 
			
		||||
 | 
			
		||||
void oneshotBindingInit();
 | 
			
		||||
 | 
			
		||||
RB_METHOD(mriPrint);
 | 
			
		||||
RB_METHOD(mriP);
 | 
			
		||||
RB_METHOD(mkxpDataDirectory);
 | 
			
		||||
| 
						 | 
				
			
			@ -111,6 +113,7 @@ static void mriBindingInit()
 | 
			
		|||
	graphicsBindingInit();
 | 
			
		||||
 | 
			
		||||
	fileIntBindingInit();
 | 
			
		||||
	oneshotBindingInit();
 | 
			
		||||
 | 
			
		||||
	if (rgssVer >= 3)
 | 
			
		||||
	{
 | 
			
		||||
| 
						 | 
				
			
			@ -151,7 +154,11 @@ static void mriBindingInit()
 | 
			
		|||
static void
 | 
			
		||||
showMsg(const std::string &msg)
 | 
			
		||||
{
 | 
			
		||||
#ifdef NDEBUG
 | 
			
		||||
	shState->eThread().showMessageBox(msg.c_str());
 | 
			
		||||
#else
 | 
			
		||||
	Debug() << msg.c_str();
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void printP(int argc, VALUE *argv,
 | 
			
		||||
| 
						 | 
				
			
			@ -193,7 +200,7 @@ RB_METHOD(mriP)
 | 
			
		|||
RB_METHOD(mkxpDataDirectory)
 | 
			
		||||
{
 | 
			
		||||
	RB_UNUSED_PARAM;
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	const std::string &path = shState->config().customDataPath;
 | 
			
		||||
	const char *s = path.empty() ? "." : path.c_str();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -473,10 +480,7 @@ static void runRMXPScripts(BacktraceData &btData)
 | 
			
		|||
			char buf[512];
 | 
			
		||||
			int len;
 | 
			
		||||
 | 
			
		||||
			if (conf.useScriptNames)
 | 
			
		||||
				len = snprintf(buf, sizeof(buf), "%03ld:%s", i, scriptName);
 | 
			
		||||
			else
 | 
			
		||||
				len = snprintf(buf, sizeof(buf), SCRIPT_SECTION_FMT, i);
 | 
			
		||||
			len = snprintf(buf, sizeof(buf), "%03ld:%s", i, scriptName);
 | 
			
		||||
 | 
			
		||||
			fname = newStringUTF8(buf, len);
 | 
			
		||||
			btData.scriptNames.insert(buf, scriptName);
 | 
			
		||||
| 
						 | 
				
			
			@ -588,11 +592,7 @@ static void mriBindingExecute()
 | 
			
		|||
 | 
			
		||||
	mriBindingInit();
 | 
			
		||||
 | 
			
		||||
	std::string &customScript = conf.customScript;
 | 
			
		||||
	if (!customScript.empty())
 | 
			
		||||
		runCustomScript(customScript);
 | 
			
		||||
	else
 | 
			
		||||
		runRMXPScripts(btData);
 | 
			
		||||
	runRMXPScripts(btData);
 | 
			
		||||
 | 
			
		||||
	VALUE exc = rb_errinfo();
 | 
			
		||||
	if (!NIL_P(exc) && !rb_obj_is_kind_of(exc, rb_eSystemExit))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										46
									
								
								binding-mri/oneshot-binding.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								binding-mri/oneshot-binding.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,46 @@
 | 
			
		|||
#include "oneshot.h"
 | 
			
		||||
#include "etc.h"
 | 
			
		||||
#include "sharedstate.h"
 | 
			
		||||
#include "binding-util.h"
 | 
			
		||||
#include "binding-types.h"
 | 
			
		||||
 | 
			
		||||
RB_METHOD(oneshotSetYesNo)
 | 
			
		||||
{
 | 
			
		||||
    RB_UNUSED_PARAM;
 | 
			
		||||
 | 
			
		||||
    const char *yes;
 | 
			
		||||
    const char *no;
 | 
			
		||||
    rb_get_args(argc, argv, "zz", &yes, &no RB_ARG_END);
 | 
			
		||||
    shState->oneshot().setYesNo(yes, no);
 | 
			
		||||
    return Qnil;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
RB_METHOD(oneshotMsgBox)
 | 
			
		||||
{
 | 
			
		||||
    RB_UNUSED_PARAM;
 | 
			
		||||
 | 
			
		||||
    int type;
 | 
			
		||||
    const char *body;
 | 
			
		||||
    const char *title = 0;
 | 
			
		||||
    rb_get_args(argc, argv, "iz|z", &type, &body, &title RB_ARG_END);
 | 
			
		||||
    return rb_bool_new(shState->oneshot().msgbox(type, body, title));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void oneshotBindingInit()
 | 
			
		||||
{
 | 
			
		||||
    VALUE module = rb_define_module("Oneshot");
 | 
			
		||||
    VALUE msg = rb_define_module_under(module, "Msg");
 | 
			
		||||
 | 
			
		||||
    //Constants
 | 
			
		||||
    rb_const_set(module, rb_intern("USER_NAME"), rb_str_new2(shState->oneshot().userName().c_str()));
 | 
			
		||||
    rb_const_set(module, rb_intern("SAVE_PATH"), rb_str_new2(shState->oneshot().savePath().c_str()));
 | 
			
		||||
    rb_const_set(module, rb_intern("LANG"), ID2SYM(rb_intern(shState->oneshot().lang().c_str())));
 | 
			
		||||
    rb_const_set(msg, rb_intern("INFO"), INT2FIX(Oneshot::MSG_INFO));
 | 
			
		||||
    rb_const_set(msg, rb_intern("YESNO"), INT2FIX(Oneshot::MSG_YESNO));
 | 
			
		||||
    rb_const_set(msg, rb_intern("WARN"), INT2FIX(Oneshot::MSG_WARN));
 | 
			
		||||
    rb_const_set(msg, rb_intern("ERR"), INT2FIX(Oneshot::MSG_ERR));
 | 
			
		||||
 | 
			
		||||
    //Functions
 | 
			
		||||
    _rb_define_module_function(module, "set_yes_no", oneshotSetYesNo);
 | 
			
		||||
    _rb_define_module_function(module, "msgbox", oneshotMsgBox);
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue