Compare commits

..

2 Commits

Author SHA1 Message Date
Jonas Kulla 58b304ae2e HSV shift 2016-10-04 16:13:27 +02:00
Jonas Kulla 89bb3e85fd RGB rotation 2016-10-04 15:16:57 +02:00
161 changed files with 294 additions and 699 deletions

View File

@ -1,5 +0,0 @@
root=true
[*]
end_of_line = lf
indent_style = tab
indent_size = 4

View File

@ -110,7 +110,6 @@ set(MAIN_HEADERS
src/flashable.h src/flashable.h
src/font.h src/font.h
src/input.h src/input.h
src/iniconfig.h
src/plane.h src/plane.h
src/scene.h src/scene.h
src/sprite.h src/sprite.h
@ -168,7 +167,6 @@ set(MAIN_SOURCE
src/filesystem.cpp src/filesystem.cpp
src/font.cpp src/font.cpp
src/input.cpp src/input.cpp
src/iniconfig.cpp
src/plane.cpp src/plane.cpp
src/scene.cpp src/scene.cpp
src/sprite.cpp src/sprite.cpp
@ -207,11 +205,6 @@ set(MAIN_SOURCE
src/fluid-fun.cpp src/fluid-fun.cpp
) )
if(WIN32)
list(APPEND MAIN_HEADERS windows/resource.h)
list(APPEND MAIN_SOURCE windows/resource.rc)
endif()
source_group("MKXP Source" FILES ${MAIN_SOURCE} ${MAIN_HEADERS}) source_group("MKXP Source" FILES ${MAIN_SOURCE} ${MAIN_HEADERS})
## Setup embedded source ## ## Setup embedded source ##
@ -412,12 +405,10 @@ target_compile_definitions(${PROJECT_NAME} PRIVATE
) )
target_include_directories(${PROJECT_NAME} PRIVATE target_include_directories(${PROJECT_NAME} PRIVATE
src src
windows
${SIGCXX_INCLUDE_DIRS} ${SIGCXX_INCLUDE_DIRS}
${PIXMAN_INCLUDE_DIRS} ${PIXMAN_INCLUDE_DIRS}
${PHYSFS_INCLUDE_DIRS} ${PHYSFS_INCLUDE_DIRS}
${SDL2_INCLUDE_DIRS} # Blindly assume other SDL bits are in same directory ${SDL2_INCLUDE_DIRS} # Blindly assume other SDL bits are in same directory
${SDL_SOUND_INCLUDE_DIRS}
${Boost_INCLUDE_DIR} ${Boost_INCLUDE_DIR}
${MRI_INCLUDE_DIRS} ${MRI_INCLUDE_DIRS}
${VORBISFILE_INCLUDE_DIRS} ${VORBISFILE_INCLUDE_DIRS}

View File

@ -1,19 +1,13 @@
# mkxp # mkxp
Discord community: https://discord.gg/A8xHE8P
Matrix space: https://matrix.to/#/#rpgmaker:mapleshrine.eu
Further links: https://mapleshrine.eu
mkxp is a project that seeks to provide a fully open source implementation of the Ruby Game Scripting System (RGSS) interface used in the popular game creation software "RPG Maker XP", "RPG Maker VX" and "RPG Maker VX Ace" (trademark by Enterbrain, Inc.), with focus on Linux. The goal is to be able to run games created with the above software natively without changing a single file. mkxp is a project that seeks to provide a fully open source implementation of the Ruby Game Scripting System (RGSS) interface used in the popular game creation software "RPG Maker XP", "RPG Maker VX" and "RPG Maker VX Ace" (trademark by Enterbrain, Inc.), with focus on Linux. The goal is to be able to run games created with the above software natively without changing a single file.
It is licensed under the GNU General Public License v2+. It is licensed under the GNU General Public License v2+.
## Prebuilt binaries ## Prebuilt binaries
[**Linux / Windows**](https://www.mapleshrine.eu/releases/) [**Linux (32bit/64bit)**](http://ancurio.bplaced.net/mkxp/generic/)
[**OSX**](https://app.box.com/mkxpmacbuilds) by Ali [**OSX**](https://app.box.com/mkxpmacbuilds) by Ali
[**Windows (mingw-w64 32bit)**](http://ancurio.bplaced.net/mkxp/mingw32/)
## Should I use mkxp
mkxp primarily targets technically versed users that are comfortable with Ruby / RGSS, and ideally know how to compile the project themselves. The reason for this is that for most games, due to Win32-API usage, mkxp is simply not a plug-and-play solution, but a building block with which a fully cross-platform version can be created in time.
## Bindings ## Bindings
Bindings provide the glue code for an interpreted language environment to run game scripts in. Currently there are three bindings: Bindings provide the glue code for an interpreted language environment to run game scripts in. Currently there are three bindings:
@ -89,7 +83,7 @@ To run mkxp, you should have a graphics card capable of at least **OpenGL (ES) 2
## Dependency kit ## Dependency kit
To facilitate hacking, I have assembled a package containing all dependencies to compile mkxp on a bare-bones Ubuntu 12.04 64bit installation. Compatibility with other distributions has not been tested. You can download it [here](https://mapleshrine.eu/depkits/linux64.tar.xz). Read the "README" for instructions. To facilitate hacking, I have assembled a package containing all dependencies to compile mkxp on a bare-bones Ubuntu 12.04 64bit installation. Compatibility with other distributions has not been tested. You can download it [here](https://www.dropbox.com/s/mtp44ur367m2zts/mkxp-depkit.tar.xz). Read the "README" for instructions.
## Configuration ## Configuration
@ -105,7 +99,7 @@ Example: `./mkxp --gameFolder="my game" --vsync=true --fixedFramerate=60`
mkxp doesn't come with a soundfont by default, so you will have to supply it yourself (set its path in the config). Playback has been tested and should work reasonably well with all RTP assets. mkxp doesn't come with a soundfont by default, so you will have to supply it yourself (set its path in the config). Playback has been tested and should work reasonably well with all RTP assets.
You can use this public domain soundfont: [GMGSx.sf2](https://mapleshrine.eu/unsorted/GMGSx.sf2) You can use this public domain soundfont: [GMGSx.sf2](https://www.dropbox.com/s/qxdvoxxcexsvn43/GMGSx.sf2?dl=0)
## Fonts ## Fonts

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by
@ -80,7 +80,6 @@ RB_METHOD(mriP);
RB_METHOD(mkxpDataDirectory); RB_METHOD(mkxpDataDirectory);
RB_METHOD(mkxpPuts); RB_METHOD(mkxpPuts);
RB_METHOD(mkxpRawKeyStates); RB_METHOD(mkxpRawKeyStates);
RB_METHOD(mkxpMouseInWindow);
RB_METHOD(mriRgssMain); RB_METHOD(mriRgssMain);
RB_METHOD(mriRgssStop); RB_METHOD(mriRgssStop);
@ -145,18 +144,8 @@ static void mriBindingInit()
_rb_define_module_function(mod, "data_directory", mkxpDataDirectory); _rb_define_module_function(mod, "data_directory", mkxpDataDirectory);
_rb_define_module_function(mod, "puts", mkxpPuts); _rb_define_module_function(mod, "puts", mkxpPuts);
_rb_define_module_function(mod, "raw_key_states", mkxpRawKeyStates); _rb_define_module_function(mod, "raw_key_states", mkxpRawKeyStates);
_rb_define_module_function(mod, "mouse_in_window", mkxpMouseInWindow);
/* Load global constants */
rb_gv_set("MKXP", Qtrue); rb_gv_set("MKXP", Qtrue);
VALUE debug = rb_bool_new(shState->config().editor.debug);
if (rgssVer == 1)
rb_gv_set("DEBUG", debug);
else if (rgssVer >= 2)
rb_gv_set("TEST", debug);
rb_gv_set("BTEST", rb_bool_new(shState->config().editor.battleTest));
} }
static void static void
@ -233,13 +222,6 @@ RB_METHOD(mkxpRawKeyStates)
return str; return str;
} }
RB_METHOD(mkxpMouseInWindow)
{
RB_UNUSED_PARAM;
return rb_bool_new(EventThread::mouseState.inWindow);
}
static VALUE rgssMainCb(VALUE block) static VALUE rgssMainCb(VALUE block)
{ {
rb_funcall2(block, rb_intern("call"), 0, 0); rb_funcall2(block, rb_intern("call"), 0, 0);
@ -470,9 +452,8 @@ static void runRMXPScripts(BacktraceData &btData)
} }
/* Execute preloaded scripts */ /* Execute preloaded scripts */
for (std::set<std::string>::iterator i = conf.preloadScripts.begin(); for (size_t i = 0; i < conf.preloadScripts.size(); ++i)
i != conf.preloadScripts.end(); ++i) runCustomScript(conf.preloadScripts[i]);
runCustomScript(*i);
VALUE exc = rb_gv_get("$!"); VALUE exc = rb_gv_get("$!");
if (exc != Qnil) if (exc != Qnil)

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by
@ -67,7 +67,7 @@ raiseRbExc(const Exception &exc);
/* 2.1 has added a new field (flags) to rb_data_type_t */ /* 2.1 has added a new field (flags) to rb_data_type_t */
#include <ruby/version.h> #include <ruby/version.h>
#if RUBY_API_VERSION_MAJOR >= 2 && RUBY_API_VERSION_MINOR >= 1 #if RUBY_API_VERSION_MINOR > 0
/* TODO: can mkxp use RUBY_TYPED_FREE_IMMEDIATELY here? */ /* TODO: can mkxp use RUBY_TYPED_FREE_IMMEDIATELY here? */
#define DEF_TYPE_FLAGS 0 #define DEF_TYPE_FLAGS 0
#else #else
@ -90,12 +90,7 @@ raiseRbExc(const Exception &exc);
template<rb_data_type_t *rbType> template<rb_data_type_t *rbType>
static VALUE classAllocate(VALUE klass) static VALUE classAllocate(VALUE klass)
{ {
/* 2.3 has changed the name of this function */
#if RUBY_API_VERSION_MAJOR >= 2 && RUBY_API_VERSION_MINOR >= 3
return rb_data_typed_object_wrap(klass, 0, rbType);
#else
return rb_data_typed_object_alloc(klass, 0, rbType); return rb_data_typed_object_alloc(klass, 0, rbType);
#endif
} }
template<class C> template<class C>

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2014 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2014 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by
@ -114,17 +114,8 @@ static void mrbBindingInit(mrb_state *mrb)
/* Load RPG module */ /* Load RPG module */
mrb_load_irep(mrb, mrbModuleRPG); mrb_load_irep(mrb, mrbModuleRPG);
/* Load global constants */
mrb_define_global_const(mrb, "MKXP", mrb_true_value()); mrb_define_global_const(mrb, "MKXP", mrb_true_value());
mrb_value debug = rb_bool_new(shState->config().editor.debug);
if (rgssVer == 1)
mrb_define_global_const(mrb, "DEBUG", debug);
else if (rgssVer >= 2)
mrb_define_global_const(mrb, "TEST", debug);
mrb_define_global_const(mrb, "BTEST", mrb_bool_value(shState->config().editor.battleTest));
mrb_gc_arena_restore(mrb, arena); mrb_gc_arena_restore(mrb, arena);
} }

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -86,12 +86,6 @@
# defScreenH=480 # defScreenH=480
# Override the game window title
# (default: none)
#
# windowTitle=Custom Title
# Enforce a static frame rate # Enforce a static frame rate
# (0 = disabled) # (0 = disabled)
# #
@ -130,26 +124,6 @@
# subImageFix=false # subImageFix=false
# Enable framebuffer blitting if the driver is
# capable of it. Some drivers carry buggy
# implementations of this functionality, so
# disabling it can be used as a workaround
# (default: enabled)
#
# enableBlitting=true
# Limit the maximum size (width, height) of
# most textures mkxp will create (exceptions are
# rendering backbuffers and similar).
# If set to 0, the hardware maximum is used.
# This is useful for recording traces that can
# be played back on machines with lower specs.
# (default: 0)
#
# maxTextureSize=0
# Set the base path of the game to '/path/to/game' # Set the base path of the game to '/path/to/game'
# (default: executable directory) # (default: executable directory)
# #

View File

@ -8,10 +8,6 @@ INCLUDEPATH += . src
CONFIG(release, debug|release): DEFINES += NDEBUG CONFIG(release, debug|release): DEFINES += NDEBUG
CONFIG += c++11
# And for older qmake versions..
QMAKE_CXXFLAGS += -std=c++11
isEmpty(BINDING) { isEmpty(BINDING) {
BINDING = MRI BINDING = MRI
} }
@ -93,7 +89,6 @@ HEADERS += \
src/flashable.h \ src/flashable.h \
src/font.h \ src/font.h \
src/input.h \ src/input.h \
src/iniconfig.h \
src/plane.h \ src/plane.h \
src/scene.h \ src/scene.h \
src/sprite.h \ src/sprite.h \
@ -150,7 +145,6 @@ SOURCES += \
src/filesystem.cpp \ src/filesystem.cpp \
src/font.cpp \ src/font.cpp \
src/input.cpp \ src/input.cpp \
src/iniconfig.cpp \
src/plane.cpp \ src/plane.cpp \
src/scene.cpp \ src/scene.cpp \
src/sprite.cpp \ src/sprite.cpp \

View File

@ -12,12 +12,8 @@ vec3 rgb2hsv(vec3 c)
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r)); vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
float d = q.x - min(q.w, q.y); float d = q.x - min(q.w, q.y);
/* Avoid divide-by-zero situations by adding a very tiny delta */
/* Avoid divide-by-zero situations by adding a very tiny delta.
* Since we always deal with underlying 8-Bit color values, this
* should never mask a real value */
const float eps = 1.0e-10; const float eps = 1.0e-10;
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + eps)), d / (q.x + eps), q.x); return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + eps)), d / (q.x + eps), q.x);
} }

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2014 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2014 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2014 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2014 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2014 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2014 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2014 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2014 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2014 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2014 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by
@ -33,7 +33,6 @@
#include "debugwriter.h" #include "debugwriter.h"
#include "util.h" #include "util.h"
#include "sdl-util.h" #include "sdl-util.h"
#include "iniconfig.h"
#ifdef INI_ENCODING #ifdef INI_ENCODING
extern "C" { extern "C" {
@ -135,12 +134,6 @@ static std::string prefPath(const char *org, const char *app)
return str; return str;
} }
template<typename T>
std::set<T> setFromVec(const std::vector<T> &vec)
{
return std::set<T>(vec.begin(), vec.end());
}
typedef std::vector<std::string> StringVec; typedef std::vector<std::string> StringVec;
namespace po = boost::program_options; namespace po = boost::program_options;
@ -162,14 +155,11 @@ void Config::read(int argc, char *argv[])
PO_DESC(vsync, bool, false) \ PO_DESC(vsync, bool, false) \
PO_DESC(defScreenW, int, 0) \ PO_DESC(defScreenW, int, 0) \
PO_DESC(defScreenH, int, 0) \ PO_DESC(defScreenH, int, 0) \
PO_DESC(windowTitle, std::string, "") \
PO_DESC(fixedFramerate, int, 0) \ PO_DESC(fixedFramerate, int, 0) \
PO_DESC(frameSkip, bool, true) \ PO_DESC(frameSkip, bool, true) \
PO_DESC(syncToRefreshrate, bool, false) \ PO_DESC(syncToRefreshrate, bool, false) \
PO_DESC(solidFonts, bool, false) \ PO_DESC(solidFonts, bool, false) \
PO_DESC(subImageFix, bool, false) \ PO_DESC(subImageFix, bool, false) \
PO_DESC(enableBlitting, bool, true) \
PO_DESC(maxTextureSize, int, 0) \
PO_DESC(gameFolder, std::string, ".") \ PO_DESC(gameFolder, std::string, ".") \
PO_DESC(anyAltToggleFS, bool, false) \ PO_DESC(anyAltToggleFS, bool, false) \
PO_DESC(enableReset, bool, true) \ PO_DESC(enableReset, bool, true) \
@ -190,27 +180,6 @@ void Config::read(int argc, char *argv[])
// Not gonna take your shit boost // Not gonna take your shit boost
#define GUARD_ALL( exp ) try { exp } catch(...) {} #define GUARD_ALL( exp ) try { exp } catch(...) {}
editor.debug = false;
editor.battleTest = false;
/* Read arguments sent from the editor */
if (argc > 1)
{
std::string argv1 = argv[1];
/* RGSS1 uses "debug", 2 and 3 use "test" */
if (argv1 == "debug" || argv1 == "test")
editor.debug = true;
else if (argv1 == "btest")
editor.battleTest = true;
/* Fix offset */
if (editor.debug || editor.battleTest)
{
argc--;
argv++;
}
}
#define PO_DESC(key, type, def) (#key, po::value< type >()->default_value(def)) #define PO_DESC(key, type, def) (#key, po::value< type >()->default_value(def))
po::options_description podesc; po::options_description podesc;
@ -257,7 +226,7 @@ void Config::read(int argc, char *argv[])
PO_DESC_ALL; PO_DESC_ALL;
GUARD_ALL( preloadScripts = setFromVec(vm["preloadScript"].as<StringVec>()); ); GUARD_ALL( preloadScripts = vm["preloadScript"].as<StringVec>(); );
GUARD_ALL( rtps = vm["RTP"].as<StringVec>(); ); GUARD_ALL( rtps = vm["RTP"].as<StringVec>(); );
@ -311,32 +280,26 @@ void Config::readGameINI()
return; return;
} }
po::options_description podesc;
podesc.add_options()
("Game.Title", po::value<std::string>())
("Game.Scripts", po::value<std::string>())
;
po::variables_map vm;
std::string iniFilename = execName + ".ini"; std::string iniFilename = execName + ".ini";
SDLRWStream iniFile(iniFilename.c_str(), "r"); SDLRWStream iniFile(iniFilename.c_str(), "r");
if (iniFile) if (iniFile)
{ {
INIConfiguration ic; try
if(ic.load(iniFile.stream()))
{ {
GUARD_ALL( game.title = ic.getStringProperty("Game", "Title"); ); po::store(po::parse_config_file(iniFile.stream(), podesc, true), vm);
GUARD_ALL( game.scripts = ic.getStringProperty("Game", "Scripts"); ); po::notify(vm);
strReplace(game.scripts, '\\', '/');
if (game.title.empty())
{
Debug() << iniFilename + ": Could not find Game.Title property";
}
if (game.scripts.empty())
{
Debug() << iniFilename + ": Could not find Game.Scripts property";
}
} }
else catch (po::error &error)
{ {
Debug() << iniFilename + ": Failed to parse ini file"; Debug() << iniFilename + ":" << error.what();
} }
} }
else else
@ -344,6 +307,11 @@ void Config::readGameINI()
Debug() << "FAILED to open" << iniFilename; Debug() << "FAILED to open" << iniFilename;
} }
GUARD_ALL( game.title = vm["Game.Title"].as<std::string>(); );
GUARD_ALL( game.scripts = vm["Game.Scripts"].as<std::string>(); );
strReplace(game.scripts, '\\', '/');
#ifdef INI_ENCODING #ifdef INI_ENCODING
/* Can add more later */ /* Can add more later */
const char *languages[] = const char *languages[] =

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by
@ -24,7 +24,6 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <set>
struct Config struct Config
{ {
@ -41,7 +40,6 @@ struct Config
int defScreenW; int defScreenW;
int defScreenH; int defScreenH;
std::string windowTitle;
int fixedFramerate; int fixedFramerate;
bool frameSkip; bool frameSkip;
@ -50,8 +48,6 @@ struct Config
bool solidFonts; bool solidFonts;
bool subImageFix; bool subImageFix;
bool enableBlitting;
int maxTextureSize;
std::string gameFolder; std::string gameFolder;
bool anyAltToggleFS; bool anyAltToggleFS;
@ -81,19 +77,13 @@ struct Config
bool useScriptNames; bool useScriptNames;
std::string customScript; std::string customScript;
std::set<std::string> preloadScripts; std::vector<std::string> preloadScripts;
std::vector<std::string> rtps; std::vector<std::string> rtps;
std::vector<std::string> fontSubs; std::vector<std::string> fontSubs;
std::vector<std::string> rubyLoadpaths; std::vector<std::string> rubyLoadpaths;
/* Editor flags */
struct {
bool debug;
bool battleTest;
} editor;
/* Game INI contents */ /* Game INI contents */
struct { struct {
std::string scripts; std::string scripts;

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by
@ -27,9 +27,9 @@
#include <SDL_timer.h> #include <SDL_timer.h>
#include <SDL_thread.h> #include <SDL_thread.h>
#include <SDL_touch.h> #include <SDL_touch.h>
#include <SDL_rect.h>
#include <al.h> #include <al.h>
#include <alc.h>
#include <alext.h> #include <alext.h>
#include "sharedstate.h" #include "sharedstate.h"
@ -83,7 +83,6 @@ enum
REQUEST_SETCURSORVISIBLE, REQUEST_SETCURSORVISIBLE,
UPDATE_FPS, UPDATE_FPS,
UPDATE_SCREEN_RECT,
EVENT_COUNT EVENT_COUNT
}; };
@ -132,8 +131,6 @@ void EventThread::process(RGSSThreadData &rtData)
bool displayingFPS = false; bool displayingFPS = false;
bool cursorInWindow = false; bool cursorInWindow = false;
/* Will be updated eventually */
SDL_Rect gameScreen = { 0, 0, 0, 0 };
/* SDL doesn't send an initial FOCUS_GAINED event */ /* SDL doesn't send an initial FOCUS_GAINED event */
bool windowFocused = true; bool windowFocused = true;
@ -173,7 +170,7 @@ void EventThread::process(RGSSThreadData &rtData)
delete sMenu; delete sMenu;
sMenu = 0; sMenu = 0;
updateCursorState(cursorInWindow && windowFocused, gameScreen); updateCursorState(cursorInWindow && windowFocused);
} }
continue; continue;
@ -214,14 +211,14 @@ void EventThread::process(RGSSThreadData &rtData)
case SDL_WINDOWEVENT_ENTER : case SDL_WINDOWEVENT_ENTER :
cursorInWindow = true; cursorInWindow = true;
mouseState.inWindow = true; mouseState.inWindow = true;
updateCursorState(cursorInWindow && windowFocused && !sMenu, gameScreen); updateCursorState(cursorInWindow && windowFocused && !sMenu);
break; break;
case SDL_WINDOWEVENT_LEAVE : case SDL_WINDOWEVENT_LEAVE :
cursorInWindow = false; cursorInWindow = false;
mouseState.inWindow = false; mouseState.inWindow = false;
updateCursorState(cursorInWindow && windowFocused && !sMenu, gameScreen); updateCursorState(cursorInWindow && windowFocused && !sMenu);
break; break;
@ -232,13 +229,13 @@ void EventThread::process(RGSSThreadData &rtData)
case SDL_WINDOWEVENT_FOCUS_GAINED : case SDL_WINDOWEVENT_FOCUS_GAINED :
windowFocused = true; windowFocused = true;
updateCursorState(cursorInWindow && windowFocused && !sMenu, gameScreen); updateCursorState(cursorInWindow && windowFocused && !sMenu);
break; break;
case SDL_WINDOWEVENT_FOCUS_LOST : case SDL_WINDOWEVENT_FOCUS_LOST :
windowFocused = false; windowFocused = false;
updateCursorState(cursorInWindow && windowFocused && !sMenu, gameScreen); updateCursorState(cursorInWindow && windowFocused && !sMenu);
resetInputStates(); resetInputStates();
break; break;
@ -271,7 +268,7 @@ void EventThread::process(RGSSThreadData &rtData)
if (!sMenu) if (!sMenu)
{ {
sMenu = new SettingsMenu(rtData); sMenu = new SettingsMenu(rtData);
updateCursorState(false, gameScreen); updateCursorState(false);
} }
sMenu->raise(); sMenu->raise();
@ -295,14 +292,14 @@ void EventThread::process(RGSSThreadData &rtData)
if (fullscreen) if (fullscreen)
{ {
/* Prevent fullscreen flicker */ /* Prevent fullscreen flicker */
strncpy(pendingTitle, rtData.config.windowTitle.c_str(), strncpy(pendingTitle, rtData.config.game.title.c_str(),
sizeof(pendingTitle)); sizeof(pendingTitle));
havePendingTitle = true; havePendingTitle = true;
break; break;
} }
SDL_SetWindowTitle(win, rtData.config.windowTitle.c_str()); SDL_SetWindowTitle(win, rtData.config.game.title.c_str());
} }
break; break;
@ -377,7 +374,6 @@ void EventThread::process(RGSSThreadData &rtData)
case SDL_MOUSEMOTION : case SDL_MOUSEMOTION :
mouseState.x = event.motion.x; mouseState.x = event.motion.x;
mouseState.y = event.motion.y; mouseState.y = event.motion.y;
updateCursorState(cursorInWindow, gameScreen);
break; break;
case SDL_FINGERDOWN : case SDL_FINGERDOWN :
@ -409,7 +405,7 @@ void EventThread::process(RGSSThreadData &rtData)
case REQUEST_MESSAGEBOX : case REQUEST_MESSAGEBOX :
SDL_ShowSimpleMessageBox(event.user.code, SDL_ShowSimpleMessageBox(event.user.code,
rtData.config.windowTitle.c_str(), rtData.config.game.title.c_str(),
(const char*) event.user.data1, win); (const char*) event.user.data1, win);
free(event.user.data1); free(event.user.data1);
msgBoxDone.set(); msgBoxDone.set();
@ -417,7 +413,7 @@ void EventThread::process(RGSSThreadData &rtData)
case REQUEST_SETCURSORVISIBLE : case REQUEST_SETCURSORVISIBLE :
showCursor = event.user.code; showCursor = event.user.code;
updateCursorState(cursorInWindow, gameScreen); updateCursorState(cursorInWindow);
break; break;
case UPDATE_FPS : case UPDATE_FPS :
@ -428,7 +424,7 @@ void EventThread::process(RGSSThreadData &rtData)
break; break;
snprintf(buffer, sizeof(buffer), "%s - %d FPS", snprintf(buffer, sizeof(buffer), "%s - %d FPS",
rtData.config.windowTitle.c_str(), event.user.code); rtData.config.game.title.c_str(), event.user.code);
/* Updating the window title in fullscreen /* Updating the window title in fullscreen
* mode seems to cause flickering */ * mode seems to cause flickering */
@ -442,15 +438,6 @@ void EventThread::process(RGSSThreadData &rtData)
SDL_SetWindowTitle(win, buffer); SDL_SetWindowTitle(win, buffer);
break; break;
case UPDATE_SCREEN_RECT :
gameScreen.x = event.user.windowID;
gameScreen.y = event.user.code;
gameScreen.w = reinterpret_cast<intptr_t>(event.user.data1);
gameScreen.h = reinterpret_cast<intptr_t>(event.user.data2);
updateCursorState(cursorInWindow, gameScreen);
break;
} }
} }
@ -545,13 +532,9 @@ void EventThread::setFullscreen(SDL_Window *win, bool mode)
fullscreen = mode; fullscreen = mode;
} }
void EventThread::updateCursorState(bool inWindow, void EventThread::updateCursorState(bool inWindow)
const SDL_Rect &screen)
{ {
SDL_Point pos = { mouseState.x, mouseState.y }; if (inWindow)
bool inScreen = inWindow && SDL_PointInRect(&pos, &screen);
if (inScreen)
SDL_ShowCursor(showCursor ? SDL_TRUE : SDL_FALSE); SDL_ShowCursor(showCursor ? SDL_TRUE : SDL_FALSE);
else else
SDL_ShowCursor(SDL_TRUE); SDL_ShowCursor(SDL_TRUE);
@ -657,19 +640,6 @@ void EventThread::notifyFrame()
SDL_PushEvent(&event); SDL_PushEvent(&event);
} }
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;
event.type = usrIdStart + UPDATE_SCREEN_RECT;
event.user.windowID = screen.x;
event.user.code = screen.y;
event.user.data1 = reinterpret_cast<void*>(screen.w);
event.user.data2 = reinterpret_cast<void*>(screen.h);
SDL_PushEvent(&event);
}
void SyncPoint::haltThreads() void SyncPoint::haltThreads()
{ {
if (mainSync.locked) if (mainSync.locked)

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by
@ -36,9 +36,8 @@
#include <stdint.h> #include <stdint.h>
#include <alc.h>
struct RGSSThreadData; struct RGSSThreadData;
typedef struct ALCdevice_struct ALCdevice;
struct SDL_Window; struct SDL_Window;
union SDL_Event; union SDL_Event;
@ -99,16 +98,12 @@ public:
/* RGSS thread calls this once per frame */ /* RGSS thread calls this once per frame */
void notifyFrame(); void notifyFrame();
/* Called on game screen (size / offset) changes */
void notifyGameScreenChange(const SDL_Rect &screen);
private: private:
static int eventFilter(void *, SDL_Event*); static int eventFilter(void *, SDL_Event*);
void resetInputStates(); void resetInputStates();
void setFullscreen(SDL_Window *, bool mode); void setFullscreen(SDL_Window *, bool mode);
void updateCursorState(bool inWindow, void updateCursorState(bool inWindow);
const SDL_Rect &screen);
bool fullscreen; bool fullscreen;
bool showCursor; bool showCursor;

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by
@ -311,32 +311,18 @@ struct FileSystemPrivate
bool havePathCache; bool havePathCache;
}; };
static void throwPhysfsError(const char *desc)
{
PHYSFS_ErrorCode ec = PHYSFS_getLastErrorCode();
const char *englishStr = PHYSFS_getErrorByCode(ec);
throw Exception(Exception::PHYSFSError, "%s: %s", desc, englishStr);
}
FileSystem::FileSystem(const char *argv0, FileSystem::FileSystem(const char *argv0,
bool allowSymlinks) bool allowSymlinks)
{ {
if (PHYSFS_init(argv0) == 0)
throwPhysfsError("Error initializing PhysFS");
/* One error (=return 0) turns the whole product to 0 */
int er = 1;
er *= PHYSFS_registerArchiver(&RGSS1_Archiver);
er *= PHYSFS_registerArchiver(&RGSS2_Archiver);
er *= PHYSFS_registerArchiver(&RGSS3_Archiver);
if (er == 0)
throwPhysfsError("Error registering PhysFS RGSS archiver");
p = new FileSystemPrivate; p = new FileSystemPrivate;
p->havePathCache = false; p->havePathCache = false;
PHYSFS_init(argv0);
PHYSFS_registerArchiver(&RGSS1_Archiver);
PHYSFS_registerArchiver(&RGSS2_Archiver);
PHYSFS_registerArchiver(&RGSS3_Archiver);
if (allowSymlinks) if (allowSymlinks)
PHYSFS_permitSymbolicLinks(1); PHYSFS_permitSymbolicLinks(1);
} }
@ -412,8 +398,8 @@ struct CacheEnumData
} }
}; };
static PHYSFS_EnumerateCallbackResult static void cacheEnumCB(void *d, const char *origdir,
cacheEnumCB(void *d, const char *origdir, const char *fname) const char *fname)
{ {
CacheEnumData &data = *static_cast<CacheEnumData*>(d); CacheEnumData &data = *static_cast<CacheEnumData*>(d);
char fullPath[512]; char fullPath[512];
@ -440,7 +426,7 @@ cacheEnumCB(void *d, const char *origdir, const char *fname)
/* Iterate over its contents */ /* Iterate over its contents */
data.fileLists.push(&list); data.fileLists.push(&list);
PHYSFS_enumerate(fullPath, cacheEnumCB, d); PHYSFS_enumerateFilesCallback(fullPath, cacheEnumCB, d);
data.fileLists.pop(); data.fileLists.pop();
} }
else else
@ -455,15 +441,13 @@ cacheEnumCB(void *d, const char *origdir, const char *fname)
/* Add the lower -> mixed mapping of the file's full path */ /* Add the lower -> mixed mapping of the file's full path */
data.p->pathCache.insert(lowerCase, mixedCase); data.p->pathCache.insert(lowerCase, mixedCase);
} }
return PHYSFS_ENUM_OK;
} }
void FileSystem::createPathCache() void FileSystem::createPathCache()
{ {
CacheEnumData data(p); CacheEnumData data(p);
data.fileLists.push(&p->fileLists[""]); data.fileLists.push(&p->fileLists[""]);
PHYSFS_enumerate("", cacheEnumCB, &data); PHYSFS_enumerateFilesCallback("", cacheEnumCB, &data);
p->havePathCache = true; p->havePathCache = true;
} }
@ -474,8 +458,8 @@ struct FontSetsCBData
SharedFontState *sfs; SharedFontState *sfs;
}; };
static PHYSFS_EnumerateCallbackResult static void fontSetEnumCB(void *data, const char *,
fontSetEnumCB (void *data, const char *dir, const char *fname) const char *fname)
{ {
FontSetsCBData *d = static_cast<FontSetsCBData*>(data); FontSetsCBData *d = static_cast<FontSetsCBData*>(data);
@ -483,7 +467,7 @@ fontSetEnumCB (void *data, const char *dir, const char *fname)
const char *ext = findExt(fname); const char *ext = findExt(fname);
if (!ext) if (!ext)
return PHYSFS_ENUM_OK; return;
char lowExt[8]; char lowExt[8];
size_t i; size_t i;
@ -493,15 +477,15 @@ fontSetEnumCB (void *data, const char *dir, const char *fname)
lowExt[i] = '\0'; lowExt[i] = '\0';
if (strcmp(lowExt, "ttf") && strcmp(lowExt, "otf")) if (strcmp(lowExt, "ttf") && strcmp(lowExt, "otf"))
return PHYSFS_ENUM_OK; return;
char filename[512]; char filename[512];
snprintf(filename, sizeof(filename), "%s/%s", dir, fname); snprintf(filename, sizeof(filename), "Fonts/%s", fname);
PHYSFS_File *handle = PHYSFS_openRead(filename); PHYSFS_File *handle = PHYSFS_openRead(filename);
if (!handle) if (!handle)
return PHYSFS_ENUM_ERROR; return;
SDL_RWops ops; SDL_RWops ops;
initReadOps(handle, ops, false); initReadOps(handle, ops, false);
@ -509,35 +493,13 @@ fontSetEnumCB (void *data, const char *dir, const char *fname)
d->sfs->initFontSetCB(ops, filename); d->sfs->initFontSetCB(ops, filename);
SDL_RWclose(&ops); SDL_RWclose(&ops);
return PHYSFS_ENUM_OK;
}
/* Basically just a case-insensitive search
* for the folder "Fonts"... */
static PHYSFS_EnumerateCallbackResult
findFontsFolderCB(void *data, const char *, const char *fname)
{
size_t i = 0;
char buffer[512];
const char *s = fname;
while (*s && i < sizeof(buffer))
buffer[i++] = tolower(*s++);
buffer[i] = '\0';
if (strcmp(buffer, "fonts") == 0)
PHYSFS_enumerate(fname, fontSetEnumCB, data);
return PHYSFS_ENUM_OK;
} }
void FileSystem::initFontSets(SharedFontState &sfs) void FileSystem::initFontSets(SharedFontState &sfs)
{ {
FontSetsCBData d = { p, &sfs }; FontSetsCBData d = { p, &sfs };
PHYSFS_enumerate("", findFontsFolderCB, &d); PHYSFS_enumerateFilesCallback("Fonts", fontSetEnumCB, &d);
} }
struct OpenReadEnumData struct OpenReadEnumData
@ -570,19 +532,19 @@ struct OpenReadEnumData
{} {}
}; };
static PHYSFS_EnumerateCallbackResult static void openReadEnumCB(void *d, const char *dirpath,
openReadEnumCB(void *d, const char *dirpath, const char *filename) const char *filename)
{ {
OpenReadEnumData &data = *static_cast<OpenReadEnumData*>(d); OpenReadEnumData &data = *static_cast<OpenReadEnumData*>(d);
char buffer[512]; char buffer[512];
const char *fullPath; const char *fullPath;
if (data.stopSearching) if (data.stopSearching)
return PHYSFS_ENUM_STOP; return;
/* If there's not even a partial match, continue searching */ /* If there's not even a partial match, continue searching */
if (strncmp(filename, data.filename, data.filenameN) != 0) if (strncmp(filename, data.filename, data.filenameN) != 0)
return PHYSFS_ENUM_OK; return;
if (!*dirpath) if (!*dirpath)
{ {
@ -600,7 +562,7 @@ openReadEnumCB(void *d, const char *dirpath, const char *filename)
* of the extension), or up to a following '\0' (full match), we've * of the extension), or up to a following '\0' (full match), we've
* found our file */ * found our file */
if (last != '.' && last != '\0') if (last != '.' && last != '\0')
return PHYSFS_ENUM_STOP; return;
/* If the path cache is active, translate from lower case /* If the path cache is active, translate from lower case
* to mixed case path */ * to mixed case path */
@ -615,9 +577,9 @@ openReadEnumCB(void *d, const char *dirpath, const char *filename)
* be a deeper rooted problem somewhere within PhysFS. * be a deeper rooted problem somewhere within PhysFS.
* Just abort alltogether. */ * Just abort alltogether. */
data.stopSearching = true; data.stopSearching = true;
data.physfsError = PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()); data.physfsError = PHYSFS_getLastError();
return PHYSFS_ENUM_ERROR; return;
} }
initReadOps(phys, data.ops, false); initReadOps(phys, data.ops, false);
@ -628,7 +590,6 @@ openReadEnumCB(void *d, const char *dirpath, const char *filename)
data.stopSearching = true; data.stopSearching = true;
++data.matchCount; ++data.matchCount;
return PHYSFS_ENUM_OK;
} }
void FileSystem::openRead(OpenHandler &handler, const char *filename) void FileSystem::openRead(OpenHandler &handler, const char *filename)
@ -674,7 +635,7 @@ void FileSystem::openRead(OpenHandler &handler, const char *filename)
} }
else else
{ {
PHYSFS_enumerate(dir, openReadEnumCB, &data); PHYSFS_enumerateFilesCallback(dir, openReadEnumCB, &data);
} }
if (data.physfsError) if (data.physfsError)

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -6,6 +6,10 @@
#include "debugwriter.h" #include "debugwriter.h"
#ifdef SHARED_FLUID
#include <fluidsynth.h>
#endif
#if __LINUX__ || __ANDROID__ #if __LINUX__ || __ANDROID__
#define FLUID_LIB "libfluidsynth.so.1" #define FLUID_LIB "libfluidsynth.so.1"
#elif __MACOSX__ #elif __MACOSX__

View File

@ -1,12 +1,6 @@
#ifndef FLUIDFUN_H #ifndef FLUIDFUN_H
#define FLUIDFUN_H #define FLUIDFUN_H
#ifdef SHARED_FLUID
# include <fluidsynth.h>
#else
# define FLUIDSYNTH_VERSION_MAJOR 2
#endif
typedef struct _fluid_hashtable_t fluid_settings_t; typedef struct _fluid_hashtable_t fluid_settings_t;
typedef struct _fluid_synth_t fluid_synth_t; typedef struct _fluid_synth_t fluid_synth_t;
@ -25,12 +19,7 @@ typedef int (*FLUIDSYNTHPROGRAMCHANGEPROC)(fluid_synth_t* synth, int chan, int p
typedef fluid_settings_t* (*NEWFLUIDSETTINGSPROC)(void); typedef fluid_settings_t* (*NEWFLUIDSETTINGSPROC)(void);
typedef fluid_synth_t* (*NEWFLUIDSYNTHPROC)(fluid_settings_t* settings); typedef fluid_synth_t* (*NEWFLUIDSYNTHPROC)(fluid_settings_t* settings);
typedef void (*DELETEFLUIDSETTINGSPROC)(fluid_settings_t* settings); typedef void (*DELETEFLUIDSETTINGSPROC)(fluid_settings_t* settings);
#if FLUIDSYNTH_VERSION_MAJOR == 1
typedef int (*DELETEFLUIDSYNTHPROC)(fluid_synth_t* synth); typedef int (*DELETEFLUIDSYNTHPROC)(fluid_synth_t* synth);
#else
typedef void (*DELETEFLUIDSYNTHPROC)(fluid_synth_t* synth);
#endif
#define FLUID_FUNCS \ #define FLUID_FUNCS \
FLUID_FUN(settings_setnum, FLUIDSETTINGSSETNUMPROC) \ FLUID_FUN(settings_setnum, FLUIDSETTINGSSETNUMPROC) \

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2014 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2014 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2014 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2014 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2014 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2014 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2014 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2014 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by
@ -23,7 +23,6 @@
#include "shader.h" #include "shader.h"
#include "etc.h" #include "etc.h"
#include "gl-fun.h" #include "gl-fun.h"
#include "config.h"
#include <SDL_rect.h> #include <SDL_rect.h>
@ -84,9 +83,10 @@ void GLBlendMode::apply(const BlendType &value)
break; break;
case BlendSubstraction : case BlendSubstraction :
// FIXME Alpha calculation is untested
gl.BlendEquation(GL_FUNC_REVERSE_SUBTRACT); gl.BlendEquation(GL_FUNC_REVERSE_SUBTRACT);
gl.BlendFuncSeparate(GL_SRC_ALPHA, GL_ONE, gl.BlendFuncSeparate(GL_SRC_ALPHA, GL_ONE,
GL_ZERO, GL_ONE); GL_ONE, GL_ONE);
break; break;
} }
} }
@ -111,7 +111,7 @@ GLState::Caps::Caps()
gl.GetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTexSize); gl.GetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTexSize);
} }
GLState::GLState(const Config &conf) GLState::GLState()
{ {
gl.Disable(GL_DEPTH_TEST); gl.Disable(GL_DEPTH_TEST);
@ -121,7 +121,4 @@ GLState::GLState(const Config &conf)
scissorTest.init(false); scissorTest.init(false);
scissorBox.init(IntRect(0, 0, 640, 480)); scissorBox.init(IntRect(0, 0, 640, 480));
program.init(0); program.init(0);
if (conf.maxTextureSize > 0)
caps.maxTexSize = conf.maxTextureSize;
} }

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by
@ -27,8 +27,6 @@
#include <stack> #include <stack>
#include <assert.h> #include <assert.h>
struct Config;
template<typename T> template<typename T>
struct GLProperty struct GLProperty
{ {
@ -132,7 +130,7 @@ public:
} caps; } caps;
GLState(const Config &conf); GLState();
}; };
#endif // GLSTATE_H #endif // GLSTATE_H

View File

@ -3,7 +3,7 @@
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu> ** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
** **
** mkxp is free software: you can redistribute it and/or modify ** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by
@ -92,9 +92,11 @@ struct PingPong
{ {
screenW = width; screenW = width;
screenH = height; screenH = height;
for (int i = 0; i < 2; ++i) for (int i = 0; i < 2; ++i)
TEXFBO::allocEmpty(rt[i], width, height); {
TEX::bind(rt[i].tex);
TEX::allocEmpty(width, height);
}
} }
void startRender() void startRender()
@ -474,7 +476,9 @@ struct GraphicsPrivate
bool frozen; bool frozen;
TEXFBO frozenScene; TEXFBO frozenScene;
TEXFBO currentScene;
Quad screenQuad; Quad screenQuad;
TEXFBO transBuffer;
/* Global list of all live Disposables /* Global list of all live Disposables
* (disposed on reset) */ * (disposed on reset) */
@ -500,15 +504,26 @@ struct GraphicsPrivate
TEXFBO::allocEmpty(frozenScene, scRes.x, scRes.y); TEXFBO::allocEmpty(frozenScene, scRes.x, scRes.y);
TEXFBO::linkFBO(frozenScene); TEXFBO::linkFBO(frozenScene);
TEXFBO::init(currentScene);
TEXFBO::allocEmpty(currentScene, scRes.x, scRes.y);
TEXFBO::linkFBO(currentScene);
FloatRect screenRect(0, 0, scRes.x, scRes.y); FloatRect screenRect(0, 0, scRes.x, scRes.y);
screenQuad.setTexPosRect(screenRect, screenRect); screenQuad.setTexPosRect(screenRect, screenRect);
TEXFBO::init(transBuffer);
TEXFBO::allocEmpty(transBuffer, scRes.x, scRes.y);
TEXFBO::linkFBO(transBuffer);
fpsLimiter.resetFrameAdjust(); fpsLimiter.resetFrameAdjust();
} }
~GraphicsPrivate() ~GraphicsPrivate()
{ {
TEXFBO::fini(frozenScene); TEXFBO::fini(frozenScene);
TEXFBO::fini(currentScene);
TEXFBO::fini(transBuffer);
} }
void updateScreenResoRatio(RGSSThreadData *rtData) void updateScreenResoRatio(RGSSThreadData *rtData)
@ -551,9 +566,6 @@ struct GraphicsPrivate
glState.viewport.refresh(); glState.viewport.refresh();
recalculateScreenSize(threadData); recalculateScreenSize(threadData);
updateScreenResoRatio(threadData); updateScreenResoRatio(threadData);
SDL_Rect screen = { scOffset.x, scOffset.y, scSize.x, scSize.y };
threadData->ethread->notifyGameScreenChange(screen);
} }
} }
@ -709,14 +721,7 @@ void Graphics::transition(int duration,
setBrightness(255); setBrightness(255);
/* Capture new scene */ /* Capture new scene */
p->screen.composite(); p->compositeToBuffer(p->currentScene);
/* The PP frontbuffer will hold the current scene after the
* composition step. Since the backbuffer is unused during
* the transition, we can reuse it as the target buffer for
* the final rendered image. */
TEXFBO &currentScene = p->screen.getPP().frontBuffer();
TEXFBO &transBuffer = p->screen.getPP().backBuffer();
/* If no transition bitmap is provided, /* If no transition bitmap is provided,
* we can use a simplified shader */ * we can use a simplified shader */
@ -729,7 +734,7 @@ void Graphics::transition(int duration,
shader.bind(); shader.bind();
shader.applyViewportProj(); shader.applyViewportProj();
shader.setFrozenScene(p->frozenScene.tex); shader.setFrozenScene(p->frozenScene.tex);
shader.setCurrentScene(currentScene.tex); shader.setCurrentScene(p->currentScene.tex);
shader.setTransMap(transMap->getGLTypes().tex); shader.setTransMap(transMap->getGLTypes().tex);
shader.setVague(vague / 256.0f); shader.setVague(vague / 256.0f);
shader.setTexSize(p->scRes); shader.setTexSize(p->scRes);
@ -740,7 +745,7 @@ void Graphics::transition(int duration,
shader.bind(); shader.bind();
shader.applyViewportProj(); shader.applyViewportProj();
shader.setFrozenScene(p->frozenScene.tex); shader.setFrozenScene(p->frozenScene.tex);
shader.setCurrentScene(currentScene.tex); shader.setCurrentScene(p->currentScene.tex);
shader.setTexSize(p->scRes); shader.setTexSize(p->scRes);
} }
@ -784,7 +789,7 @@ void Graphics::transition(int duration,
/* Draw the composed frame to a buffer first /* Draw the composed frame to a buffer first
* (we need this because we're skipping PingPong) */ * (we need this because we're skipping PingPong) */
FBO::bind(transBuffer.fbo); FBO::bind(p->transBuffer.fbo);
FBO::clear(); FBO::clear();
p->screenQuad.draw(); p->screenQuad.draw();
@ -795,7 +800,7 @@ void Graphics::transition(int duration,
FBO::clear(); FBO::clear();
GLMeta::blitBeginScreen(Vec2i(p->winSize)); GLMeta::blitBeginScreen(Vec2i(p->winSize));
GLMeta::blitSource(transBuffer); GLMeta::blitSource(p->transBuffer);
p->metaBlitBufferFlippedScaled(); p->metaBlitBufferFlippedScaled();
GLMeta::blitEnd(); GLMeta::blitEnd();
@ -938,11 +943,17 @@ void Graphics::resizeScreen(int width, int height)
p->screen.setResolution(width, height); p->screen.setResolution(width, height);
TEXFBO::allocEmpty(p->frozenScene, width, height); TEX::bind(p->frozenScene.tex);
TEX::allocEmpty(width, height);
TEX::bind(p->currentScene.tex);
TEX::allocEmpty(width, height);
FloatRect screenRect(0, 0, width, height); FloatRect screenRect(0, 0, width, height);
p->screenQuad.setTexPosRect(screenRect, screenRect); p->screenQuad.setTexPosRect(screenRect, screenRect);
TEX::bind(p->transBuffer.tex);
TEX::allocEmpty(width, height);
shState->eThread().requestWindowResize(width, height); shState->eThread().requestWindowResize(width, height);
} }

Some files were not shown because too many files have changed in this diff Show More