mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-19 21:39:57 +00:00
meow x2
This commit is contained in:
parent
e5714fbb75
commit
07b89ef555
28 changed files with 78 additions and 177 deletions
|
|
@ -162,6 +162,5 @@ void audioBindingInit(){
|
|||
_rb_define_module_function(module, "__reset__", audioReset);
|
||||
|
||||
INIT_AUD_PROP_BIND( BGM_Volume, "bgm_volume" );
|
||||
INIT_AUD_PROP_BIND( SFX_Volume, "sfx_volume" );
|
||||
printf("[audioBindingInit] Done\n");
|
||||
INIT_AUD_PROP_BIND( SFX_Volume, "sfx_volume" );es
|
||||
}
|
||||
|
|
|
|||
|
|
@ -421,5 +421,4 @@ void bitmapBindingInit(){
|
|||
}
|
||||
|
||||
INIT_PROP_BIND(Bitmap, Font, "font");
|
||||
printf("[bitmapBindingInit] Done\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -217,5 +217,4 @@ void etcBindingInit(){
|
|||
RB_ATTR_RW(Rect, Width, width);
|
||||
RB_ATTR_RW(Rect, Height, height);
|
||||
_rb_define_method(klass, "empty", rectEmpty);
|
||||
printf("[bitmapBindingInit] Done\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -220,5 +220,4 @@ 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");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,8 +27,7 @@
|
|||
#include "binding-types.h"
|
||||
|
||||
template<class C>
|
||||
RB_METHOD(flashableFlash)
|
||||
{
|
||||
RB_METHOD(flashableFlash){
|
||||
Flashable *f = getPrivateData<C>(self);
|
||||
|
||||
VALUE colorObj;
|
||||
|
|
@ -38,8 +37,7 @@ RB_METHOD(flashableFlash)
|
|||
|
||||
rb_get_args(argc, argv, "oi", &colorObj, &duration RB_ARG_END);
|
||||
|
||||
if (NIL_P(colorObj))
|
||||
{
|
||||
if (NIL_P(colorObj)){
|
||||
f->flash(0, duration);
|
||||
return Qnil;
|
||||
}
|
||||
|
|
@ -52,8 +50,7 @@ RB_METHOD(flashableFlash)
|
|||
}
|
||||
|
||||
template<class C>
|
||||
RB_METHOD(flashableUpdate)
|
||||
{
|
||||
RB_METHOD(flashableUpdate){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
Flashable *f = getPrivateData<C>(self);
|
||||
|
|
@ -64,10 +61,10 @@ RB_METHOD(flashableUpdate)
|
|||
}
|
||||
|
||||
template<class C>
|
||||
static void flashableBindingInit(VALUE klass)
|
||||
{
|
||||
static void flashableBindingInit(VALUE klass){
|
||||
_rb_define_method(klass, "flash", flashableFlash<C>);
|
||||
_rb_define_method(klass, "update", flashableUpdate<C>);
|
||||
}
|
||||
|
||||
#endif // FLASHABLEBINDING_H
|
||||
|
||||
|
|
|
|||
|
|
@ -71,13 +71,11 @@ RB_METHOD(fontInitialize){
|
|||
|
||||
Font *f;
|
||||
|
||||
if (NIL_P(namesObj))
|
||||
{
|
||||
if (NIL_P(namesObj)){
|
||||
namesObj = rb_iv_get(rb_obj_class(self), "default_name");
|
||||
f = new Font(0, size);
|
||||
}
|
||||
else
|
||||
{
|
||||
else{
|
||||
std::vector<std::string> names;
|
||||
collectStrings(namesObj, names);
|
||||
|
||||
|
|
@ -302,5 +300,4 @@ void fontBindingInit(){
|
|||
INIT_PROP_BIND(Font, Outline, "outline");
|
||||
INIT_PROP_BIND(Font, OutColor, "out_color");
|
||||
}
|
||||
printf("[fontBindingInit] Done\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -229,5 +229,4 @@ 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");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -159,12 +159,10 @@ void inputBindingInit(){
|
|||
|
||||
_rb_define_module_function(module, "quit?", inputQuit);
|
||||
|
||||
if (rgssVer >= 3)
|
||||
{
|
||||
if (rgssVer >= 3){
|
||||
VALUE symHash = rb_hash_new();
|
||||
|
||||
for (size_t i = 0; i < buttonCodesN; ++i)
|
||||
{
|
||||
for (size_t i = 0; i < buttonCodesN; ++i){
|
||||
ID sym = rb_intern(buttonCodes[i].str);
|
||||
VALUE val = INT2FIX(buttonCodes[i].val);
|
||||
|
||||
|
|
@ -176,16 +174,12 @@ void inputBindingInit(){
|
|||
|
||||
rb_iv_set(module, "buttoncodes", symHash);
|
||||
getRbData()->buttoncodeHash = symHash;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t i = 0; i < buttonCodesN; ++i)
|
||||
{
|
||||
}else{
|
||||
for (size_t i = 0; i < buttonCodesN; ++i){
|
||||
ID sym = rb_intern(buttonCodes[i].str);
|
||||
VALUE val = INT2FIX(buttonCodes[i].val);
|
||||
|
||||
rb_const_set(module, sym, val);
|
||||
}
|
||||
}
|
||||
printf("[inputBindingInit] Done\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -174,5 +174,4 @@ 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");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,11 +79,9 @@ int niko_server_thread(void *data){
|
|||
out_pipe = open(NIKO_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() << "[niko_server_thread]Failed to write to pipe!";
|
||||
if (message_len > 0){
|
||||
if (write(out_pipe, (char*)message_buffer, message_len) == -1){
|
||||
Debug() << "[niko_server_thread] Failed to write to pipe!";
|
||||
}
|
||||
}
|
||||
SDL_UnlockMutex(mutex);
|
||||
|
|
@ -210,5 +208,4 @@ void nikoBindingInit(){
|
|||
//Functions
|
||||
_rb_define_module_function(module, "get_ready", nikoPrepare);
|
||||
_rb_define_module_function(module, "do_your_thing", nikoStart);
|
||||
printf("[nikoBindingInit] Done\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,5 +123,4 @@ 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");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,5 +75,4 @@ void planeBindingInit(){
|
|||
INIT_PROP_BIND( Plane, BlendType, "blend_type" );
|
||||
INIT_PROP_BIND( Plane, Color, "color" );
|
||||
INIT_PROP_BIND( Plane, Tone, "tone" );
|
||||
printf("[planeBindingInit] Done\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,8 +26,7 @@
|
|||
#include "binding-util.h"
|
||||
|
||||
template<class C>
|
||||
RB_METHOD(sceneElementGetZ)
|
||||
{
|
||||
RB_METHOD(sceneElementGetZ){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
SceneElement *se = getPrivateData<C>(self);
|
||||
|
|
@ -39,8 +38,7 @@ RB_METHOD(sceneElementGetZ)
|
|||
}
|
||||
|
||||
template<class C>
|
||||
RB_METHOD(sceneElementSetZ)
|
||||
{
|
||||
RB_METHOD(sceneElementSetZ){
|
||||
SceneElement *se = getPrivateData<C>(self);
|
||||
|
||||
int z;
|
||||
|
|
@ -52,8 +50,7 @@ RB_METHOD(sceneElementSetZ)
|
|||
}
|
||||
|
||||
template<class C>
|
||||
RB_METHOD(sceneElementGetVisible)
|
||||
{
|
||||
RB_METHOD(sceneElementGetVisible){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
SceneElement *se = getPrivateData<C>(self);
|
||||
|
|
@ -65,8 +62,7 @@ RB_METHOD(sceneElementGetVisible)
|
|||
}
|
||||
|
||||
template<class C>
|
||||
RB_METHOD(sceneElementSetVisible)
|
||||
{
|
||||
RB_METHOD(sceneElementSetVisible){
|
||||
SceneElement *se = getPrivateData<C>(self);
|
||||
|
||||
bool visible;
|
||||
|
|
@ -79,8 +75,7 @@ RB_METHOD(sceneElementSetVisible)
|
|||
|
||||
template<class C>
|
||||
void
|
||||
sceneElementBindingInit(VALUE klass)
|
||||
{
|
||||
sceneElementBindingInit(VALUE klass){
|
||||
_rb_define_method(klass, "z", sceneElementGetZ<C>);
|
||||
_rb_define_method(klass, "z=", sceneElementSetZ<C>);
|
||||
_rb_define_method(klass, "visible", sceneElementGetVisible<C>);
|
||||
|
|
|
|||
|
|
@ -76,5 +76,4 @@ void screenBindingInit(){
|
|||
_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");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
|
||||
template<class C>
|
||||
static VALUE
|
||||
serializableDump(int, VALUE *, VALUE self)
|
||||
{
|
||||
serializableDump(int, VALUE *, VALUE self){
|
||||
Serializable *s = getPrivateData<C>(self);
|
||||
|
||||
int dataSize = s->serialSize();
|
||||
|
|
@ -43,8 +42,7 @@ serializableDump(int, VALUE *, VALUE self)
|
|||
|
||||
template<class C>
|
||||
void
|
||||
serializableBindingInit(VALUE klass)
|
||||
{
|
||||
serializableBindingInit(VALUE klass){
|
||||
_rb_define_method(klass, "_dump", serializableDump<C>);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -131,5 +131,4 @@ void spriteBindingInit(){
|
|||
INIT_PROP_BIND( Sprite, WaveSpeed, "wave_speed" );
|
||||
INIT_PROP_BIND( Sprite, WavePhase, "wave_phase" );
|
||||
}
|
||||
printf("[spriteBindingInit] Done\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,5 +75,4 @@ 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");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,5 +21,4 @@ void SunshineBindingInit(){
|
|||
if (!rb_respond_to(rb_cString, rb_intern("clone"))) {
|
||||
rb_define_method(rb_cString, "clone", RUBY_METHOD_FUNC(string_clone), 0);
|
||||
}
|
||||
printf("[SunshineBindingInit] Done\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,8 +32,7 @@ static int num2TableSize(VALUE v){
|
|||
static void parseArgsTableSizes(int argc, VALUE *argv, int *x, int *y, int *z){
|
||||
*y = *z = 1;
|
||||
|
||||
switch (argc)
|
||||
{
|
||||
switch (argc){
|
||||
case 3:
|
||||
*z = num2TableSize(argv[2]);
|
||||
/* fall through */
|
||||
|
|
@ -102,8 +101,7 @@ RB_METHOD(tableGetAt){
|
|||
|
||||
if (x < 0 || x >= t->xSize()
|
||||
|| y < 0 || y >= t->ySize()
|
||||
|| z < 0 || z >= t->zSize())
|
||||
{
|
||||
|| z < 0 || z >= t->zSize()){
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
|
|
@ -121,8 +119,7 @@ RB_METHOD(tableSetAt){
|
|||
if (argc < 2)
|
||||
rb_raise(rb_eArgError, "wrong number of arguments");
|
||||
|
||||
switch (argc)
|
||||
{
|
||||
switch (argc){
|
||||
default:
|
||||
case 2 :
|
||||
x = NUM2INT(argv[0]);
|
||||
|
|
@ -169,5 +166,4 @@ void tableBindingInit(){
|
|||
_rb_define_method(klass, "zsize", tableZSize);
|
||||
_rb_define_method(klass, "[]", tableGetAt);
|
||||
_rb_define_method(klass, "[]=", tableSetAt);
|
||||
printf("[tableBindingInit] Done\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -162,5 +162,4 @@ void tilemapBindingInit(){
|
|||
INIT_PROP_BIND( Tilemap, Wrapping, "wrapping" );
|
||||
INIT_PROP_BIND( Tilemap, OX, "ox" );
|
||||
INIT_PROP_BIND( Tilemap, OY, "oy" );
|
||||
printf("[tilemapBindingInit] Done\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,5 +18,4 @@ void TimeBindingInit() {
|
|||
VALUE m = rb_define_module("CTime");
|
||||
rb_define_module_function(m, "month", get_month, 0);
|
||||
rb_define_module_function(m, "day", get_day, 0);
|
||||
printf("[TimeBindingInit] Done\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,6 +95,5 @@ void viewportBindingInit(){
|
|||
INIT_PROP_BIND( Viewport, OY, "oy" );
|
||||
INIT_PROP_BIND( Viewport, Color, "color" );
|
||||
INIT_PROP_BIND( Viewport, Tone, "tone" );
|
||||
printf("[viewportBindingInit] Done\n");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@
|
|||
static std::map<std::string, bool> defBlurs;
|
||||
// Fallback settings
|
||||
static std::string fallbackPath;
|
||||
//meow
|
||||
//For Standalone Window managwrs desktops
|
||||
bool IsNitrogen = false;
|
||||
bool IsFeh = false;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -94,5 +94,4 @@ 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");
|
||||
}
|
||||
|
|
|
|||
14
oneshot.conf
14
oneshot.conf
|
|
@ -9,14 +9,6 @@
|
|||
# relative to gameFolder and ignoring both RTPs and
|
||||
# encrypted archives.
|
||||
|
||||
# Continuously print average FPS to console.
|
||||
# This setting does not affect the window title
|
||||
# FPS display toggled via F2
|
||||
# (default: disabled)
|
||||
#
|
||||
# printFPS=false
|
||||
|
||||
|
||||
# Start game in fullscreen mode,
|
||||
# i.e. Big Picture/console mode.
|
||||
# (default: disabled)
|
||||
|
|
@ -35,13 +27,13 @@
|
|||
# is upscaled
|
||||
# (default: disabled)
|
||||
#
|
||||
smoothScaling=false
|
||||
# smoothScaling=false
|
||||
|
||||
|
||||
# Sync screen redraws to the monitor refresh rate
|
||||
# (default: enabled)
|
||||
#
|
||||
vsync=true
|
||||
# vsync=true
|
||||
|
||||
# Enforce a static frame rate
|
||||
# (0 = disabled)
|
||||
|
|
@ -131,7 +123,7 @@ vsync=true
|
|||
# (emulates windows case insensitivity)
|
||||
# (default: enabled)
|
||||
#
|
||||
pathCache=true
|
||||
# pathCache=true
|
||||
|
||||
|
||||
# Add 'rtp1', 'rtp2.zip' and 'game.rgssad' to the
|
||||
|
|
|
|||
|
|
@ -54,8 +54,7 @@ static std::string prefPath(const char *org, const char *app){
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
std::set<T> setFromVec(const std::vector<T> &vec)
|
||||
{
|
||||
std::set<T> setFromVec(const std::vector<T> &vec){
|
||||
return std::set<T>(vec.begin(), vec.end());
|
||||
}
|
||||
|
||||
|
|
@ -74,7 +73,7 @@ void Config::read(int argc, char *argv[]){
|
|||
PO_DESC(printFPS, bool, false) \
|
||||
PO_DESC(fullscreen, bool, false) \
|
||||
PO_DESC(fixedAspectRatio, bool, true) \
|
||||
PO_DESC(smoothScaling, bool, true) \
|
||||
PO_DESC(smoothScaling, bool, false) \
|
||||
PO_DESC(vsync, bool, true) \
|
||||
PO_DESC(defScreenW, int, 0) \
|
||||
PO_DESC(defScreenH, int, 0) \
|
||||
|
|
|
|||
|
|
@ -26,8 +26,7 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
|
||||
struct Config
|
||||
{
|
||||
struct Config{
|
||||
int rgssVersion;
|
||||
|
||||
bool debugMode;
|
||||
|
|
@ -59,8 +58,7 @@ struct Config
|
|||
|
||||
std::string iconPath;
|
||||
|
||||
struct
|
||||
{
|
||||
struct{
|
||||
int sourceCount;
|
||||
} SE;
|
||||
|
||||
|
|
|
|||
|
|
@ -51,16 +51,13 @@ typedef void (ALC_APIENTRY *LPALCDEVICERESUMESOFT) (ALCdevice *device);
|
|||
AL_FUN(DevicePause, LPALCDEVICEPAUSESOFT) \
|
||||
AL_FUN(DeviceResume, LPALCDEVICERESUMESOFT)
|
||||
|
||||
struct ALCFunctions
|
||||
{
|
||||
struct ALCFunctions{
|
||||
#define AL_FUN(name, type) type name;
|
||||
AL_DEVICE_PAUSE_FUN
|
||||
#undef AL_FUN
|
||||
} static alc;
|
||||
|
||||
static void
|
||||
initALCFunctions(ALCdevice *alcDev)
|
||||
{
|
||||
static void initALCFunctions(ALCdevice *alcDev){
|
||||
if (!strstr(alcGetString(alcDev, ALC_EXTENSIONS), "ALC_SOFT_pause_device"))
|
||||
return;
|
||||
|
||||
|
|
@ -80,8 +77,7 @@ EventThread::MouseState EventThread::mouseState;
|
|||
EventThread::TouchState EventThread::touchState;
|
||||
|
||||
/* User event codes */
|
||||
enum
|
||||
{
|
||||
enum{
|
||||
REQUEST_SETFULLSCREEN = 0,
|
||||
REQUEST_WINRESIZE,
|
||||
REQUEST_MESSAGEBOX,
|
||||
|
|
@ -95,8 +91,7 @@ enum
|
|||
|
||||
static uint32_t usrIdStart;
|
||||
|
||||
bool EventThread::allocUserEvents()
|
||||
{
|
||||
bool EventThread::allocUserEvents(){
|
||||
usrIdStart = SDL_RegisterEvents(EVENT_COUNT);
|
||||
// SDL_RegisterEvents() now returns 0 if it couldn't allocate any user events.
|
||||
if (usrIdStart == (uint32_t) 0)
|
||||
|
|
@ -110,8 +105,7 @@ EventThread::EventThread()
|
|||
showCursor(true)
|
||||
{}
|
||||
|
||||
void EventThread::process(RGSSThreadData &rtData)
|
||||
{
|
||||
void EventThread::process(RGSSThreadData &rtData){
|
||||
SDL_Event event;
|
||||
SDL_Window *win = rtData.window;
|
||||
UnidirMessage<Vec2i> &windowSizeMsg = rtData.windowSizeMsg;
|
||||
|
|
@ -182,18 +176,14 @@ void EventThread::process(RGSSThreadData &rtData)
|
|||
|
||||
SettingsMenu *sMenu = 0;
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (!SDL_WaitEvent(&event))
|
||||
{
|
||||
while (true){
|
||||
if (!SDL_WaitEvent(&event)){
|
||||
Debug() << "EventThread: Event error";
|
||||
break;
|
||||
}
|
||||
|
||||
if (sMenu && sMenu->onEvent(event, joysticks))
|
||||
{
|
||||
if (sMenu->destroyReq())
|
||||
{
|
||||
if (sMenu && sMenu->onEvent(event, joysticks)){
|
||||
if (sMenu->destroyReq()){
|
||||
delete sMenu;
|
||||
sMenu = 0;
|
||||
|
||||
|
|
@ -204,8 +194,7 @@ void EventThread::process(RGSSThreadData &rtData)
|
|||
}
|
||||
|
||||
/* Preselect and discard unwanted events here */
|
||||
switch (event.type)
|
||||
{
|
||||
switch (event.type){
|
||||
case SDL_EVENT_MOUSE_BUTTON_DOWN :
|
||||
case SDL_EVENT_MOUSE_BUTTON_UP :
|
||||
case SDL_EVENT_MOUSE_MOTION :
|
||||
|
|
@ -280,8 +269,7 @@ void EventThread::process(RGSSThreadData &rtData)
|
|||
|
||||
|
||||
/* Now process the rest */
|
||||
switch (event.type)
|
||||
{
|
||||
switch (event.type){
|
||||
case SDL_EVENT_QUIT :
|
||||
if (rtData.allowExit) {
|
||||
terminate = true;
|
||||
|
|
@ -297,10 +285,8 @@ void EventThread::process(RGSSThreadData &rtData)
|
|||
break;
|
||||
|
||||
case SDL_EVENT_KEY_DOWN :
|
||||
if (event.key.scancode == SDL_SCANCODE_F1)
|
||||
{
|
||||
if (!sMenu)
|
||||
{
|
||||
if (event.key.scancode == SDL_SCANCODE_F1){
|
||||
if (!sMenu){
|
||||
sMenu = new SettingsMenu(rtData);
|
||||
updateCursorState(false, gameScreen);
|
||||
}
|
||||
|
|
@ -308,23 +294,18 @@ void EventThread::process(RGSSThreadData &rtData)
|
|||
sMenu->raise();
|
||||
}
|
||||
|
||||
if (event.key.scancode == SDL_SCANCODE_F2)
|
||||
{
|
||||
if (!displayingFPS)
|
||||
{
|
||||
if (event.key.scancode == SDL_SCANCODE_F2){
|
||||
if (!displayingFPS){
|
||||
fps.immInitFlag.set();
|
||||
fps.sendUpdates.set();
|
||||
displayingFPS = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
}else{
|
||||
displayingFPS = false;
|
||||
|
||||
if (!rtData.config.printFPS)
|
||||
fps.sendUpdates.clear();
|
||||
|
||||
if (fullscreen)
|
||||
{
|
||||
if (fullscreen){
|
||||
/* Prevent fullscreen flicker */
|
||||
strncpy(pendingTitle, rtData.config.windowTitle.c_str(),
|
||||
sizeof(pendingTitle));
|
||||
|
|
@ -337,8 +318,7 @@ void EventThread::process(RGSSThreadData &rtData)
|
|||
break;
|
||||
}
|
||||
|
||||
if (event.key.scancode == SDL_SCANCODE_F12)
|
||||
{
|
||||
if (event.key.scancode == SDL_SCANCODE_F12){
|
||||
if (!rtData.config.debugMode)
|
||||
break;
|
||||
|
||||
|
|
@ -364,8 +344,7 @@ void EventThread::process(RGSSThreadData &rtData)
|
|||
break;
|
||||
|
||||
case SDL_EVENT_KEY_UP :
|
||||
if (event.key.scancode == SDL_SCANCODE_F12)
|
||||
{
|
||||
if (event.key.scancode == SDL_SCANCODE_F12){
|
||||
if (!rtData.config.debugMode)
|
||||
break;
|
||||
|
||||
|
|
@ -504,8 +483,7 @@ void EventThread::process(RGSSThreadData &rtData)
|
|||
|
||||
/* Updating the window title in fullscreen
|
||||
* mode seems to cause flickering */
|
||||
if (fullscreen)
|
||||
{
|
||||
if (fullscreen){
|
||||
strncpy(pendingTitle, buffer, sizeof(pendingTitle));
|
||||
break;
|
||||
}
|
||||
|
|
@ -539,12 +517,10 @@ void EventThread::process(RGSSThreadData &rtData)
|
|||
delete sMenu;
|
||||
}
|
||||
|
||||
bool EventThread::eventFilter(void *data, SDL_Event *event)
|
||||
{
|
||||
bool EventThread::eventFilter(void *data, SDL_Event *event){
|
||||
RGSSThreadData &rtData = *static_cast<RGSSThreadData*>(data);
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
switch (event->type){
|
||||
case SDL_EVENT_WILL_ENTER_BACKGROUND :
|
||||
Debug() << "SDL_EVENT_WILL_ENTER_BACKGROUND";
|
||||
|
||||
|
|
@ -583,10 +559,8 @@ bool EventThread::eventFilter(void *data, SDL_Event *event)
|
|||
|
||||
/* Workaround for Windows pausing on drag */
|
||||
default:
|
||||
if (event->window.type == SDL_EVENT_WINDOW_MOVED)
|
||||
{
|
||||
if (shState != NULL && shState->rgssVersion > 0)
|
||||
{
|
||||
if (event->window.type == SDL_EVENT_WINDOW_MOVED){
|
||||
if (shState != NULL && shState->rgssVersion > 0){
|
||||
shState->oneshot().setWindowPos(event->window.data1, event->window.data2);
|
||||
shState->graphics().update(false);
|
||||
}
|
||||
|
|
@ -629,15 +603,13 @@ void EventThread::updateCursorState(bool inWindow, const SDL_Rect &screen){
|
|||
SDL_HideCursor();
|
||||
}
|
||||
|
||||
void EventThread::requestTerminate()
|
||||
{
|
||||
void EventThread::requestTerminate(){
|
||||
SDL_Event event;
|
||||
event.type = SDL_EVENT_QUIT;
|
||||
SDL_PushEvent(&event);
|
||||
}
|
||||
|
||||
void EventThread::requestFullscreenMode(bool mode)
|
||||
{
|
||||
void EventThread::requestFullscreenMode(bool mode){
|
||||
if (mode == fullscreen)
|
||||
return;
|
||||
|
||||
|
|
@ -647,8 +619,7 @@ void EventThread::requestFullscreenMode(bool mode)
|
|||
SDL_PushEvent(&event);
|
||||
}
|
||||
|
||||
void EventThread::requestWindowResize(int width, int height)
|
||||
{
|
||||
void EventThread::requestWindowResize(int width, int height){
|
||||
SDL_Event event;
|
||||
event.type = usrIdStart + REQUEST_WINRESIZE;
|
||||
event.window.data1 = width;
|
||||
|
|
@ -656,16 +627,14 @@ void EventThread::requestWindowResize(int width, int height)
|
|||
SDL_PushEvent(&event);
|
||||
}
|
||||
|
||||
void EventThread::requestShowCursor(bool mode)
|
||||
{
|
||||
void EventThread::requestShowCursor(bool mode){
|
||||
SDL_Event event;
|
||||
event.type = usrIdStart + REQUEST_SETCURSORVISIBLE;
|
||||
event.user.code = mode;
|
||||
SDL_PushEvent(&event);
|
||||
}
|
||||
|
||||
void EventThread::showMessageBox(const char *body, int flags)
|
||||
{
|
||||
void EventThread::showMessageBox(const char *body, int flags){
|
||||
msgBoxDone.clear();
|
||||
|
||||
SDL_Event event;
|
||||
|
|
@ -680,18 +649,15 @@ void EventThread::showMessageBox(const char *body, int flags)
|
|||
resetInputStates();
|
||||
}
|
||||
|
||||
bool EventThread::getFullscreen() const
|
||||
{
|
||||
bool EventThread::getFullscreen() const{
|
||||
return fullscreen;
|
||||
}
|
||||
|
||||
bool EventThread::getShowCursor() const
|
||||
{
|
||||
bool EventThread::getShowCursor() const{
|
||||
return showCursor;
|
||||
}
|
||||
|
||||
void EventThread::notifyFrame()
|
||||
{
|
||||
void EventThread::notifyFrame(){
|
||||
if (!fps.sendUpdates)
|
||||
return;
|
||||
|
||||
|
|
@ -699,8 +665,7 @@ void EventThread::notifyFrame()
|
|||
uint64_t diff = current - fps.lastFrame;
|
||||
fps.lastFrame = current;
|
||||
|
||||
if (fps.immInitFlag)
|
||||
{
|
||||
if (fps.immInitFlag){
|
||||
fps.immInitFlag.clear();
|
||||
fps.immFiniFlag.set();
|
||||
|
||||
|
|
@ -729,8 +694,7 @@ void EventThread::notifyFrame()
|
|||
SDL_PushEvent(&event);
|
||||
}
|
||||
|
||||
void EventThread::notifyGameScreenChange(const SDL_Rect &screen)
|
||||
{
|
||||
void EventThread::notifyGameScreenChange(const SDL_Rect &screen){
|
||||
/* We have to get a bit hacky here to fit the rectangle
|
||||
* data into the user event struct */
|
||||
SDL_Event event;
|
||||
|
|
@ -742,8 +706,7 @@ void EventThread::notifyGameScreenChange(const SDL_Rect &screen)
|
|||
SDL_PushEvent(&event);
|
||||
}
|
||||
|
||||
void SyncPoint::haltThreads()
|
||||
{
|
||||
void SyncPoint::haltThreads(){
|
||||
if (mainSync.locked)
|
||||
return;
|
||||
|
||||
|
|
@ -761,8 +724,7 @@ void SyncPoint::haltThreads()
|
|||
secondSync.lock();
|
||||
}
|
||||
|
||||
void SyncPoint::resumeThreads()
|
||||
{
|
||||
void SyncPoint::resumeThreads(){
|
||||
if (!mainSync.locked)
|
||||
return;
|
||||
|
||||
|
|
@ -770,44 +732,37 @@ void SyncPoint::resumeThreads()
|
|||
secondSync.unlock(true);
|
||||
}
|
||||
|
||||
bool SyncPoint::mainSyncLocked()
|
||||
{
|
||||
bool SyncPoint::mainSyncLocked(){
|
||||
return mainSync.locked;
|
||||
}
|
||||
|
||||
void SyncPoint::waitMainSync()
|
||||
{
|
||||
void SyncPoint::waitMainSync(){
|
||||
reply.unlock(false);
|
||||
mainSync.waitForUnlock();
|
||||
}
|
||||
|
||||
void SyncPoint::passSecondarySync()
|
||||
{
|
||||
void SyncPoint::passSecondarySync(){
|
||||
if (!secondSync.locked)
|
||||
return;
|
||||
|
||||
secondSync.waitForUnlock();
|
||||
}
|
||||
|
||||
SyncPoint::Util::Util()
|
||||
{
|
||||
SyncPoint::Util::Util(){
|
||||
mut = SDL_CreateMutex();
|
||||
cond = SDL_CreateCondition();
|
||||
}
|
||||
|
||||
SyncPoint::Util::~Util()
|
||||
{
|
||||
SyncPoint::Util::~Util(){
|
||||
SDL_DestroyCondition(cond);
|
||||
SDL_DestroyMutex(mut);
|
||||
}
|
||||
|
||||
void SyncPoint::Util::lock()
|
||||
{
|
||||
void SyncPoint::Util::lock(){
|
||||
locked.set();
|
||||
}
|
||||
|
||||
void SyncPoint::Util::unlock(bool multi)
|
||||
{
|
||||
void SyncPoint::Util::unlock(bool multi){
|
||||
locked.clear();
|
||||
|
||||
if (multi)
|
||||
|
|
@ -816,8 +771,7 @@ void SyncPoint::Util::unlock(bool multi)
|
|||
SDL_SignalCondition(cond);
|
||||
}
|
||||
|
||||
void SyncPoint::Util::waitForUnlock()
|
||||
{
|
||||
void SyncPoint::Util::waitForUnlock(){
|
||||
SDL_LockMutex(mut);
|
||||
|
||||
while (locked)
|
||||
|
|
|
|||
Loading…
Reference in a new issue