mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-19 21:39:57 +00:00
Verbose logging, bugs fixes, minor changes, one SEGFAULT fix(sunshine bindings) and other i dont rememberrrrrrrrrr
This commit is contained in:
parent
8970eeb62e
commit
4eba89fd0c
27 changed files with 304 additions and 421 deletions
|
|
@ -12,8 +12,8 @@ option(DEBUG "Debug mode" ON)
|
|||
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
#i want die
|
||||
# set(DEBUG_C_FLAGS "-g -O0 -fno-omit-frame-pointer -ggdb")
|
||||
# set(DEBUG_CXX_FLAGS "-g -O0 -fno-omit-frame-pointer -ggdb")
|
||||
set(DEBUG_C_FLAGS "-g -O0 -fno-omit-frame-pointer -ggdb")
|
||||
set(DEBUG_CXX_FLAGS "-g -O0 -fno-omit-frame-pointer -ggdb")
|
||||
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${DEBUG_C_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${DEBUG_CXX_FLAGS}")
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ DEF_AUD_PROP_I(SFX_Volume)
|
|||
|
||||
RB_METHOD(audioReset){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
printf("[audioReset] Reseting audio\n");
|
||||
shState->audio().reset();
|
||||
|
||||
return Qnil;
|
||||
|
|
@ -144,8 +144,8 @@ RB_METHOD(audioReset){
|
|||
_rb_define_module_function(module, prop_name_s "=", audio##Set##PropName); \
|
||||
}
|
||||
|
||||
void
|
||||
audioBindingInit(){
|
||||
void audioBindingInit(){
|
||||
printf("[audioBindingInit] Initialing Audio binding\n");
|
||||
VALUE module = rb_define_module("Audio");
|
||||
|
||||
BIND_PLAY_STOP_FADE( bgm );
|
||||
|
|
@ -163,4 +163,5 @@ audioBindingInit(){
|
|||
|
||||
INIT_AUD_PROP_BIND( BGM_Volume, "bgm_volume" );
|
||||
INIT_AUD_PROP_BIND( SFX_Volume, "sfx_volume" );
|
||||
printf("[audioBindingInit] Done\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@ RB_METHOD(mriRgssStop);
|
|||
RB_METHOD(_kernelCaller);
|
||||
|
||||
static void mriBindingInit(){
|
||||
printf("[mriBindingInit] Loading bindings...\n");
|
||||
tableBindingInit();
|
||||
etcBindingInit();
|
||||
fontBindingInit();
|
||||
|
|
@ -118,7 +119,8 @@ static void mriBindingInit(){
|
|||
SunshineBindingInit();
|
||||
steamBindingInit();
|
||||
chromaBindingInit();
|
||||
|
||||
printf("[mriBindingInit] Done\n");
|
||||
printf("[mriBindingInit] RGSS version: %i\n", rgssVer);
|
||||
if (rgssVer >= 3){
|
||||
_rb_define_module_function(rb_mKernel, "rgss_main", mriRgssMain);
|
||||
_rb_define_module_function(rb_mKernel, "rgss_stop", mriRgssStop);
|
||||
|
|
@ -243,6 +245,7 @@ static VALUE rgssMainRescue(VALUE arg, VALUE exc){
|
|||
}
|
||||
|
||||
static void processReset(){
|
||||
printf("[processReset]\n");
|
||||
shState->graphics().reset();
|
||||
shState->audio().reset();
|
||||
|
||||
|
|
@ -257,7 +260,6 @@ static VALUE rgssMainRescue_wrapper(VALUE data, VALUE ex){ return rgssMainRescue
|
|||
|
||||
RB_METHOD(mriRgssMain){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
while (true){
|
||||
VALUE exc = Qnil;
|
||||
|
||||
|
|
@ -362,11 +364,13 @@ static void runRMXPScripts(BacktraceData &btData){
|
|||
const std::string &scriptPack = conf.game.scripts;
|
||||
|
||||
if (scriptPack.empty()){
|
||||
printf("[runRMXPScripts] No game scripts specified (missing Game.ini?)\n");
|
||||
showMsg("No game scripts specified (missing Game.ini?)");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!shState->fileSystem().exists(scriptPack.c_str())){
|
||||
printf("[runRMXPScripts] Unable to open %s\n", scriptPack);
|
||||
showMsg("Unable to open '" + scriptPack + "'");
|
||||
return;
|
||||
}
|
||||
|
|
@ -377,12 +381,15 @@ static void runRMXPScripts(BacktraceData &btData){
|
|||
* still go wrong */
|
||||
try{
|
||||
scriptArray = kernelLoadDataInt(scriptPack.c_str(), false);
|
||||
printf("[runRMXPScripts] %s", scriptPack.c_str());
|
||||
}catch (const Exception &e){
|
||||
printf("[runRMXPScripts] Failed to read script data: %s", e.msg);
|
||||
showMsg(std::string("Failed to read script data: ") + e.msg);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!RB_TYPE_P(scriptArray, RUBY_T_ARRAY)){
|
||||
printf("[runRMXPScripts] Failed to read script data");
|
||||
showMsg("Failed to read script data");
|
||||
return;
|
||||
}
|
||||
|
|
@ -393,7 +400,7 @@ static void runRMXPScripts(BacktraceData &btData){
|
|||
rb_gv_set("$RGSS_SCRIPTS", scriptArray);
|
||||
|
||||
long scriptCount = RARRAY_LEN(scriptArray);
|
||||
|
||||
printf("[runRMXPScripts] Scripts count: %ld\n", scriptCount);
|
||||
std::string decodeBuffer;
|
||||
decodeBuffer.resize(0x1000);
|
||||
|
||||
|
|
@ -403,22 +410,21 @@ static void runRMXPScripts(BacktraceData &btData){
|
|||
if (!RB_TYPE_P(script, RUBY_T_ARRAY))
|
||||
continue;
|
||||
|
||||
VALUE scriptName = rb_ary_entry(script, 1);
|
||||
VALUE scriptName = rb_ary_entry(script, 1);
|
||||
VALUE scriptString = rb_ary_entry(script, 2);
|
||||
|
||||
printf("[runRMXPScripts] Script Name: %s", rb_str_to_str(scriptName));
|
||||
//printf("[runRMXPScripts] ");
|
||||
|
||||
int result = Z_OK;
|
||||
unsigned long bufferLen;
|
||||
|
||||
while (true){
|
||||
unsigned char *bufferPtr =
|
||||
reinterpret_cast<unsigned char*>(const_cast<char*>(decodeBuffer.c_str()));
|
||||
const unsigned char *sourcePtr =
|
||||
reinterpret_cast<const unsigned char*>(RSTRING_PTR(scriptString));
|
||||
unsigned char *bufferPtr = reinterpret_cast<unsigned char*>(const_cast<char*>(decodeBuffer.c_str()));
|
||||
const unsigned char *sourcePtr = reinterpret_cast<const unsigned char*>(RSTRING_PTR(scriptString));
|
||||
|
||||
bufferLen = decodeBuffer.length();
|
||||
|
||||
result = uncompress(bufferPtr, &bufferLen,
|
||||
sourcePtr, RSTRING_LEN(scriptString));
|
||||
result = uncompress(bufferPtr, &bufferLen, sourcePtr, RSTRING_LEN(scriptString));
|
||||
|
||||
bufferPtr[bufferLen] = '\0';
|
||||
|
||||
|
|
@ -430,14 +436,13 @@ static void runRMXPScripts(BacktraceData &btData){
|
|||
|
||||
if (result != Z_OK){
|
||||
static char buffer[256];
|
||||
snprintf(buffer, sizeof(buffer), "Error decoding script %ld: '%s'",
|
||||
i, RSTRING_PTR(scriptName));
|
||||
|
||||
snprintf(buffer, sizeof(buffer), "Error decoding script %ld: '%s'", i, RSTRING_PTR(scriptName));
|
||||
printf("[runRMXPScripts] Script Name: %s", buffer);
|
||||
showMsg(buffer);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
rb_ary_store(script, 3, rb_str_new_cstr(decodeBuffer.c_str()));
|
||||
}
|
||||
|
||||
|
|
@ -454,8 +459,7 @@ static void runRMXPScripts(BacktraceData &btData){
|
|||
for (long i = 0; i < scriptCount; ++i){
|
||||
VALUE script = rb_ary_entry(scriptArray, i);
|
||||
VALUE scriptDecoded = rb_ary_entry(script, 3);
|
||||
VALUE string = newStringUTF8(RSTRING_PTR(scriptDecoded),
|
||||
RSTRING_LEN(scriptDecoded));
|
||||
VALUE string = newStringUTF8(RSTRING_PTR(scriptDecoded), RSTRING_LEN(scriptDecoded));
|
||||
|
||||
VALUE fname;
|
||||
const char *scriptName = RSTRING_PTR(rb_ary_entry(script, 1));
|
||||
|
|
@ -533,13 +537,14 @@ static void showExc(VALUE exc, const BacktraceData &btData){
|
|||
file = btData.scriptNames.value(file, file);
|
||||
|
||||
std::string ms(640, '\0');
|
||||
snprintf(&ms[0], ms.size(), "Script '%s' line %s: %s occured.\n\n%s",
|
||||
snprintf(&ms[0], ms.size(), "[runRMXPScripts]Script '%s' line %s: %s occured.\n\n%s",
|
||||
file.c_str(), line, RSTRING_PTR(name), RSTRING_PTR(msg));
|
||||
|
||||
showMsg(ms);
|
||||
}
|
||||
|
||||
static void mriBindingExecute(){
|
||||
printf("[mirBindingExecute] Setting up ruby\n");
|
||||
/* Normally only a ruby executable would do a sysinit,
|
||||
* but not doing it will lead to crashes due to closed
|
||||
* stdio streams on some platforms (eg. Windows) */
|
||||
|
|
@ -548,9 +553,9 @@ static void mriBindingExecute(){
|
|||
char **argv = 0;
|
||||
char options_argv1[] = "oneshot", options_argv2[] = "-evd", options_argv3[] = "--jit";
|
||||
char* options_argv[] = {options_argv1, options_argv2, options_argv3, NULL};
|
||||
printf("[mriBindingExecute] %s %s %s\n", options_argv1, options_argv2, options_argv3);
|
||||
ruby_setup();
|
||||
ruby_sysinit(&argc, &argv);
|
||||
//ruby_init();
|
||||
rb_enc_set_default_external(rb_enc_from_encoding(rb_utf8_encoding()));
|
||||
|
||||
Config &conf = shState->rtData().config;
|
||||
|
|
@ -566,25 +571,27 @@ static void mriBindingExecute(){
|
|||
rb_ary_push(lpaths, pathv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RbData rbData;
|
||||
shState->setBindingData(&rbData);
|
||||
BacktraceData btData;
|
||||
|
||||
mriBindingInit();
|
||||
|
||||
|
||||
runRMXPScripts(btData);
|
||||
|
||||
VALUE exc = rb_errinfo();
|
||||
if (!NIL_P(exc) && !rb_obj_is_kind_of(exc, rb_eSystemExit))
|
||||
showExc(exc, btData);
|
||||
|
||||
printf("[mirBindingExecure] Ruby cleanup\n");
|
||||
ruby_cleanup(0);
|
||||
|
||||
shState->rtData().rqTermAck.set();
|
||||
}
|
||||
|
||||
static void mriBindingTerminate(){
|
||||
printf("[mriBindingTerminate] Terminating binding...\n");
|
||||
rb_raise(rb_eSystemExit, " ");
|
||||
#ifdef __linux__
|
||||
wallpaperBindingTerminate();
|
||||
|
|
@ -592,6 +599,7 @@ static void mriBindingTerminate(){
|
|||
}
|
||||
|
||||
static void mriBindingReset(){
|
||||
printf("[mriBindingReset] Binding reset...\n");
|
||||
rb_raise(getRbData()->exc[Reset], " ");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,14 +29,12 @@
|
|||
|
||||
DEF_TYPE(Bitmap);
|
||||
|
||||
static const char *objAsStringPtr(VALUE obj)
|
||||
{
|
||||
static const char *objAsStringPtr(VALUE obj){
|
||||
VALUE str = rb_obj_as_string(obj);
|
||||
return RSTRING_PTR(str);
|
||||
}
|
||||
|
||||
void bitmapInitProps(Bitmap *b, VALUE self)
|
||||
{
|
||||
void bitmapInitProps(Bitmap *b, VALUE self){
|
||||
/* Wrap properties */
|
||||
VALUE fontKlass = rb_const_get(rb_cObject, rb_intern("Font"));
|
||||
VALUE fontObj = rb_obj_alloc(fontKlass);
|
||||
|
|
@ -48,19 +46,16 @@ void bitmapInitProps(Bitmap *b, VALUE self)
|
|||
rb_iv_set(self, "font", fontObj);
|
||||
}
|
||||
|
||||
RB_METHOD(bitmapInitialize)
|
||||
{
|
||||
RB_METHOD(bitmapInitialize){
|
||||
Bitmap *b = 0;
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
if (argc == 1){
|
||||
char *filename;
|
||||
rb_get_args(argc, argv, "z", &filename RB_ARG_END);
|
||||
|
||||
GUARD_EXC( b = new Bitmap(filename); )
|
||||
}
|
||||
else
|
||||
{
|
||||
else{
|
||||
int width, height;
|
||||
rb_get_args(argc, argv, "ii", &width, &height RB_ARG_END);
|
||||
|
||||
|
|
@ -73,8 +68,7 @@ RB_METHOD(bitmapInitialize)
|
|||
return self;
|
||||
}
|
||||
|
||||
RB_METHOD(bitmapWidth)
|
||||
{
|
||||
RB_METHOD(bitmapWidth){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
Bitmap *b = getPrivateData<Bitmap>(self);
|
||||
|
|
@ -85,8 +79,7 @@ RB_METHOD(bitmapWidth)
|
|||
return INT2FIX(value);
|
||||
}
|
||||
|
||||
RB_METHOD(bitmapHeight)
|
||||
{
|
||||
RB_METHOD(bitmapHeight){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
Bitmap *b = getPrivateData<Bitmap>(self);
|
||||
|
|
@ -97,8 +90,7 @@ RB_METHOD(bitmapHeight)
|
|||
return INT2FIX(value);
|
||||
}
|
||||
|
||||
RB_METHOD(bitmapRect)
|
||||
{
|
||||
RB_METHOD(bitmapRect){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
Bitmap *b = getPrivateData<Bitmap>(self);
|
||||
|
|
@ -111,8 +103,7 @@ RB_METHOD(bitmapRect)
|
|||
return wrapObject(r, RectType);
|
||||
}
|
||||
|
||||
RB_METHOD(bitmapBlt)
|
||||
{
|
||||
RB_METHOD(bitmapBlt){
|
||||
Bitmap *b = getPrivateData<Bitmap>(self);
|
||||
|
||||
int x, y;
|
||||
|
|
@ -133,8 +124,7 @@ RB_METHOD(bitmapBlt)
|
|||
return self;
|
||||
}
|
||||
|
||||
RB_METHOD(bitmapStretchBlt)
|
||||
{
|
||||
RB_METHOD(bitmapStretchBlt){
|
||||
Bitmap *b = getPrivateData<Bitmap>(self);
|
||||
|
||||
VALUE destRectObj;
|
||||
|
|
@ -156,15 +146,13 @@ RB_METHOD(bitmapStretchBlt)
|
|||
return self;
|
||||
}
|
||||
|
||||
RB_METHOD(bitmapFillRect)
|
||||
{
|
||||
RB_METHOD(bitmapFillRect){
|
||||
Bitmap *b = getPrivateData<Bitmap>(self);
|
||||
|
||||
VALUE colorObj;
|
||||
Color *color;
|
||||
|
||||
if (argc == 2)
|
||||
{
|
||||
if (argc == 2){
|
||||
VALUE rectObj;
|
||||
Rect *rect;
|
||||
|
||||
|
|
@ -175,8 +163,7 @@ RB_METHOD(bitmapFillRect)
|
|||
|
||||
GUARD_EXC( b->fillRect(rect->toIntRect(), color->norm); );
|
||||
}
|
||||
else
|
||||
{
|
||||
else{
|
||||
int x, y, width, height;
|
||||
|
||||
rb_get_args(argc, argv, "iiiio", &x, &y, &width, &height, &colorObj RB_ARG_END);
|
||||
|
|
@ -189,8 +176,7 @@ RB_METHOD(bitmapFillRect)
|
|||
return self;
|
||||
}
|
||||
|
||||
RB_METHOD(bitmapClear)
|
||||
{
|
||||
RB_METHOD(bitmapClear){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
Bitmap *b = getPrivateData<Bitmap>(self);
|
||||
|
|
@ -200,8 +186,7 @@ RB_METHOD(bitmapClear)
|
|||
return self;
|
||||
}
|
||||
|
||||
RB_METHOD(bitmapGetPixel)
|
||||
{
|
||||
RB_METHOD(bitmapGetPixel){
|
||||
Bitmap *b = getPrivateData<Bitmap>(self);
|
||||
|
||||
int x, y;
|
||||
|
|
@ -216,8 +201,7 @@ RB_METHOD(bitmapGetPixel)
|
|||
return wrapObject(color, ColorType);
|
||||
}
|
||||
|
||||
RB_METHOD(bitmapSetPixel)
|
||||
{
|
||||
RB_METHOD(bitmapSetPixel){
|
||||
Bitmap *b = getPrivateData<Bitmap>(self);
|
||||
|
||||
int x, y;
|
||||
|
|
@ -234,8 +218,7 @@ RB_METHOD(bitmapSetPixel)
|
|||
return self;
|
||||
}
|
||||
|
||||
RB_METHOD(bitmapHueChange)
|
||||
{
|
||||
RB_METHOD(bitmapHueChange){
|
||||
Bitmap *b = getPrivateData<Bitmap>(self);
|
||||
|
||||
int hue;
|
||||
|
|
@ -247,27 +230,23 @@ RB_METHOD(bitmapHueChange)
|
|||
return self;
|
||||
}
|
||||
|
||||
RB_METHOD(bitmapDrawText)
|
||||
{
|
||||
RB_METHOD(bitmapDrawText){
|
||||
Bitmap *b = getPrivateData<Bitmap>(self);
|
||||
|
||||
const char *str;
|
||||
int align = Bitmap::Left;
|
||||
|
||||
if (argc == 2 || argc == 3)
|
||||
{
|
||||
if (argc == 2 || argc == 3){
|
||||
VALUE rectObj;
|
||||
Rect *rect;
|
||||
|
||||
if (rgssVer >= 2)
|
||||
{
|
||||
if (rgssVer >= 2){
|
||||
VALUE strObj;
|
||||
rb_get_args(argc, argv, "oo|i", &rectObj, &strObj, &align RB_ARG_END);
|
||||
|
||||
str = objAsStringPtr(strObj);
|
||||
}
|
||||
else
|
||||
{
|
||||
else{
|
||||
rb_get_args(argc, argv, "oz|i", &rectObj, &str, &align RB_ARG_END);
|
||||
}
|
||||
|
||||
|
|
@ -275,19 +254,16 @@ RB_METHOD(bitmapDrawText)
|
|||
|
||||
GUARD_EXC( b->drawText(rect->toIntRect(), str, align); );
|
||||
}
|
||||
else
|
||||
{
|
||||
else{
|
||||
int x, y, width, height;
|
||||
|
||||
if (rgssVer >= 2)
|
||||
{
|
||||
if (rgssVer >= 2){
|
||||
VALUE strObj;
|
||||
rb_get_args(argc, argv, "iiiio|i", &x, &y, &width, &height, &strObj, &align RB_ARG_END);
|
||||
|
||||
str = objAsStringPtr(strObj);
|
||||
}
|
||||
else
|
||||
{
|
||||
else{
|
||||
rb_get_args(argc, argv, "iiiiz|i", &x, &y, &width, &height, &str, &align RB_ARG_END);
|
||||
}
|
||||
|
||||
|
|
@ -297,21 +273,18 @@ RB_METHOD(bitmapDrawText)
|
|||
return self;
|
||||
}
|
||||
|
||||
RB_METHOD(bitmapTextSize)
|
||||
{
|
||||
RB_METHOD(bitmapTextSize){
|
||||
Bitmap *b = getPrivateData<Bitmap>(self);
|
||||
|
||||
const char *str;
|
||||
|
||||
if (rgssVer >= 2)
|
||||
{
|
||||
if (rgssVer >= 2){
|
||||
VALUE strObj;
|
||||
rb_get_args(argc, argv, "o", &strObj RB_ARG_END);
|
||||
|
||||
str = objAsStringPtr(strObj);
|
||||
}
|
||||
else
|
||||
{
|
||||
else{
|
||||
rb_get_args(argc, argv, "z", &str RB_ARG_END);
|
||||
}
|
||||
|
||||
|
|
@ -325,16 +298,14 @@ RB_METHOD(bitmapTextSize)
|
|||
|
||||
DEF_PROP_OBJ_VAL(Bitmap, Font, Font, "font")
|
||||
|
||||
RB_METHOD(bitmapGradientFillRect)
|
||||
{
|
||||
RB_METHOD(bitmapGradientFillRect){
|
||||
Bitmap *b = getPrivateData<Bitmap>(self);
|
||||
|
||||
VALUE color1Obj, color2Obj;
|
||||
Color *color1, *color2;
|
||||
bool vertical = false;
|
||||
|
||||
if (argc == 3 || argc == 4)
|
||||
{
|
||||
if (argc == 3 || argc == 4){
|
||||
VALUE rectObj;
|
||||
Rect *rect;
|
||||
|
||||
|
|
@ -347,8 +318,7 @@ RB_METHOD(bitmapGradientFillRect)
|
|||
|
||||
GUARD_EXC( b->gradientFillRect(rect->toIntRect(), color1->norm, color2->norm, vertical); );
|
||||
}
|
||||
else
|
||||
{
|
||||
else{
|
||||
int x, y, width, height;
|
||||
|
||||
rb_get_args(argc, argv, "iiiioo|b", &x, &y, &width, &height,
|
||||
|
|
@ -363,12 +333,10 @@ RB_METHOD(bitmapGradientFillRect)
|
|||
return self;
|
||||
}
|
||||
|
||||
RB_METHOD(bitmapClearRect)
|
||||
{
|
||||
RB_METHOD(bitmapClearRect){
|
||||
Bitmap *b = getPrivateData<Bitmap>(self);
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
if (argc == 1){
|
||||
VALUE rectObj;
|
||||
Rect *rect;
|
||||
|
||||
|
|
@ -378,8 +346,7 @@ RB_METHOD(bitmapClearRect)
|
|||
|
||||
GUARD_EXC( b->clearRect(rect->toIntRect()); );
|
||||
}
|
||||
else
|
||||
{
|
||||
else{
|
||||
int x, y, width, height;
|
||||
|
||||
rb_get_args(argc, argv, "iiii", &x, &y, &width, &height RB_ARG_END);
|
||||
|
|
@ -390,8 +357,7 @@ RB_METHOD(bitmapClearRect)
|
|||
return self;
|
||||
}
|
||||
|
||||
RB_METHOD(bitmapBlur)
|
||||
{
|
||||
RB_METHOD(bitmapBlur){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
Bitmap *b = getPrivateData<Bitmap>(self);
|
||||
|
|
@ -401,8 +367,7 @@ RB_METHOD(bitmapBlur)
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
RB_METHOD(bitmapRadialBlur)
|
||||
{
|
||||
RB_METHOD(bitmapRadialBlur){
|
||||
Bitmap *b = getPrivateData<Bitmap>(self);
|
||||
|
||||
int angle, divisions;
|
||||
|
|
@ -413,8 +378,7 @@ RB_METHOD(bitmapRadialBlur)
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
RB_METHOD(bitmapInitializeCopy)
|
||||
{
|
||||
RB_METHOD(bitmapInitializeCopy){
|
||||
rb_check_argc(argc, 1);
|
||||
VALUE origObj = argv[0];
|
||||
|
||||
|
|
@ -434,9 +398,8 @@ RB_METHOD(bitmapInitializeCopy)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
bitmapBindingInit()
|
||||
{
|
||||
void bitmapBindingInit(){
|
||||
printf("[bitmapBindingInit] Initializing Bitmap binding\n");
|
||||
VALUE klass = rb_define_class("Bitmap", rb_cObject);
|
||||
rb_define_alloc_func(klass, classAllocate<&BitmapType>);
|
||||
|
||||
|
|
@ -458,8 +421,7 @@ bitmapBindingInit()
|
|||
_rb_define_method(klass, "draw_text", bitmapDrawText);
|
||||
_rb_define_method(klass, "text_size", bitmapTextSize);
|
||||
|
||||
if (rgssVer >= 2)
|
||||
{
|
||||
if (rgssVer >= 2){
|
||||
_rb_define_method(klass, "gradient_fill_rect", bitmapGradientFillRect);
|
||||
_rb_define_method(klass, "clear_rect", bitmapClearRect);
|
||||
_rb_define_method(klass, "blur", bitmapBlur);
|
||||
|
|
@ -467,4 +429,5 @@ bitmapBindingInit()
|
|||
}
|
||||
|
||||
INIT_PROP_BIND(Bitmap, Font, "font");
|
||||
printf("[bitmapBindingInit] Done\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,16 +23,16 @@ int lastAnimId = -1;
|
|||
|
||||
|
||||
void _attemptLinkSdk() {
|
||||
Debug() << "Attempting to bind Chroma SDK";
|
||||
Debug() << "[_attempLinkSdk]Attempting to bind Chroma SDK";
|
||||
#ifdef _WIN32
|
||||
hLib = LoadLibrary(L"ChromaApi.dll");
|
||||
if (hLib != NULL) {
|
||||
Debug() << "Chroma Impl @" << hLib;
|
||||
Debug() << "[_attempLinkSdk]Chroma Impl @" << hLib;
|
||||
INIT_SUCCESS = true;
|
||||
|
||||
_playAnimation = (PluginPlayAnimation) GetProcAddress(hLib, "PluginPlayAnimation");
|
||||
INIT_SUCCESS &= _playAnimation != NULL;
|
||||
Debug() << "Plugin method @" << (long)_playAnimation;
|
||||
Debug() << "[_attempLinkSdk]Plugin method @" << (long)_playAnimation;
|
||||
|
||||
_openAnimation = (PluginOpenAnimation) GetProcAddress(hLib, "PluginOpenAnimation");
|
||||
INIT_SUCCESS &= _openAnimation != NULL;
|
||||
|
|
@ -43,18 +43,18 @@ void _attemptLinkSdk() {
|
|||
_pluginIsInitialized = (PluginIsInitialized) GetProcAddress(hLib, "PluginIsInitialized");
|
||||
INIT_SUCCESS &= _pluginInit != NULL;
|
||||
if (INIT_SUCCESS && !_pluginIsInitialized()) {
|
||||
Debug() << "Initializing chroma plugin";
|
||||
Debug() << "[_attempLinkSdk]Initializing chroma plugin";
|
||||
_pluginInit();
|
||||
}
|
||||
_pluginUninit = (PluginUninit) GetProcAddress(hLib, "PluginUninit");
|
||||
INIT_SUCCESS &= _pluginUninit != NULL;
|
||||
Debug() << "Plugin init success:" << INIT_SUCCESS;
|
||||
Debug() << "[_attempLinkSdk]Plugin init success:" << INIT_SUCCESS;
|
||||
}
|
||||
#else
|
||||
// Currently the Razor Chroma API is Windows-only.
|
||||
// So, if we are not building for Windows platform,
|
||||
// then don't bother with Chroma stuff.
|
||||
Debug() << "Chroma: Unsupported Platform";
|
||||
Debug() << "[_attempLinkSdk]Chroma: Unsupported Platform";
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -62,16 +62,16 @@ void _attemptLinkSdk() {
|
|||
RB_METHOD(chromaPlayAnimation) {
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
Debug() << "Chroma: Attempting to play animation.";
|
||||
Debug() << "[chromaPlayAnimation]Chroma: Attempting to play animation.";
|
||||
const char* animfile;
|
||||
bool loop;
|
||||
|
||||
rb_get_args(argc, argv, "zb", &animfile, &loop RB_ARG_END);
|
||||
|
||||
if (INIT_SUCCESS) {
|
||||
Debug() << "Opening animation:" << animfile;
|
||||
Debug() << "[chromaPlayAnimation]Opening animation:" << animfile;
|
||||
lastAnimId = _openAnimation(animfile);
|
||||
Debug() << "ID:" << lastAnimId;
|
||||
Debug() << "[chromaPlayAnimation]ID:" << lastAnimId;
|
||||
_playAnimation(lastAnimId);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -193,6 +193,7 @@ INITCOPY_FUN(Rect)
|
|||
{ RB_ATTR_R(Klass, Attr, attr); RB_ATTR_W(Klass, Attr, attr); }
|
||||
|
||||
void etcBindingInit(){
|
||||
printf("[etcBindingInit] Initializing etc binding\n");
|
||||
VALUE klass;
|
||||
|
||||
INIT_BIND(Color);
|
||||
|
|
@ -216,4 +217,5 @@ void etcBindingInit(){
|
|||
RB_ATTR_RW(Rect, Width, width);
|
||||
RB_ATTR_RW(Rect, Height, height);
|
||||
_rb_define_method(klass, "empty", rectEmpty);
|
||||
printf("[bitmapBindingInit] Done\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,24 +30,28 @@
|
|||
#include <ruby.h>
|
||||
|
||||
static void fileIntFreeInstance(void *inst){
|
||||
printf("[fileIntFreeInstance] fileIntFreeInstance\n");
|
||||
SDL_IOStream *ops = static_cast<SDL_IOStream*>(inst);
|
||||
if (ops) {
|
||||
printf("[fileIntFreeInstance] Closing ops\n");
|
||||
SDL_CloseIO(ops);
|
||||
}
|
||||
}
|
||||
DEF_TYPE_CUSTOMFREE(FileInt, fileIntFreeInstance);
|
||||
|
||||
static VALUE fileIntForPath(const char *path, bool rubyExc){
|
||||
printf("[fileIntForPath] %s!\n", *path);
|
||||
SDL_IOStream* ops = nullptr;
|
||||
try{
|
||||
shState->fileSystem().openReadRaw(ops, path);
|
||||
if (!ops){
|
||||
printf("NULL guard! fileIntForPath broken!");
|
||||
printf("[fileIntForPath] Null guard!\n");
|
||||
return Qnil;
|
||||
}
|
||||
}
|
||||
catch (const Exception &e){
|
||||
if (ops)
|
||||
printf("[fileIntForPath] Closing ops\n");
|
||||
SDL_CloseIO(ops);
|
||||
|
||||
if (rubyExc)
|
||||
|
|
@ -66,12 +70,13 @@ static VALUE fileIntForPath(const char *path, bool rubyExc){
|
|||
}
|
||||
|
||||
RB_METHOD(fileIntRead){
|
||||
printf("[fileIntRead] fileIntRead\n");
|
||||
int length = -1;
|
||||
rb_get_args(argc, argv, "i", &length);
|
||||
|
||||
SDL_IOStream *ops = getPrivateData<SDL_IOStream>(self);
|
||||
if (!ops){
|
||||
printf("NULL guard! fileIntRead broken!");
|
||||
printf("[fileIntRead] Null guard!\n");
|
||||
return Qnil;
|
||||
}
|
||||
if (length == -1){
|
||||
|
|
@ -82,9 +87,12 @@ RB_METHOD(fileIntRead){
|
|||
}
|
||||
|
||||
if (length == 0)
|
||||
printf("[fileIntRead] zero length\n");
|
||||
return Qnil;
|
||||
|
||||
VALUE data = rb_str_new(0, length);
|
||||
printf("[fileIntRead] data: %s\n", rb_str_to_str(data));
|
||||
printf("[fileIntRead] length: %ld\n", NUM2LONG(length));
|
||||
|
||||
SDL_ReadIO(ops, RSTRING_PTR(data), length);
|
||||
|
||||
|
|
@ -92,29 +100,34 @@ RB_METHOD(fileIntRead){
|
|||
}
|
||||
|
||||
RB_NA_METHOD(fileIntClose){
|
||||
printf("[fileIntClose] fileIntClose\n");
|
||||
SDL_IOStream *ops = getPrivateData<SDL_IOStream>(self);
|
||||
if (!ops){
|
||||
printf("NULL guard! fileIntClose broken!");
|
||||
printf("[fileIntClose] Null guard\n");
|
||||
return Qnil;
|
||||
}
|
||||
printf("[fileIntClose] Closing ops\n");
|
||||
SDL_CloseIO(ops);
|
||||
setPrivateData(self, nullptr);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
RB_NA_METHOD(fileIntGetByte){
|
||||
printf("[fileIntGetByte] fileIntGetByte\n");
|
||||
SDL_IOStream *ops = getPrivateData<SDL_IOStream>(self);
|
||||
|
||||
unsigned char byte = 0;
|
||||
size_t result = SDL_ReadIO(ops, &byte, 1);
|
||||
printf("[fileIntGetByte] %s\n", byte);
|
||||
return (result == 1) ? INT2NUM(byte) : Qnil;
|
||||
}
|
||||
|
||||
RB_NA_METHOD(fileIntBinmode){
|
||||
printf("[fileIntBinMode] Plug\n");
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE load_protect(VALUE marsh_and_port) {
|
||||
printf("[Load_protect] Protecting!\n");
|
||||
VALUE *arr = (VALUE *)marsh_and_port;
|
||||
VALUE marsh = arr[0];
|
||||
VALUE port = arr[1];
|
||||
|
|
@ -122,15 +135,15 @@ static VALUE load_protect(VALUE marsh_and_port) {
|
|||
}
|
||||
|
||||
VALUE kernelLoadDataInt(const char *filename, bool rubyExc){
|
||||
printf("[kernelLoadDataInt] Filename: %s\n", filename);
|
||||
VALUE port = fileIntForPath(filename, rubyExc);
|
||||
VALUE marsh = rb_const_get(rb_cObject, rb_intern("Marshal"));
|
||||
VALUE args[2] = { marsh, port };
|
||||
int state = 0;
|
||||
VALUE result = rb_protect(load_protect, (VALUE)args, &state);
|
||||
|
||||
printf("[kernelLoadDataInt] State %ld\n", NUM2LONG(state));
|
||||
if(RTEST(result) == false){
|
||||
printf("DEBUG ERROR\n");
|
||||
return 1;
|
||||
printf("[kernelLoadDataInt] Result == false, bRuH\n");
|
||||
}
|
||||
|
||||
rb_funcallv(port, rb_intern("close"), 0, nullptr);
|
||||
|
|
@ -153,10 +166,9 @@ VALUE kernelLoadDataInt(const char *filename, bool rubyExc){
|
|||
|
||||
RB_METHOD(kernelLoadData){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
const char *filename;
|
||||
rb_get_args(argc, argv, "z", &filename);
|
||||
|
||||
printf("[kernelLoadData] filename: %s\n", filename);
|
||||
return kernelLoadDataInt(filename, true);
|
||||
}
|
||||
|
||||
|
|
@ -167,20 +179,21 @@ RB_METHOD(kernelSaveData){
|
|||
VALUE filename;
|
||||
|
||||
rb_get_args(argc, argv, "oS", &obj, &filename);
|
||||
|
||||
printf("[kernelSaveData] Filename: %s\n", rb_str_to_str(filename));
|
||||
VALUE file = rb_file_open_str(filename, "wb");
|
||||
|
||||
VALUE marsh = rb_const_get(rb_cObject, rb_intern("Marshal"));
|
||||
|
||||
VALUE v[] = { obj, file };
|
||||
rb_funcall2(marsh, rb_intern("dump"), ARRAY_SIZE(v), v);
|
||||
|
||||
printf("[kernelSaveData] Closing file %s\n", rb_str_to_str(filename));
|
||||
rb_io_close(file);
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE stringForceUTF8(VALUE arg){
|
||||
printf("[stringForceUTF8] %s\n", rb_str_to_str(arg));
|
||||
if (RB_TYPE_P(arg, RUBY_T_STRING)) {
|
||||
/* If current encoding is ASCII-8BIT (binary), associate UTF-8 so
|
||||
subsequent Ruby-level handling treats it as UTF-8. This preserves
|
||||
|
|
@ -194,6 +207,7 @@ static VALUE stringForceUTF8(VALUE arg){
|
|||
}
|
||||
|
||||
static VALUE customProc(VALUE arg, VALUE proc){
|
||||
printf("[customProc] \n");
|
||||
VALUE obj = stringForceUTF8(arg);
|
||||
obj = rb_funcall2(proc, rb_intern("call"), 1, &obj);
|
||||
return obj;
|
||||
|
|
@ -205,7 +219,7 @@ RB_METHOD(_marshalLoad){
|
|||
rb_scan_args(argc, argv, "01", &port, &proc);
|
||||
|
||||
VALUE utf8Proc;
|
||||
|
||||
printf("[_marshalLoad]\n");
|
||||
if (NIL_P(proc))
|
||||
utf8Proc = rb_proc_new(RUBY_METHOD_FUNC(stringForceUTF8), Qnil);
|
||||
else
|
||||
|
|
@ -218,12 +232,13 @@ RB_METHOD(_marshalLoad){
|
|||
}
|
||||
|
||||
void fileIntBindingInit(){
|
||||
printf("[fileIntBindingInit] Initializing filesystem binding...\n");
|
||||
VALUE klass = rb_define_class("FileInt", rb_cIO);
|
||||
rb_define_alloc_func(klass, classAllocate<&FileIntType>);
|
||||
|
||||
rb_define_method(klass, "read", RUBY_METHOD_FUNC(fileIntRead), -1);
|
||||
rb_define_method(klass, "getbyte", RUBY_METHOD_FUNC(fileIntGetByte), 0);
|
||||
rb_define_method(klass, "binmode1", RUBY_METHOD_FUNC(fileIntBinmode), 0);
|
||||
rb_define_method(klass, "binmode", RUBY_METHOD_FUNC(fileIntBinmode), 0);
|
||||
rb_define_method(klass, "close", RUBY_METHOD_FUNC(fileIntClose), 0);
|
||||
|
||||
rb_define_module_function(rb_mKernel, "load_data", RUBY_METHOD_FUNC(kernelLoadData), -1);
|
||||
|
|
@ -235,5 +250,7 @@ void fileIntBindingInit(){
|
|||
VALUE marsh = rb_const_get(rb_cObject, rb_intern("Marshal"));
|
||||
rb_define_alias(rb_singleton_class(marsh), "_mkxp_load_alias", "load");
|
||||
rb_define_module_function(marsh, "load", RUBY_METHOD_FUNC(_marshalLoad), -1);
|
||||
printf("[fileIntBindingInit] Done\n");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -28,17 +28,12 @@
|
|||
#include <string.h>
|
||||
|
||||
|
||||
static void
|
||||
collectStrings(VALUE obj, std::vector<std::string> &out)
|
||||
{
|
||||
if (RB_TYPE_P(obj, RUBY_T_STRING))
|
||||
{
|
||||
static void collectStrings(VALUE obj, std::vector<std::string> &out){
|
||||
if (RB_TYPE_P(obj, RUBY_T_STRING)){
|
||||
out.push_back(RSTRING_PTR(obj));
|
||||
}
|
||||
else if (RB_TYPE_P(obj, RUBY_T_ARRAY))
|
||||
{
|
||||
for (long i = 0; i < RARRAY_LEN(obj); ++i)
|
||||
{
|
||||
else if (RB_TYPE_P(obj, RUBY_T_ARRAY)){
|
||||
for (long i = 0; i < RARRAY_LEN(obj); ++i){
|
||||
VALUE str = rb_ary_entry(obj, i);
|
||||
|
||||
/* Non-string objects are tolerated (ignored) */
|
||||
|
|
@ -52,8 +47,7 @@ collectStrings(VALUE obj, std::vector<std::string> &out)
|
|||
|
||||
DEF_TYPE(Font);
|
||||
|
||||
RB_METHOD(fontDoesExist)
|
||||
{
|
||||
RB_METHOD(fontDoesExist){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
const char *name = 0;
|
||||
|
|
@ -69,8 +63,7 @@ RB_METHOD(fontDoesExist)
|
|||
|
||||
RB_METHOD(FontSetName);
|
||||
|
||||
RB_METHOD(fontInitialize)
|
||||
{
|
||||
RB_METHOD(fontInitialize){
|
||||
VALUE namesObj = Qnil;
|
||||
int size = 0;
|
||||
|
||||
|
|
@ -109,8 +102,7 @@ RB_METHOD(fontInitialize)
|
|||
return self;
|
||||
}
|
||||
|
||||
RB_METHOD(fontInitializeCopy)
|
||||
{
|
||||
RB_METHOD(fontInitializeCopy){
|
||||
VALUE origObj;
|
||||
rb_get_args(argc, argv, "o", &origObj RB_ARG_END);
|
||||
|
||||
|
|
@ -132,15 +124,13 @@ RB_METHOD(fontInitializeCopy)
|
|||
return self;
|
||||
}
|
||||
|
||||
RB_METHOD(FontGetName)
|
||||
{
|
||||
RB_METHOD(FontGetName){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
return rb_iv_get(self, "name");
|
||||
}
|
||||
|
||||
RB_METHOD(FontSetName)
|
||||
{
|
||||
RB_METHOD(FontSetName){
|
||||
Font *f = getPrivateData<Font>(self);
|
||||
|
||||
rb_check_argc(argc, 1);
|
||||
|
|
@ -188,14 +178,12 @@ DEF_KLASS_PROP(Font, bool, DefaultItalic, "b", rb_bool_new)
|
|||
DEF_KLASS_PROP(Font, bool, DefaultShadow, "b", rb_bool_new)
|
||||
DEF_KLASS_PROP(Font, bool, DefaultOutline, "b", rb_bool_new)
|
||||
|
||||
RB_METHOD(FontGetDefaultOutColor)
|
||||
{
|
||||
RB_METHOD(FontGetDefaultOutColor){
|
||||
RB_UNUSED_PARAM;
|
||||
return rb_iv_get(self, "default_out_color");
|
||||
}
|
||||
|
||||
RB_METHOD(FontSetDefaultOutColor)
|
||||
{
|
||||
RB_METHOD(FontSetDefaultOutColor){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
VALUE colorObj;
|
||||
|
|
@ -208,15 +196,13 @@ RB_METHOD(FontSetDefaultOutColor)
|
|||
return colorObj;
|
||||
}
|
||||
|
||||
RB_METHOD(FontGetDefaultName)
|
||||
{
|
||||
RB_METHOD(FontGetDefaultName){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
return rb_iv_get(self, "default_name");
|
||||
}
|
||||
|
||||
RB_METHOD(FontSetDefaultName)
|
||||
{
|
||||
RB_METHOD(FontSetDefaultName){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
rb_check_argc(argc, 1);
|
||||
|
|
@ -230,15 +216,13 @@ RB_METHOD(FontSetDefaultName)
|
|||
return argv[0];
|
||||
}
|
||||
|
||||
RB_METHOD(FontGetDefaultColor)
|
||||
{
|
||||
RB_METHOD(FontGetDefaultColor){
|
||||
RB_UNUSED_PARAM;
|
||||
return rb_iv_get(self, "default_color");
|
||||
}
|
||||
|
||||
|
||||
RB_METHOD(FontSetDefaultColor)
|
||||
{
|
||||
RB_METHOD(FontSetDefaultColor){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
VALUE colorObj;
|
||||
|
|
@ -257,9 +241,8 @@ RB_METHOD(FontSetDefaultColor)
|
|||
rb_define_class_method(klass, prop_name_s "=", Klass##Set##PropName); \
|
||||
}
|
||||
|
||||
void
|
||||
fontBindingInit()
|
||||
{
|
||||
void fontBindingInit(){
|
||||
printf("[fontBindingInit] Initializing Font binding\n");
|
||||
VALUE klass = rb_define_class("Font", rb_cObject);
|
||||
rb_define_alloc_func(klass, classAllocate<&FontType>);
|
||||
|
||||
|
|
@ -270,12 +253,10 @@ fontBindingInit()
|
|||
const std::vector<std::string> &defNames = Font::getInitialDefaultNames();
|
||||
VALUE defNamesObj;
|
||||
|
||||
if (defNames.size() == 1)
|
||||
{
|
||||
if (defNames.size() == 1){
|
||||
defNamesObj = rb_str_new_cstr(defNames[0].c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
else{
|
||||
defNamesObj = rb_ary_new2(defNames.size());
|
||||
|
||||
for (size_t i = 0; i < defNames.size(); ++i)
|
||||
|
|
@ -293,13 +274,11 @@ fontBindingInit()
|
|||
INIT_KLASS_PROP_BIND(Font, DefaultItalic, "default_italic");
|
||||
INIT_KLASS_PROP_BIND(Font, DefaultColor, "default_color");
|
||||
|
||||
if (rgssVer >= 2)
|
||||
{
|
||||
if (rgssVer >= 2){
|
||||
INIT_KLASS_PROP_BIND(Font, DefaultShadow, "default_shadow");
|
||||
}
|
||||
|
||||
if (rgssVer >= 3)
|
||||
{
|
||||
if (rgssVer >= 3){
|
||||
INIT_KLASS_PROP_BIND(Font, DefaultOutline, "default_outline");
|
||||
INIT_KLASS_PROP_BIND(Font, DefaultOutColor, "default_out_color");
|
||||
}
|
||||
|
|
@ -315,14 +294,13 @@ fontBindingInit()
|
|||
INIT_PROP_BIND(Font, Italic, "italic");
|
||||
INIT_PROP_BIND(Font, Color, "color");
|
||||
|
||||
if (rgssVer >= 2)
|
||||
{
|
||||
if (rgssVer >= 2){
|
||||
INIT_PROP_BIND(Font, Shadow, "shadow");
|
||||
}
|
||||
|
||||
if (rgssVer >= 3)
|
||||
{
|
||||
if (rgssVer >= 3){
|
||||
INIT_PROP_BIND(Font, Outline, "outline");
|
||||
INIT_PROP_BIND(Font, OutColor, "out_color");
|
||||
}
|
||||
printf("[fontBindingInit] Done\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,8 +25,7 @@
|
|||
#include "binding-types.h"
|
||||
#include "exception.h"
|
||||
|
||||
RB_METHOD(graphicsUpdate)
|
||||
{
|
||||
RB_METHOD(graphicsUpdate){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
shState->graphics().update();
|
||||
|
|
@ -34,8 +33,7 @@ RB_METHOD(graphicsUpdate)
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
RB_METHOD(graphicsFreeze)
|
||||
{
|
||||
RB_METHOD(graphicsFreeze){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
shState->graphics().freeze();
|
||||
|
|
@ -43,8 +41,7 @@ RB_METHOD(graphicsFreeze)
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
RB_METHOD(graphicsTransition)
|
||||
{
|
||||
RB_METHOD(graphicsTransition){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
int duration = 8;
|
||||
|
|
@ -58,8 +55,7 @@ RB_METHOD(graphicsTransition)
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
RB_METHOD(graphicsFrameReset)
|
||||
{
|
||||
RB_METHOD(graphicsFrameReset){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
shState->graphics().frameReset();
|
||||
|
|
@ -79,7 +75,7 @@ RB_METHOD(graphicsFrameReset)
|
|||
int value; \
|
||||
rb_get_args(argc, argv, "i", &value RB_ARG_END); \
|
||||
shState->graphics().set##PropName(value); \
|
||||
return rb_fix_new(value); \
|
||||
return INT2FIX(value); \
|
||||
}
|
||||
|
||||
#define DEF_GRA_PROP_B(PropName) \
|
||||
|
|
@ -97,22 +93,17 @@ RB_METHOD(graphicsFrameReset)
|
|||
return rb_bool_new(value); \
|
||||
}
|
||||
|
||||
RB_METHOD(graphicsWidth)
|
||||
{
|
||||
RB_METHOD(graphicsWidth){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
return rb_fix_new(shState->graphics().width());
|
||||
return INT2FIX(shState->graphics().width());
|
||||
}
|
||||
|
||||
RB_METHOD(graphicsHeight)
|
||||
{
|
||||
RB_METHOD(graphicsHeight){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
return rb_fix_new(shState->graphics().height());
|
||||
return INT2FIX(shState->graphics().height());
|
||||
}
|
||||
|
||||
RB_METHOD(graphicsWait)
|
||||
{
|
||||
RB_METHOD(graphicsWait){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
int duration;
|
||||
|
|
@ -123,8 +114,7 @@ RB_METHOD(graphicsWait)
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
RB_METHOD(graphicsFadeout)
|
||||
{
|
||||
RB_METHOD(graphicsFadeout){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
int duration;
|
||||
|
|
@ -135,8 +125,7 @@ RB_METHOD(graphicsFadeout)
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
RB_METHOD(graphicsFadein)
|
||||
{
|
||||
RB_METHOD(graphicsFadein){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
int duration;
|
||||
|
|
@ -149,8 +138,7 @@ RB_METHOD(graphicsFadein)
|
|||
|
||||
void bitmapInitProps(Bitmap *b, VALUE self);
|
||||
|
||||
RB_METHOD(graphicsSnapToBitmap)
|
||||
{
|
||||
RB_METHOD(graphicsSnapToBitmap){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
Bitmap *result = 0;
|
||||
|
|
@ -162,8 +150,7 @@ RB_METHOD(graphicsSnapToBitmap)
|
|||
return obj;
|
||||
}
|
||||
|
||||
RB_METHOD(graphicsResizeScreen)
|
||||
{
|
||||
RB_METHOD(graphicsResizeScreen){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
int width, height;
|
||||
|
|
@ -174,8 +161,7 @@ RB_METHOD(graphicsResizeScreen)
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
RB_METHOD(graphicsReset)
|
||||
{
|
||||
RB_METHOD(graphicsReset){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
shState->graphics().reset();
|
||||
|
|
@ -183,8 +169,7 @@ RB_METHOD(graphicsReset)
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
RB_METHOD(graphicsPlayMovie)
|
||||
{
|
||||
RB_METHOD(graphicsPlayMovie){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
const char *filename;
|
||||
|
|
@ -210,8 +195,8 @@ DEF_GRA_PROP_B(Frameskip)
|
|||
_rb_define_module_function(module, prop_name_s "=", graphics##Set##PropName); \
|
||||
}
|
||||
|
||||
void graphicsBindingInit()
|
||||
{
|
||||
void graphicsBindingInit(){
|
||||
printf("[graphicsBindingInit] Initializing Graphics binding\n");
|
||||
VALUE module = rb_define_module("Graphics");
|
||||
|
||||
_rb_define_module_function(module, "update", graphicsUpdate);
|
||||
|
|
@ -224,8 +209,7 @@ void graphicsBindingInit()
|
|||
INIT_GRA_PROP_BIND( FrameRate, "frame_rate" );
|
||||
INIT_GRA_PROP_BIND( FrameCount, "frame_count" );
|
||||
|
||||
if (rgssVer >= 2)
|
||||
{
|
||||
if (rgssVer >= 2){
|
||||
_rb_define_module_function(module, "width", graphicsWidth);
|
||||
_rb_define_module_function(module, "height", graphicsHeight);
|
||||
_rb_define_module_function(module, "wait", graphicsWait);
|
||||
|
|
@ -237,8 +221,7 @@ void graphicsBindingInit()
|
|||
INIT_GRA_PROP_BIND( Brightness, "brightness" );
|
||||
}
|
||||
|
||||
if (rgssVer >= 3)
|
||||
{
|
||||
if (rgssVer >= 3){
|
||||
_rb_define_module_function(module, "play_movie", graphicsPlayMovie);
|
||||
}
|
||||
|
||||
|
|
@ -246,4 +229,5 @@ void graphicsBindingInit()
|
|||
INIT_GRA_PROP_BIND( ShowCursor, "show_cursor" );
|
||||
INIT_GRA_PROP_BIND( Smooth, "smooth" );
|
||||
INIT_GRA_PROP_BIND( Frameskip, "frameskip" );
|
||||
printf("[graphicsBindingInit] Done\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,8 +25,7 @@
|
|||
#include "binding-util.h"
|
||||
#include "util.h"
|
||||
|
||||
RB_METHOD(inputUpdate)
|
||||
{
|
||||
RB_METHOD(inputUpdate){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
shState->input().update();
|
||||
|
|
@ -34,23 +33,19 @@ RB_METHOD(inputUpdate)
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
static int getButtonArg(int argc, VALUE *argv)
|
||||
{
|
||||
static int getButtonArg(int argc, VALUE *argv){
|
||||
int num;
|
||||
|
||||
rb_check_argc(argc, 1);
|
||||
|
||||
if (FIXNUM_P(argv[0]))
|
||||
{
|
||||
if (FIXNUM_P(argv[0])){
|
||||
num = FIX2INT(argv[0]);
|
||||
}
|
||||
else if (SYMBOL_P(argv[0]) && rgssVer >= 3)
|
||||
{
|
||||
else if (SYMBOL_P(argv[0]) && rgssVer >= 3){
|
||||
VALUE symHash = getRbData()->buttoncodeHash;
|
||||
num = FIX2INT(rb_hash_lookup2(symHash, argv[0], INT2FIX(Input::None)));
|
||||
}
|
||||
else
|
||||
{
|
||||
else{
|
||||
// FIXME: RMXP allows only few more types that
|
||||
// don't make sense (symbols in pre 3, floats)
|
||||
num = 0;
|
||||
|
|
@ -59,8 +54,7 @@ static int getButtonArg(int argc, VALUE *argv)
|
|||
return num;
|
||||
}
|
||||
|
||||
RB_METHOD(inputPress)
|
||||
{
|
||||
RB_METHOD(inputPress){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
int num = getButtonArg(argc, argv);
|
||||
|
|
@ -68,8 +62,7 @@ RB_METHOD(inputPress)
|
|||
return rb_bool_new(shState->input().isPressed(num));
|
||||
}
|
||||
|
||||
RB_METHOD(inputTrigger)
|
||||
{
|
||||
RB_METHOD(inputTrigger){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
int num = getButtonArg(argc, argv);
|
||||
|
|
@ -77,8 +70,7 @@ RB_METHOD(inputTrigger)
|
|||
return rb_bool_new(shState->input().isTriggered(num));
|
||||
}
|
||||
|
||||
RB_METHOD(inputRepeat)
|
||||
{
|
||||
RB_METHOD(inputRepeat){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
int num = getButtonArg(argc, argv);
|
||||
|
|
@ -86,50 +78,43 @@ RB_METHOD(inputRepeat)
|
|||
return rb_bool_new(shState->input().isRepeated(num));
|
||||
}
|
||||
|
||||
RB_METHOD(inputDir4)
|
||||
{
|
||||
RB_METHOD(inputDir4){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
return rb_fix_new(shState->input().dir4Value());
|
||||
}
|
||||
|
||||
RB_METHOD(inputDir8)
|
||||
{
|
||||
RB_METHOD(inputDir8){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
return rb_fix_new(shState->input().dir8Value());
|
||||
}
|
||||
|
||||
/* Non-standard extensions */
|
||||
RB_METHOD(inputMouseX)
|
||||
{
|
||||
RB_METHOD(inputMouseX){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
return rb_fix_new(shState->input().mouseX());
|
||||
}
|
||||
|
||||
RB_METHOD(inputMouseY)
|
||||
{
|
||||
RB_METHOD(inputMouseY){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
return rb_fix_new(shState->input().mouseY());
|
||||
}
|
||||
|
||||
RB_METHOD(inputQuit)
|
||||
{
|
||||
RB_METHOD(inputQuit){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
return rb_bool_new(shState->input().hasQuit());
|
||||
}
|
||||
|
||||
|
||||
struct
|
||||
{
|
||||
struct{
|
||||
const char *str;
|
||||
Input::ButtonCode val;
|
||||
}
|
||||
static buttonCodes[] =
|
||||
{
|
||||
static buttonCodes[] = {
|
||||
{ "DOWN", Input::Down },
|
||||
{ "LEFT", Input::Left },
|
||||
{ "RIGHT", Input::Right },
|
||||
|
|
@ -158,9 +143,8 @@ static buttonCodes[] =
|
|||
|
||||
static elementsN(buttonCodes);
|
||||
|
||||
void
|
||||
inputBindingInit()
|
||||
{
|
||||
void inputBindingInit(){
|
||||
printf("[inputBindingInit] Initializing Input binding\n");
|
||||
VALUE module = rb_define_module("Input");
|
||||
|
||||
_rb_define_module_function(module, "update", inputUpdate);
|
||||
|
|
@ -203,4 +187,5 @@ inputBindingInit()
|
|||
rb_const_set(module, sym, val);
|
||||
}
|
||||
}
|
||||
printf("[inputBindingInit] Done\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,15 +41,13 @@ static volatile int message_len = 0;
|
|||
#ifdef LINUX
|
||||
static std::string PIPE_PATH = std::string(getpwuid(getuid())->pw_dir) + "/.oneshot-pipe";
|
||||
static volatile int out_pipe = -1;
|
||||
void cleanup_pipe()
|
||||
{
|
||||
void cleanup_pipe(){
|
||||
unlink(PIPE_PATH.c_str());
|
||||
remove(PIPE_PATH.c_str());
|
||||
}
|
||||
#endif
|
||||
|
||||
int server_thread(void *data)
|
||||
{
|
||||
int server_thread(void *data){
|
||||
(void)data;
|
||||
#if defined OS_W32
|
||||
HANDLE pipe = CreateNamedPipeW(L"\\\\.\\pipe\\oneshot-journal-to-game",
|
||||
|
|
@ -72,16 +70,13 @@ int server_thread(void *data)
|
|||
}
|
||||
CloseHandle(pipe);
|
||||
#else
|
||||
if (access(PIPE_PATH.c_str(), F_OK) != -1)
|
||||
{
|
||||
if (access(PIPE_PATH.c_str(), F_OK) != -1){
|
||||
out_pipe = open(PIPE_PATH.c_str(), O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
|
||||
SDL_LockMutex(mutex);
|
||||
active = true;
|
||||
if (message_len > 0)
|
||||
{
|
||||
if (write(out_pipe, (char*)message_buffer, message_len) == -1)
|
||||
{
|
||||
Debug() << "Failure writing to journal's pipe!";
|
||||
if (message_len > 0){
|
||||
if (write(out_pipe, (char*)message_buffer, message_len) == -1){
|
||||
Debug() << "[journal-binding>server_thread()]Failure writing to journal's pipe!";
|
||||
}
|
||||
}
|
||||
SDL_UnlockMutex(mutex);
|
||||
|
|
@ -165,8 +160,8 @@ RB_METHOD(journalActive)
|
|||
return active ? Qtrue : Qfalse;
|
||||
}
|
||||
|
||||
void journalBindingInit()
|
||||
{
|
||||
void journalBindingInit(){
|
||||
printf("[journalBindingInit] Initializing Journal binding\n");
|
||||
mutex = SDL_CreateMutex();
|
||||
memset((char*)lang_buffer, 0, BUFFER_SIZE);
|
||||
lang_buffer[0] = '_';
|
||||
|
|
@ -179,4 +174,5 @@ void journalBindingInit()
|
|||
_rb_define_module_function(module, "set", journalSet);
|
||||
_rb_define_module_function(module, "active?", journalActive);
|
||||
_rb_define_module_function(module, "setLang", journalSetLang);
|
||||
printf("[inputBindingInit] Done\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,15 +46,13 @@ static volatile int message_len = 0;
|
|||
#ifdef LINUX
|
||||
static std::string NIKO_PIPE_PATH = std::string(getpwuid(getuid())->pw_dir) + "/.oneshot-niko-pipe";
|
||||
static volatile int out_pipe = -1;
|
||||
void niko_cleanup_pipe()
|
||||
{
|
||||
void niko_cleanup_pipe(){
|
||||
unlink(NIKO_PIPE_PATH.c_str());
|
||||
remove(NIKO_PIPE_PATH.c_str());
|
||||
}
|
||||
#endif
|
||||
|
||||
int niko_server_thread(void *data)
|
||||
{
|
||||
int niko_server_thread(void *data){
|
||||
(void)data;
|
||||
#if defined OS_W32
|
||||
HANDLE pipe = CreateNamedPipeW(L"\\\\.\\pipe\\oneshot-journal-to-game",
|
||||
|
|
@ -85,7 +83,7 @@ int niko_server_thread(void *data)
|
|||
{
|
||||
if (write(out_pipe, (char*)message_buffer, message_len) == -1)
|
||||
{
|
||||
Debug() << "Failed to write to pipe!";
|
||||
Debug() << "[niko_server_thread]Failed to write to pipe!";
|
||||
}
|
||||
}
|
||||
SDL_UnlockMutex(mutex);
|
||||
|
|
@ -94,8 +92,7 @@ int niko_server_thread(void *data)
|
|||
#endif
|
||||
}
|
||||
|
||||
RB_METHOD(nikoPrepare)
|
||||
{
|
||||
RB_METHOD(nikoPrepare){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
// Prime native window info
|
||||
|
|
@ -128,8 +125,7 @@ RB_METHOD(nikoPrepare)
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
RB_METHOD(nikoStart)
|
||||
{
|
||||
RB_METHOD(nikoStart){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
// Prime native window info
|
||||
|
|
@ -191,8 +187,8 @@ RB_METHOD(nikoStart)
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
void nikoBindingInit()
|
||||
{
|
||||
void nikoBindingInit(){
|
||||
printf("[nikoBindingInit] Initializing Niko binding:3\n");
|
||||
mutex = SDL_CreateMutex();
|
||||
#if defined __linux
|
||||
mkfifo(NIKO_PIPE_PATH.c_str(), 0666);
|
||||
|
|
@ -204,4 +200,5 @@ void nikoBindingInit()
|
|||
//Functions
|
||||
_rb_define_module_function(module, "get_ready", nikoPrepare);
|
||||
_rb_define_module_function(module, "do_your_thing", nikoStart);
|
||||
printf("[nikoBindingInit] Done\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ RB_METHOD(oneshotCRC32){
|
|||
}
|
||||
|
||||
void oneshotBindingInit(){
|
||||
printf("[oneshotBindingInit] Initializing Oneshot binding\n");
|
||||
VALUE module = rb_define_module("Oneshot");
|
||||
VALUE msg = rb_define_module_under(module, "Msg");
|
||||
|
||||
|
|
@ -122,4 +123,5 @@ void oneshotBindingInit(){
|
|||
_rb_define_module_function(module, "exiting", oneshotExiting);
|
||||
_rb_define_module_function(module, "shake", oneshotShake);
|
||||
_rb_define_module_function(module, "crc32", oneshotCRC32);
|
||||
printf("[oneshotBindingInit] Done\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,8 +27,7 @@
|
|||
|
||||
DEF_TYPE(Plane);
|
||||
|
||||
RB_METHOD(planeInitialize)
|
||||
{
|
||||
RB_METHOD(planeInitialize){
|
||||
Plane *p = viewportElementInitialize<Plane>(argc, argv, self);
|
||||
|
||||
setPrivateData(self, p);
|
||||
|
|
@ -56,9 +55,8 @@ DEF_PROP_F(Plane, ZoomX)
|
|||
DEF_PROP_F(Plane, ZoomY)
|
||||
|
||||
|
||||
void
|
||||
planeBindingInit()
|
||||
{
|
||||
void planeBindingInit(){
|
||||
printf("[planeBindingInit] Initializing Plane binding\n");
|
||||
VALUE klass = rb_define_class("Plane", rb_cObject);
|
||||
rb_define_alloc_func(klass, classAllocate<&PlaneType>);
|
||||
|
||||
|
|
@ -77,4 +75,5 @@ planeBindingInit()
|
|||
INIT_PROP_BIND( Plane, BlendType, "blend_type" );
|
||||
INIT_PROP_BIND( Plane, Color, "color" );
|
||||
INIT_PROP_BIND( Plane, Tone, "tone" );
|
||||
printf("[planeBindingInit] Done\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,7 @@
|
|||
|
||||
static Pipe ipc;
|
||||
|
||||
static void start()
|
||||
{
|
||||
static void start(){
|
||||
ipc.open("oneshot-pipe", Pipe::Write);
|
||||
|
||||
// Create process
|
||||
|
|
@ -40,8 +39,7 @@ static void start()
|
|||
pid_t pid = fork();
|
||||
if (pid == 0) {
|
||||
execl(exename.c_str(), "oneshot",
|
||||
(std::string("--gameFolder=") + shState->config().gameFolder).c_str(),
|
||||
"--screenMode=true", NULL);
|
||||
(std::string("--gameFolder=") + shState->config().gameFolder).c_str(), "--screenMode=true", NULL);
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
|
|
@ -49,23 +47,20 @@ static void start()
|
|||
ipc.connect();
|
||||
}
|
||||
|
||||
RB_METHOD(screenStart)
|
||||
{
|
||||
RB_METHOD(screenStart){
|
||||
RB_UNUSED_PARAM;
|
||||
start();
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
RB_METHOD(screenFinish)
|
||||
{
|
||||
RB_METHOD(screenFinish){
|
||||
RB_UNUSED_PARAM;
|
||||
ipc.write("END", sizeof("END"));
|
||||
ipc.close();
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
RB_METHOD(screenSet)
|
||||
{
|
||||
RB_METHOD(screenSet){
|
||||
RB_UNUSED_PARAM;
|
||||
const char *imageName;
|
||||
rb_get_args(argc, argv, "z", &imageName RB_ARG_END);
|
||||
|
|
@ -75,10 +70,11 @@ RB_METHOD(screenSet)
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
void screenBindingInit()
|
||||
{
|
||||
void screenBindingInit(){
|
||||
printf("[screenBindingInit] Initializing Screen binding\n");
|
||||
VALUE module = rb_define_module("Screen");
|
||||
_rb_define_module_function(module, "start", screenStart);
|
||||
_rb_define_module_function(module, "finish", screenFinish);
|
||||
_rb_define_module_function(module, "set", screenSet);
|
||||
printf("[screenBindingInit] Done\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,8 +30,7 @@
|
|||
|
||||
DEF_TYPE(Sprite);
|
||||
|
||||
RB_METHOD(spriteInitialize)
|
||||
{
|
||||
RB_METHOD(spriteInitialize){
|
||||
Sprite *s = viewportElementInitialize<Sprite>(argc, argv, self);
|
||||
|
||||
setPrivateData(self, s);
|
||||
|
|
@ -71,8 +70,7 @@ DEF_PROP_F(Sprite, WavePhase)
|
|||
DEF_PROP_B(Sprite, Mirror)
|
||||
DEF_PROP_B(Sprite, Obscured)
|
||||
|
||||
RB_METHOD(spriteWidth)
|
||||
{
|
||||
RB_METHOD(spriteWidth){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
Sprite *s = getPrivateData<Sprite>(self);
|
||||
|
|
@ -80,11 +78,10 @@ RB_METHOD(spriteWidth)
|
|||
int value = 0;
|
||||
GUARD_EXC( value = s->getWidth(); )
|
||||
|
||||
return rb_fix_new(value);
|
||||
return INT2NUM(value);
|
||||
}
|
||||
|
||||
RB_METHOD(spriteHeight)
|
||||
{
|
||||
RB_METHOD(spriteHeight){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
Sprite *s = getPrivateData<Sprite>(self);
|
||||
|
|
@ -92,12 +89,11 @@ RB_METHOD(spriteHeight)
|
|||
int value = 0;
|
||||
GUARD_EXC( value = s->getHeight(); )
|
||||
|
||||
return rb_fix_new(value);
|
||||
return INT2NUM(value);
|
||||
}
|
||||
|
||||
void
|
||||
spriteBindingInit()
|
||||
{
|
||||
void spriteBindingInit(){
|
||||
printf("[spriteBindingInit] Initializing sprite binding\n");
|
||||
VALUE klass = rb_define_class("Sprite", rb_cObject);
|
||||
rb_define_alloc_func(klass, classAllocate<&SpriteType>);
|
||||
|
||||
|
|
@ -124,8 +120,7 @@ spriteBindingInit()
|
|||
INIT_PROP_BIND( Sprite, Tone, "tone" );
|
||||
INIT_PROP_BIND( Sprite, Obscured, "obscured" );
|
||||
|
||||
if (rgssVer >= 2)
|
||||
{
|
||||
if (rgssVer >= 2){
|
||||
_rb_define_method(klass, "width", spriteWidth);
|
||||
_rb_define_method(klass, "height", spriteHeight);
|
||||
|
||||
|
|
@ -136,4 +131,5 @@ spriteBindingInit()
|
|||
INIT_PROP_BIND( Sprite, WaveSpeed, "wave_speed" );
|
||||
INIT_PROP_BIND( Sprite, WavePhase, "wave_phase" );
|
||||
}
|
||||
printf("[spriteBindingInit] Done\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,7 @@
|
|||
#include "binding-types.h"
|
||||
#include "debugwriter.h"
|
||||
|
||||
RB_METHOD(steamEnabled)
|
||||
{
|
||||
RB_METHOD(steamEnabled){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
#ifdef STEAM
|
||||
|
|
@ -18,8 +17,7 @@ RB_METHOD(steamEnabled)
|
|||
#endif
|
||||
}
|
||||
|
||||
RB_METHOD(steamUnlock)
|
||||
{
|
||||
RB_METHOD(steamUnlock){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
const char *name;
|
||||
|
|
@ -31,8 +29,7 @@ RB_METHOD(steamUnlock)
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
RB_METHOD(steamLock)
|
||||
{
|
||||
RB_METHOD(steamLock){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
const char *name;
|
||||
|
|
@ -44,8 +41,7 @@ RB_METHOD(steamLock)
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
RB_METHOD(steamUnlocked)
|
||||
{
|
||||
RB_METHOD(steamUnlocked){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
const char *name;
|
||||
|
|
@ -58,8 +54,8 @@ RB_METHOD(steamUnlocked)
|
|||
#endif
|
||||
}
|
||||
|
||||
void steamBindingInit()
|
||||
{
|
||||
void steamBindingInit(){
|
||||
printf("[steamBindingInit] Initializing Steam binding\n");
|
||||
VALUE module = rb_define_module("Steam");
|
||||
|
||||
/* Constants */
|
||||
|
|
@ -79,4 +75,5 @@ void steamBindingInit()
|
|||
_rb_define_module_function(module, "unlock", steamUnlock);
|
||||
_rb_define_module_function(module, "lock", steamLock);
|
||||
_rb_define_module_function(module, "unlocked?", steamUnlocked);
|
||||
printf("[steamBindingInit] Done\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,12 @@
|
|||
#include "oneshot.h"
|
||||
#include "etc.h"
|
||||
#include "sharedstate.h"
|
||||
#include "binding-util.h"
|
||||
#include "binding-types.h"
|
||||
#include "eventthread.h"
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#include <ruby.h>
|
||||
#include <SDL3/SDL_version.h>
|
||||
//for future use
|
||||
|
||||
void SunshineBindingInit(){
|
||||
VALUE module = rb_define_module("Sunshine");
|
||||
rb_const_set(module, rb_intern("SDLVersion"), static_cast<char>(SDL_VERSION));
|
||||
printf("[SunshineBindingInit] Initializing Sunshine binding\n");
|
||||
VALUE module = rb_define_module("Sunshine");
|
||||
|
||||
rb_define_const(module, "SDLVersion", INT2NUM(SDL_VERSION));
|
||||
|
||||
printf("[SunshineBindingInit] SDL version: %u\n", SDL_VERSION);
|
||||
printf("[SunshineBindingInit] Done\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,14 +24,12 @@
|
|||
#include "binding-util.h"
|
||||
#include "serializable-binding.h"
|
||||
|
||||
static int num2TableSize(VALUE v)
|
||||
{
|
||||
static int num2TableSize(VALUE v){
|
||||
int i = NUM2INT(v);
|
||||
return std::max(0, i);
|
||||
}
|
||||
|
||||
static void parseArgsTableSizes(int argc, VALUE *argv, int *x, int *y, int *z)
|
||||
{
|
||||
static void parseArgsTableSizes(int argc, VALUE *argv, int *x, int *y, int *z){
|
||||
*y = *z = 1;
|
||||
|
||||
switch (argc)
|
||||
|
|
@ -52,8 +50,7 @@ static void parseArgsTableSizes(int argc, VALUE *argv, int *x, int *y, int *z)
|
|||
|
||||
DEF_TYPE(Table);
|
||||
|
||||
RB_METHOD(tableInitialize)
|
||||
{
|
||||
RB_METHOD(tableInitialize){
|
||||
int x, y, z;
|
||||
|
||||
parseArgsTableSizes(argc, argv, &x, &y, &z);
|
||||
|
|
@ -65,8 +62,7 @@ RB_METHOD(tableInitialize)
|
|||
return self;
|
||||
}
|
||||
|
||||
RB_METHOD(tableResize)
|
||||
{
|
||||
RB_METHOD(tableResize){
|
||||
Table *t = getPrivateData<Table>(self);
|
||||
|
||||
int x, y, z;
|
||||
|
|
@ -89,8 +85,7 @@ TABLE_SIZE(x, X)
|
|||
TABLE_SIZE(y, Y)
|
||||
TABLE_SIZE(z, Z)
|
||||
|
||||
RB_METHOD(tableGetAt)
|
||||
{
|
||||
RB_METHOD(tableGetAt){
|
||||
Table *t = getPrivateData<Table>(self);
|
||||
|
||||
int x, y, z;
|
||||
|
|
@ -117,8 +112,7 @@ RB_METHOD(tableGetAt)
|
|||
return INT2FIX(result); /* short always fits in a Fixnum */
|
||||
}
|
||||
|
||||
RB_METHOD(tableSetAt)
|
||||
{
|
||||
RB_METHOD(tableSetAt){
|
||||
Table *t = getPrivateData<Table>(self);
|
||||
|
||||
int x, y, z, value;
|
||||
|
|
@ -158,9 +152,8 @@ RB_METHOD(tableSetAt)
|
|||
MARSH_LOAD_FUN(Table)
|
||||
INITCOPY_FUN(Table)
|
||||
|
||||
void
|
||||
tableBindingInit()
|
||||
{
|
||||
void tableBindingInit(){
|
||||
printf("[tableBindingInit] Initializing Table binding\n");
|
||||
VALUE klass = rb_define_class("Table", rb_cObject);
|
||||
rb_define_alloc_func(klass, classAllocate<&TableType>);
|
||||
|
||||
|
|
@ -176,5 +169,5 @@ tableBindingInit()
|
|||
_rb_define_method(klass, "zsize", tableZSize);
|
||||
_rb_define_method(klass, "[]", tableGetAt);
|
||||
_rb_define_method(klass, "[]=", tableSetAt);
|
||||
|
||||
printf("[tableBindingInit] Done\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,6 +136,7 @@ DEF_PROP_I(Tilemap, OX)
|
|||
DEF_PROP_I(Tilemap, OY)
|
||||
|
||||
void tilemapBindingInit(){
|
||||
printf("[tilemapBindingInit] Initializing tilemap binding\n");
|
||||
VALUE klass = rb_define_class("TilemapAutotiles", rb_cObject);
|
||||
rb_define_alloc_func(klass, classAllocate<&TilemapAutotilesType>);
|
||||
|
||||
|
|
@ -161,4 +162,5 @@ void tilemapBindingInit(){
|
|||
INIT_PROP_BIND( Tilemap, Wrapping, "wrapping" );
|
||||
INIT_PROP_BIND( Tilemap, OX, "ox" );
|
||||
INIT_PROP_BIND( Tilemap, OY, "oy" );
|
||||
printf("[tilemapBindingInit] Done\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@ DEF_PROP_I(Viewport, OY)
|
|||
|
||||
|
||||
void viewportBindingInit(){
|
||||
printf("[viewportBindingInit] Initializing viewport binding\n");
|
||||
VALUE klass = rb_define_class("Viewport", rb_cObject);
|
||||
rb_define_alloc_func(klass, classAllocate<&ViewportType>);
|
||||
|
||||
|
|
@ -94,5 +95,6 @@ void viewportBindingInit(){
|
|||
INIT_PROP_BIND( Viewport, OY, "oy" );
|
||||
INIT_PROP_BIND( Viewport, Color, "color" );
|
||||
INIT_PROP_BIND( Viewport, Tone, "tone" );
|
||||
printf("[viewportBindingInit] Done\n");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@
|
|||
|
||||
#ifdef __linux__
|
||||
void desktopEnvironmentInit(){
|
||||
printf("[desktopEnvironmentInit] desktopEnvironmentInit()\n");
|
||||
if (desktop != "uninitialized") {
|
||||
return;
|
||||
}
|
||||
|
|
@ -173,7 +174,7 @@ RB_METHOD(wallpaperSet){
|
|||
std::string path;
|
||||
#ifdef _WIN32
|
||||
path = shState->config().gameFolder + "\\Wallpaper\\" + name + ".bmp";
|
||||
Debug() << "Setting wallpaper to" << path;
|
||||
Debug() << "[wallpaperSet]Setting wallpaper to" << path;
|
||||
// Crapify the slashes
|
||||
size_t index = 0;
|
||||
for (;;) {
|
||||
|
|
@ -248,7 +249,7 @@ end:
|
|||
}
|
||||
path = "/Wallpaper/" + nameFix + ".png";
|
||||
|
||||
Debug() << "Setting wallpaper to " << path;
|
||||
Debug() << "[wallpaperSet]Setting wallpaper to " << path;
|
||||
|
||||
#ifdef __APPLE__
|
||||
if (!isCached) {
|
||||
|
|
@ -299,7 +300,7 @@ end:
|
|||
colorArrType = g_type_from_name("GPtrArray_GValue_");
|
||||
if (!colorArrType) {
|
||||
// Let's do some debug output here and skip changing the color
|
||||
Debug() << "WALLPAPER ERROR: xfconf-query call returned" << colorCommandRes;
|
||||
Debug() << "[wallpaperSet]WALLPAPER ERROR: xfconf-query call returned" << colorCommandRes;
|
||||
return Qnil;
|
||||
}
|
||||
}
|
||||
|
|
@ -468,12 +469,12 @@ RB_METHOD(wallpaperReset){
|
|||
"}" <<
|
||||
"}" <<
|
||||
"'";
|
||||
Debug() << "Reset wallpaper command:" << command.str();
|
||||
Debug() << "[wallpaperReset]Reset wallpaper command:" << command.str();
|
||||
int result = system(command.str().c_str());
|
||||
Debug() << "Reset result:" << result;
|
||||
Debug() << "[wallpaperReset]Reset result:" << result;
|
||||
} else {
|
||||
if (remove(fallbackPath.c_str()) != 0) {
|
||||
Debug() << "Failed to delete:" << fallbackPath;
|
||||
Debug() << "[wallpaperReset]Failed to delete:" << fallbackPath;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ DEF_PROP_I(Window, ContentsOpacity)
|
|||
|
||||
|
||||
void windowBindingInit(){
|
||||
printf("[windowBindingInit] Initialing Window binding\n");
|
||||
VALUE klass = rb_define_class("Window", rb_cObject);
|
||||
rb_define_alloc_func(klass, classAllocate<&WindowType>);
|
||||
|
||||
|
|
@ -92,4 +93,5 @@ void windowBindingInit(){
|
|||
INIT_PROP_BIND( Window, Opacity, "opacity" );
|
||||
INIT_PROP_BIND( Window, BackOpacity, "back_opacity" );
|
||||
INIT_PROP_BIND( Window, ContentsOpacity, "contents_opacity" );
|
||||
printf("[windowBindingInit] Done\n");
|
||||
}
|
||||
|
|
|
|||
102
src/audio.cpp
102
src/audio.cpp
|
|
@ -32,8 +32,7 @@
|
|||
#include <SDL3/SDL_thread.h>
|
||||
#include <SDL3/SDL_timer.h>
|
||||
|
||||
struct AudioPrivate
|
||||
{
|
||||
struct AudioPrivate{
|
||||
int bgm_volume;
|
||||
int sfx_volume;
|
||||
|
||||
|
|
@ -54,16 +53,14 @@ struct AudioPrivate
|
|||
* keeping it paused/stopped while the ME plays,
|
||||
* and unpausing/fading the BGM back in again
|
||||
* afterwards */
|
||||
enum MeWatchState
|
||||
{
|
||||
enum MeWatchState{
|
||||
MeNotPlaying,
|
||||
BgmFadingOut,
|
||||
MePlaying,
|
||||
BgmFadingIn
|
||||
};
|
||||
|
||||
struct
|
||||
{
|
||||
struct{
|
||||
SDL_Thread *thread;
|
||||
AtomicFlag termReq;
|
||||
MeWatchState state;
|
||||
|
|
@ -86,32 +83,26 @@ struct AudioPrivate
|
|||
<AudioPrivate, &AudioPrivate::meWatchFun>(this, "audio_mewatch");
|
||||
}
|
||||
|
||||
~AudioPrivate()
|
||||
{
|
||||
~AudioPrivate(){
|
||||
meWatch.termReq.set();
|
||||
SDL_WaitThread(meWatch.thread, 0);
|
||||
}
|
||||
|
||||
void meWatchFun()
|
||||
{
|
||||
void meWatchFun(){
|
||||
const float fadeOutStep = 1.f / (200 / AUDIO_SLEEP);
|
||||
const float fadeInStep = 1.f / (1000 / AUDIO_SLEEP);
|
||||
|
||||
while (true)
|
||||
{
|
||||
while (true){
|
||||
syncPoint.passSecondarySync();
|
||||
|
||||
if (meWatch.termReq)
|
||||
return;
|
||||
|
||||
switch (meWatch.state)
|
||||
{
|
||||
case MeNotPlaying:
|
||||
{
|
||||
switch (meWatch.state){
|
||||
case MeNotPlaying:{
|
||||
me.lockStream();
|
||||
|
||||
if (me.stream.queryState() == ALStream::Playing)
|
||||
{
|
||||
if (me.stream.queryState() == ALStream::Playing){
|
||||
/* ME playing detected. -> FadeOutBGM */
|
||||
bgm.extPaused = true;
|
||||
meWatch.state = BgmFadingOut;
|
||||
|
|
@ -122,12 +113,10 @@ struct AudioPrivate
|
|||
break;
|
||||
}
|
||||
|
||||
case BgmFadingOut :
|
||||
{
|
||||
case BgmFadingOut :{
|
||||
me.lockStream();
|
||||
|
||||
if (me.stream.queryState() != ALStream::Playing)
|
||||
{
|
||||
if (me.stream.queryState() != ALStream::Playing){
|
||||
/* ME has ended while fading OUT BGM. -> FadeInBGM */
|
||||
me.unlockStream();
|
||||
meWatch.state = BgmFadingIn;
|
||||
|
|
@ -140,8 +129,7 @@ struct AudioPrivate
|
|||
float vol = bgm.getVolume(AudioStream::External);
|
||||
vol -= fadeOutStep;
|
||||
|
||||
if (vol < 0 || bgm.stream.queryState() != ALStream::Playing)
|
||||
{
|
||||
if (vol < 0 || bgm.stream.queryState() != ALStream::Playing){
|
||||
/* Either BGM has fully faded out, or stopped midway. -> MePlaying */
|
||||
bgm.setVolume(AudioStream::External, 0);
|
||||
bgm.stream.pause();
|
||||
|
|
@ -159,12 +147,10 @@ struct AudioPrivate
|
|||
break;
|
||||
}
|
||||
|
||||
case MePlaying :
|
||||
{
|
||||
case MePlaying :{
|
||||
me.lockStream();
|
||||
|
||||
if (me.stream.queryState() != ALStream::Playing)
|
||||
{
|
||||
if (me.stream.queryState() != ALStream::Playing){
|
||||
/* ME has ended */
|
||||
bgm.lockStream();
|
||||
|
||||
|
|
@ -172,14 +158,12 @@ struct AudioPrivate
|
|||
|
||||
ALStream::State sState = bgm.stream.queryState();
|
||||
|
||||
if (sState == ALStream::Paused)
|
||||
{
|
||||
if (sState == ALStream::Paused){
|
||||
/* BGM is paused. -> FadeInBGM */
|
||||
bgm.stream.play();
|
||||
meWatch.state = BgmFadingIn;
|
||||
}
|
||||
else
|
||||
{
|
||||
else{
|
||||
/* BGM is stopped. -> MeNotPlaying */
|
||||
bgm.setVolume(AudioStream::External, 1.0f);
|
||||
|
||||
|
|
@ -197,12 +181,10 @@ struct AudioPrivate
|
|||
break;
|
||||
}
|
||||
|
||||
case BgmFadingIn :
|
||||
{
|
||||
case BgmFadingIn :{
|
||||
bgm.lockStream();
|
||||
|
||||
if (bgm.stream.queryState() == ALStream::Stopped)
|
||||
{
|
||||
if (bgm.stream.queryState() == ALStream::Stopped){
|
||||
/* BGM stopped midway fade in. -> MeNotPlaying */
|
||||
bgm.setVolume(AudioStream::External, 1.0f);
|
||||
meWatch.state = MeNotPlaying;
|
||||
|
|
@ -213,8 +195,7 @@ struct AudioPrivate
|
|||
|
||||
me.lockStream();
|
||||
|
||||
if (me.stream.queryState() == ALStream::Playing)
|
||||
{
|
||||
if (me.stream.queryState() == ALStream::Playing){
|
||||
/* ME started playing midway BGM fade in. -> FadeOutBGM */
|
||||
bgm.extPaused = true;
|
||||
meWatch.state = BgmFadingOut;
|
||||
|
|
@ -227,8 +208,7 @@ struct AudioPrivate
|
|||
float vol = bgm.getVolume(AudioStream::External);
|
||||
vol += fadeInStep;
|
||||
|
||||
if (vol >= 1)
|
||||
{
|
||||
if (vol >= 1){
|
||||
/* BGM fully faded in. -> MeNotPlaying */
|
||||
vol = 1.0f;
|
||||
meWatch.state = MeNotPlaying;
|
||||
|
|
@ -262,13 +242,11 @@ void Audio::bgmPlay(const char *filename,
|
|||
p->bgm.play(filename, (volume*p->bgm_volume)/100, pitch, pos);
|
||||
}
|
||||
|
||||
void Audio::bgmStop()
|
||||
{
|
||||
void Audio::bgmStop(){
|
||||
p->bgm.stop();
|
||||
}
|
||||
|
||||
void Audio::bgmFade(int time)
|
||||
{
|
||||
void Audio::bgmFade(int time){
|
||||
p->bgm.fadeOut(time);
|
||||
}
|
||||
|
||||
|
|
@ -282,13 +260,11 @@ void Audio::bgsPlay(const char *filename,
|
|||
p->bgs.play(filename, (volume*p->sfx_volume)/100, pitch, pos);
|
||||
}
|
||||
|
||||
void Audio::bgsStop()
|
||||
{
|
||||
void Audio::bgsStop(){
|
||||
p->bgs.stop();
|
||||
}
|
||||
|
||||
void Audio::bgsFade(int time)
|
||||
{
|
||||
void Audio::bgsFade(int time){
|
||||
p->bgs.fadeOut(time);
|
||||
}
|
||||
|
||||
|
|
@ -301,13 +277,11 @@ void Audio::mePlay(const char *filename,
|
|||
p->me.play(filename, (volume*p->bgm_volume)/100, pitch);
|
||||
}
|
||||
|
||||
void Audio::meStop()
|
||||
{
|
||||
void Audio::meStop(){
|
||||
p->me.stop();
|
||||
}
|
||||
|
||||
void Audio::meFade(int time)
|
||||
{
|
||||
void Audio::meFade(int time){
|
||||
p->me.fadeOut(time);
|
||||
}
|
||||
|
||||
|
|
@ -319,36 +293,30 @@ void Audio::sePlay(const char *filename,
|
|||
p->se.play(filename, (volume*p->sfx_volume)/100, pitch);
|
||||
}
|
||||
|
||||
void Audio::seStop()
|
||||
{
|
||||
void Audio::seStop(){
|
||||
p->se.stop();
|
||||
}
|
||||
|
||||
float Audio::bgmPos()
|
||||
{
|
||||
float Audio::bgmPos(){
|
||||
return p->bgm.playingOffset();
|
||||
}
|
||||
|
||||
float Audio::bgsPos()
|
||||
{
|
||||
float Audio::bgsPos(){
|
||||
return p->bgs.playingOffset();
|
||||
}
|
||||
|
||||
void Audio::reset()
|
||||
{
|
||||
void Audio::reset(){
|
||||
p->bgm.stop();
|
||||
p->bgs.stop();
|
||||
p->me.stop();
|
||||
p->se.stop();
|
||||
}
|
||||
|
||||
int Audio::getBGM_Volume() const
|
||||
{
|
||||
int Audio::getBGM_Volume() const{
|
||||
return p->bgm_volume;
|
||||
}
|
||||
|
||||
void Audio::setBGM_Volume(int value)
|
||||
{
|
||||
void Audio::setBGM_Volume(int value){
|
||||
if(value > 100){
|
||||
value = 100;
|
||||
}else if(value < 0){
|
||||
|
|
@ -363,13 +331,11 @@ void Audio::setBGM_Volume(int value)
|
|||
p->me.unlockStream();
|
||||
}
|
||||
|
||||
int Audio::getSFX_Volume() const
|
||||
{
|
||||
int Audio::getSFX_Volume() const{
|
||||
return p->sfx_volume;
|
||||
}
|
||||
|
||||
void Audio::setSFX_Volume(int value)
|
||||
{
|
||||
void Audio::setSFX_Volume(int value){
|
||||
if(value > 100){
|
||||
value = 100;
|
||||
}else if(value < 0){
|
||||
|
|
|
|||
21
src/main.cpp
21
src/main.cpp
|
|
@ -65,12 +65,11 @@ static inline const char* glGetStringInt(GLenum name){
|
|||
return (const char*) gl.GetString(name);
|
||||
}
|
||||
|
||||
static void
|
||||
printGLInfo(){
|
||||
Debug() << "GL Vendor :" << glGetStringInt(GL_VENDOR);
|
||||
Debug() << "GL Renderer :" << glGetStringInt(GL_RENDERER);
|
||||
Debug() << "GL Version :" << glGetStringInt(GL_VERSION);
|
||||
Debug() << "GLSL Version :" << glGetStringInt(GL_SHADING_LANGUAGE_VERSION);
|
||||
static void printGLInfo(){
|
||||
Debug() << "[main.cpp]GL Vendor :" << glGetStringInt(GL_VENDOR);
|
||||
Debug() << "[main.cpp]GL Renderer :" << glGetStringInt(GL_RENDERER);
|
||||
Debug() << "[main.cpp]GL Version :" << glGetStringInt(GL_VERSION);
|
||||
Debug() << "[main.cpp]GLSL Version :" << glGetStringInt(GL_SHADING_LANGUAGE_VERSION);
|
||||
}
|
||||
|
||||
int rgssThreadFun(void *userdata){
|
||||
|
|
@ -89,7 +88,7 @@ int rgssThreadFun(void *userdata){
|
|||
glCtx = SDL_GL_CreateContext(win);
|
||||
|
||||
if (!glCtx){
|
||||
rgssThreadError(threadData, std::string("Error creating context: ") + SDL_GetError());
|
||||
rgssThreadError(threadData, std::string("[rgssThreadFun]Error creating context: ") + SDL_GetError());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -123,7 +122,7 @@ int rgssThreadFun(void *userdata){
|
|||
ALCcontext *alcCtx = alcCreateContext(threadData->alcDev, 0);
|
||||
|
||||
if (!alcCtx){
|
||||
rgssThreadError(threadData, "Error creating OpenAL context");
|
||||
rgssThreadError(threadData, "[rgssThreadFun]Error creating OpenAL context");
|
||||
SDL_GL_DestroyContext(glCtx);
|
||||
|
||||
return 0;
|
||||
|
|
@ -376,7 +375,7 @@ int main(int argc, char *argv[]){
|
|||
for (int i = 0; i < 1000; ++i){
|
||||
/* We can stop waiting when the request was ack'd */
|
||||
if (rtData.rqTermAck){
|
||||
Debug() << "RGSS thread ack'd request after" << i*10 << "ms";
|
||||
Debug() << "[main]RGSS thread ack'd request after" << i*10 << "ms";
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -389,7 +388,7 @@ int main(int argc, char *argv[]){
|
|||
if (rtData.rqTermAck)
|
||||
SDL_WaitThread(rgssThread, 0);
|
||||
else
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, conf.windowTitle.c_str(), "The RGSS script seems to be stuck and OneShot: sunshine will now force quit", win);
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, conf.windowTitle.c_str(), "The RGSS script seems to be stuck and OneShot will now force quit", win);
|
||||
|
||||
if (!rtData.rgssErrorMsg.empty()){
|
||||
Debug() << rtData.rgssErrorMsg;
|
||||
|
|
@ -400,7 +399,7 @@ int main(int argc, char *argv[]){
|
|||
/* Clean up any remainin events */
|
||||
eventThread.cleanup();
|
||||
|
||||
Debug() << "Shutting down.";
|
||||
Debug() << "[main]Shutting down.";
|
||||
|
||||
unloadLocale();
|
||||
unloadLanguageMetadata();
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@
|
|||
#include <gdk/gdk.h>
|
||||
#include "xdg-user-dir-lookup.h"
|
||||
#endif
|
||||
#elif defined __FreeBSD__ || __NetBSD__ || __OpenBSD__
|
||||
#error "Work in progress:3"
|
||||
#else
|
||||
#error "Operating system not detected."
|
||||
#endif
|
||||
|
|
@ -481,8 +483,7 @@ bool Oneshot::msgbox(int type, const char *body, const char *title){
|
|||
#endif
|
||||
|
||||
//Set type
|
||||
switch (type)
|
||||
{
|
||||
switch (type){
|
||||
case MSG_INFO:
|
||||
case MSG_YESNO:
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -192,8 +192,7 @@ struct WindowPrivate {
|
|||
|
||||
Quad baseTexQuad;
|
||||
|
||||
struct WindowControls : public ViewportElement
|
||||
{
|
||||
struct WindowControls : public ViewportElement{
|
||||
WindowPrivate *p;
|
||||
|
||||
WindowControls(WindowPrivate *p,
|
||||
|
|
|
|||
Loading…
Reference in a new issue