mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-19 13:29:54 +00:00
Merge remote-tracking branch 'origin/master' into freebsd-fixes
# Conflicts: # binding-mri/binding-mri.cpp # src/main.cpp # src/meow.cpp
This commit is contained in:
commit
976c99c2bc
36 changed files with 511 additions and 233 deletions
|
|
@ -4,6 +4,7 @@
|
|||
* "Визя"
|
||||
* DepressedTWM
|
||||
* referr
|
||||
* блинчек
|
||||
|
||||
## Artists
|
||||
|
||||
|
|
@ -18,15 +19,16 @@
|
|||
## Testers and helpers:
|
||||
* Rubik
|
||||
* Prime 223432
|
||||
|
||||
## Donators
|
||||
* Kodu
|
||||
* Алула(from Oneshot)
|
||||
* Охотник
|
||||
* Ouzly
|
||||
|
||||
## Telegram moderators
|
||||
* Creature_of_steel1
|
||||
* Обси(ENG channel)
|
||||
* Freskovich
|
||||
* "Визя"
|
||||
* Ouzly
|
||||
|
||||
## Matrix moderators
|
||||
* referr
|
||||
|
|
|
|||
48
PORTING.md
48
PORTING.md
|
|
@ -1,48 +0,0 @@
|
|||
<!-- markdownlint-disable MD033 -->
|
||||
## Операционные системы | Operating Systems
|
||||
| Платформа<br>Platform | Завершено<br>Done % | Состояние<br>State |
|
||||
| :--- | :---: | :--- |
|
||||
| Windows | 100% | Играбельно |
|
||||
| Linux | 91% | В работе, но уже играбельно<br>TODO:<br> \* Fix Wallpaper manager
|
||||
| *BSD | 15% | не в работе |
|
||||
| GNU/Hurd | 0% | не в работеm не хватает библеотек |
|
||||
| Solaris/OpenSolaris | 1% | не в работе |
|
||||
| RedoxOS | 0% | Не хватает библеотек |
|
||||
| Android | 4% | В работе |
|
||||
| PS Vita | 1% | не в работе |
|
||||
| PSP | 1% | не в работе |
|
||||
| Emspritein(web) | 11% | Нет хватает библеотек<br> \* Нужно написать порт библеотеки libsigc++2<br>(А лучше 3 и переписать движок)<br> \* Проблемы с компиляцией и зависимостями |
|
||||
| HaikuOS | 1% | не в работе |
|
||||
| DOS | 1% | Не в работе |
|
||||
| Ubuntu Touch | 60% | Будет почти готово тогда когда Linux порт будет доведён до ума |
|
||||
| Аврора ОС | 0% | не в работе |
|
||||
| ChromeOS/ChromiumOS | 0.4% | Неизвестное |
|
||||
| MacOS | 10.5% | Неизвестное, но работа ведётся |
|
||||
| Kyronix | 10% | В работе сторонней командой разработчиков|
|
||||
| PS2 | 40% | В работе сторонним человеком|
|
||||
|
||||
## Окружения рабочего стола | Desktop Environments
|
||||
| Окружение<br>Environments | Завершено<br>Done % |
|
||||
| :--- | :---: |
|
||||
| X11 standalone window managers | 0% |
|
||||
| Wayland standalone window managers | 0% |
|
||||
| LXDE | 100% |
|
||||
| XFCE | 10% |
|
||||
| GNOME | 10% |
|
||||
| KDE | 10% |
|
||||
| LXQT | 0% |
|
||||
| MATE | 100% |
|
||||
| Cinnamon | 10% |
|
||||
| Budgie | 0% |
|
||||
| Deepin | 10% |
|
||||
| COSMIC | 0% |
|
||||
| Pantheon | 0% |
|
||||
| Enlightenment | 0% |
|
||||
| Unity | 0% |
|
||||
| Sugar Desktop | 0% |
|
||||
| ROX Desktop | 0% |
|
||||
| Fluxbox | 0% |
|
||||
| Trinity | 0% |
|
||||
| Fish | 0% |
|
||||
| Lumina | 0% |
|
||||
| IceWM | 0% |
|
||||
|
|
@ -36,6 +36,7 @@
|
|||
#include "sunshine.h"
|
||||
#include "modloader.h"
|
||||
|
||||
#include <ruby/internal/gc.h>
|
||||
#include <ruby.h>
|
||||
#include <ruby/debug.h>
|
||||
#include <ruby/encoding.h>
|
||||
|
|
@ -158,8 +159,26 @@ RB_METHOD(mriRgssMain);
|
|||
RB_METHOD(mriRgssStop);
|
||||
RB_METHOD(_kernelCaller);
|
||||
|
||||
|
||||
// TODO: find the reason why Symbol doesn't have some methods
|
||||
VALUE rb_symbol_to_s(VALUE self)
|
||||
{
|
||||
ID id = SYM2ID(self);
|
||||
const char *name = rb_id2name(id);
|
||||
|
||||
if (!name)
|
||||
return rb_str_new("", 0);
|
||||
|
||||
return rb_utf8_str_new_cstr(name);
|
||||
}
|
||||
|
||||
static void mriBindingInit(){
|
||||
printf("[mriBindingInit] Loading bindings...\n");
|
||||
|
||||
rb_define_method(rb_cSymbol, "to_s", RUBY_METHOD_FUNC(rb_symbol_to_s), 0);
|
||||
rb_define_method(rb_cSymbol, "name", RUBY_METHOD_FUNC(rb_symbol_to_s), 0);
|
||||
rb_define_method(rb_cSymbol, "id2name", RUBY_METHOD_FUNC(rb_symbol_to_s), 0);
|
||||
|
||||
tableBindingInit();
|
||||
etcBindingInit();
|
||||
fontBindingInit();
|
||||
|
|
@ -379,7 +398,7 @@ static void runCustomScript(const std::string &filename){
|
|||
std::string scriptData;
|
||||
|
||||
if (!readFileSDL(filename.c_str(), scriptData)){
|
||||
crash(Exception::MEOW, "Unable to open %s", filename.c_str());
|
||||
crash(Exception::NoFileError, false, "Unable to open %s", filename.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -400,7 +419,7 @@ static void runRMXPScripts(BacktraceData &btData){
|
|||
const std::string &scriptPack = conf.game.scripts;
|
||||
|
||||
if (!shState->fileSystem().exists(scriptPack.c_str())){
|
||||
crash(Exception::MEOW, "Unable to open '%s'", scriptPack.c_str());
|
||||
crash(Exception::IOError, false, "Unable to open '%s'", scriptPack.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -411,12 +430,12 @@ static void runRMXPScripts(BacktraceData &btData){
|
|||
try{
|
||||
scriptArray = kernelLoadDataInt(scriptPack.c_str(), false);
|
||||
}catch (const Exception &e){
|
||||
crash(Exception::MEOW, "Failed to read script data: %s", e.msg.c_str());
|
||||
crash(Exception::IOError, false, "Failed to read script data: %s", e.msg.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!RB_TYPE_P(scriptArray, RUBY_T_ARRAY)){
|
||||
crash(Exception::MEOW, "Failed to read script data");
|
||||
crash(Exception::IOError, false, "Failed to read script data");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -454,7 +473,7 @@ static void runRMXPScripts(BacktraceData &btData){
|
|||
}
|
||||
|
||||
if (result != Z_OK){
|
||||
crash(Exception::MEOW, "Error decoding script %ld: '%s'\n", i, RSTRING_PTR(scriptName));
|
||||
crash(Exception::IOError, false, "Error decoding script %ld: '%s'\n", i, RSTRING_PTR(scriptName));
|
||||
break;
|
||||
}
|
||||
rb_ary_store(script, 3, rb_str_new_cstr(decodeBuffer.c_str()));
|
||||
|
|
@ -555,8 +574,7 @@ static void showExc(VALUE exc, const BacktraceData &btData){
|
|||
file.resize(SDL_strlen(file.c_str()));
|
||||
file = btData.scriptNames.value(file, file);
|
||||
|
||||
crash(Exception::MEOW, "Script '%s' line %s: %s occured.\n\n%s", file.c_str(), line, RSTRING_PTR(name), RSTRING_PTR(msg));
|
||||
exit(0);
|
||||
crash(Exception::RUBYError, true, "Script '%s' line %s: %s occured.\n\n%s", file.c_str(), line, RSTRING_PTR(name), RSTRING_PTR(msg));
|
||||
}
|
||||
|
||||
static void mriBindingExecute(){
|
||||
|
|
@ -565,7 +583,6 @@ static void mriBindingExecute(){
|
|||
* stdio streams on some platforms (eg. Windows) */
|
||||
int argc = 0;
|
||||
char **argv = 0;
|
||||
//options_argv3[] = "--jit"
|
||||
char options_argv1[] = "oneshot", options_argv2[] = "-ev";
|
||||
char* options_argv[] = {options_argv1, options_argv2, NULL};
|
||||
ruby_sysinit(&argc, &argv);
|
||||
|
|
|
|||
|
|
@ -133,6 +133,15 @@ RB_METHOD(graphicsWait){
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
RB_METHOD(graphicsSetVsync){
|
||||
RB_UNUSED_PARAM;
|
||||
int xuinia_ebania;
|
||||
rb_get_args(argc, argv, "i", &xuinia_ebania RB_ARG_END);
|
||||
shState->graphics().setVsync(xuinia_ebania);
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
RB_METHOD(graphicsFadeout){
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
|
|
@ -284,7 +293,7 @@ void graphicsBindingInit(){
|
|||
_rb_define_module_function(module, "freeze", graphicsFreeze);
|
||||
_rb_define_module_function(module, "transition", graphicsTransition);
|
||||
_rb_define_module_function(module, "frame_reset", graphicsFrameReset);
|
||||
|
||||
_rb_define_module_function(module, "setVsync", graphicsSetVsync);
|
||||
_rb_define_module_function(module, "__reset__", graphicsReset);
|
||||
|
||||
// Variables
|
||||
|
|
|
|||
|
|
@ -25,3 +25,5 @@ fixed segfault while to fast window size changing
|
|||
updated cg_blue picture
|
||||
Deleted useless hooks
|
||||
fix crash on game exit
|
||||
Error handling updated
|
||||
added gamepad button icons in settings
|
||||
|
|
|
|||
|
|
@ -35,10 +35,6 @@ defScreenH=0
|
|||
# is upscaled
|
||||
smoothScaling=false
|
||||
|
||||
# Sync screen redraws to the monitor refresh rate
|
||||
# (default: enabled)
|
||||
vsync=true
|
||||
|
||||
# Enforce a static frame rate
|
||||
# (0 = disabled)
|
||||
fixedFramerate=0
|
||||
|
|
|
|||
|
|
@ -221,7 +221,22 @@ module GamepadMapColors
|
|||
end
|
||||
|
||||
module GamepadIcons
|
||||
ICONS_CACHE = []
|
||||
GAMEPADS = [nil,
|
||||
Input::GamepadType::XBOX360,
|
||||
Input::GamepadType::XBOXONE,
|
||||
:series_x,
|
||||
Input::GamepadType::PS3,
|
||||
Input::GamepadType::PS4,
|
||||
Input::GamepadType::PS5,
|
||||
Input::GamepadType::SWITCH_PRO,
|
||||
Input::GamepadType::JOYCON_PAIR,
|
||||
:luna,
|
||||
:ouya,
|
||||
:stadia,
|
||||
:steam_controller,
|
||||
:steam_deck,
|
||||
Input::GamepadType::GAMECUBE
|
||||
]
|
||||
|
||||
ICONS = {
|
||||
# SDL supported types, can be detected automatically
|
||||
|
|
@ -244,6 +259,7 @@ module GamepadIcons
|
|||
},
|
||||
Input::GamepadType::STANDART => {
|
||||
:icon => [10, 13],
|
||||
:face_skinnable => true,
|
||||
:buttons => {
|
||||
Input::GamepadButton::INVALID => [9, 16],
|
||||
Input::GamepadButton::SOUTH => [0, 0],
|
||||
|
|
@ -275,9 +291,9 @@ module GamepadIcons
|
|||
},
|
||||
:axes => {
|
||||
Input::GamepadAxis::INVALID => [[9, 16], [9, 16]],
|
||||
Input::GamepadAxis::LEFTX => [[5, 1], [6, 1]],
|
||||
Input::GamepadAxis::LEFTX => [[6, 1], [5, 1]],
|
||||
Input::GamepadAxis::LEFTY => [[4, 1], [7, 1]],
|
||||
Input::GamepadAxis::RIGHTX => [[5, 2], [6, 2]],
|
||||
Input::GamepadAxis::RIGHTX => [[6, 2], [5, 2]],
|
||||
Input::GamepadAxis::RIGHTY => [[4, 2], [7, 2]],
|
||||
Input::GamepadAxis::LEFT_TRIGGER => [[6, 4], [9, 16]],
|
||||
Input::GamepadAxis::RIGHT_TRIGGER => [[7, 4], [9, 16]],
|
||||
|
|
@ -338,16 +354,6 @@ module GamepadIcons
|
|||
Input::GamepadButton::MISC1 => [7, 11],
|
||||
}
|
||||
},
|
||||
Input::GamepadType::PS5 => {
|
||||
:extends => Input::GamepadType::PS4,
|
||||
:icon => [10, 12],
|
||||
:buttons => {
|
||||
Input::GamepadButton::BACK => [4, 9],
|
||||
Input::GamepadButton::START => [5, 9],
|
||||
Input::GamepadButton::TOUCHPAD => [4, 10],
|
||||
Input::GamepadButton::MISC1 => [7, 11],
|
||||
}
|
||||
},
|
||||
Input::GamepadType::SWITCH_PRO => {
|
||||
:extends => Input::GamepadType::JOYCON_PAIR,
|
||||
:icon => [10, 13],
|
||||
|
|
@ -391,6 +397,7 @@ module GamepadIcons
|
|||
},
|
||||
Input::GamepadType::GAMECUBE => {
|
||||
:extends => Input::GamepadType::STANDART,
|
||||
:face_skinnable => false,
|
||||
:icon => [8, 11],
|
||||
:buttons => {
|
||||
Input::GamepadButton::SOUTH => [8, 10],
|
||||
|
|
@ -405,9 +412,9 @@ module GamepadIcons
|
|||
:axes => {
|
||||
Input::GamepadAxis::LEFT_TRIGGER => [[6, 15], [9, 16]],
|
||||
Input::GamepadAxis::RIGHT_TRIGGER => [[0, 17], [9, 16]],
|
||||
Input::GamepadAxis::LEFTX => [[9, 9], [10, 9]],
|
||||
Input::GamepadAxis::LEFTX => [[10, 9], [9, 9]],
|
||||
Input::GamepadAxis::LEFTY => [[8, 9], [11, 9]],
|
||||
Input::GamepadAxis::RIGHTX => [[9, 8], [10, 8]],
|
||||
Input::GamepadAxis::RIGHTX => [[10, 8], [9, 8]],
|
||||
Input::GamepadAxis::RIGHTY => [[8, 8], [11, 8]],
|
||||
}
|
||||
},
|
||||
|
|
@ -422,7 +429,7 @@ module GamepadIcons
|
|||
},
|
||||
:luna => {
|
||||
:extends => Input::GamepadType::XBOXONE,
|
||||
:icon => [8, 11],
|
||||
:icon => [10, 11],
|
||||
:buttons => {
|
||||
Input::GamepadButton::BACK => [7, 13],
|
||||
Input::GamepadButton::GUIDE => [7, 12],
|
||||
|
|
@ -455,7 +462,7 @@ module GamepadIcons
|
|||
Input::GamepadButton::RIGHT_STICK => [3, 17],
|
||||
},
|
||||
:axes => {
|
||||
Input::GamepadAxis::RIGHTX => [[5, 16], [6, 16]],
|
||||
Input::GamepadAxis::RIGHTX => [[6, 16], [5, 16]],
|
||||
Input::GamepadAxis::RIGHTY => [[4, 16], [7, 16]],
|
||||
}
|
||||
},
|
||||
|
|
@ -477,7 +484,7 @@ module GamepadIcons
|
|||
},
|
||||
:stadia => {
|
||||
:extends => Input::GamepadType::XBOXONE,
|
||||
:icon => [8, 17],
|
||||
:icon => [10, 13],
|
||||
:buttons => {
|
||||
Input::GamepadButton::BACK => [5, 8],
|
||||
Input::GamepadButton::GUIDE => [8, 17],
|
||||
|
|
@ -492,26 +499,179 @@ module GamepadIcons
|
|||
}
|
||||
|
||||
GUIDS = {
|
||||
|
||||
"030000006f0e00001301000000000000" => :series_x,
|
||||
"030000006f0e00001304000000000000" => :series_x,
|
||||
"030000006f0e00001302000000000000" => :series_x,
|
||||
"030000006f0e00003901000000000000" => :series_x,
|
||||
"030000006f0e00001413000000000000" => :series_x,
|
||||
"03000000ab1200000103000000000000" => :series_x,
|
||||
"03000000ad1b000000f9000000000000" => :series_x,
|
||||
"030000005e040000130b000000000000" => :series_x,
|
||||
"03000000373500000411000023000000" => :series_x,
|
||||
"030000005e040000050b000003090000" => :series_x,
|
||||
"030000005e040000130b000001050000" => :series_x,
|
||||
"030000005e040000130b000013050000" => :series_x,
|
||||
"030000005e040000130b000015050000" => :series_x,
|
||||
"030000005e040000130b000007050000" => :series_x,
|
||||
"030000005e040000130b000017050000" => :series_x,
|
||||
"030000005e040000130b000022050000" => :series_x,
|
||||
"030000005e040000220b000017050000" => :series_x,
|
||||
"030000005e040000220b000021050000" => :series_x,
|
||||
"03000000c82d00000a20000000020000" => :series_x,
|
||||
"03000000c82d00000020000000000000" => :series_x,
|
||||
"06000000c82d00000020000006010000" => :series_x,
|
||||
"030000005e040000120b00000b050000" => :series_x,
|
||||
"030000005e040000120b000016050000" => :series_x,
|
||||
"030000005e040000120b000017050000" => :series_x,
|
||||
"060000005e040000120b000001050000" => :series_x,
|
||||
"030000006f0e0000d702000006640000" => :series_x,
|
||||
"030000006f0e0000d802000006640000" => :series_x,
|
||||
"030000006f0e0000ef02000007640000" => :series_x,
|
||||
"03000000d62000000540000001010000" => :series_x,
|
||||
"03000000d62000000520000050010000" => :series_x,
|
||||
"03000000d62000000b20000001010000" => :series_x,
|
||||
"03000000d62000000f20000001010000" => :series_x,
|
||||
"03000000d62000006520000002010000" => :series_x,
|
||||
"030000004b2900000430000011000000" => :series_x,
|
||||
"030000005e040000120b000001050000" => :series_x,
|
||||
"030000005e040000120b000005050000" => :series_x,
|
||||
"030000005e040000120b000007050000" => :series_x,
|
||||
"030000005e040000120b000009050000" => :series_x,
|
||||
"030000005e040000120b00000d050000" => :series_x,
|
||||
"030000005e040000120b00000f050000" => :series_x,
|
||||
"030000005e040000120b000011050000" => :series_x,
|
||||
"030000005e040000120b000014050000" => :series_x,
|
||||
"030000005e040000120b000015050000" => :series_x,
|
||||
"030000005e040000130b000005050000" => :series_x,
|
||||
"050000005e040000130b000001050000" => :series_x,
|
||||
"050000005e040000130b000005050000" => :series_x,
|
||||
"050000005e040000130b000007050000" => :series_x,
|
||||
"050000005e040000130b000009050000" => :series_x,
|
||||
"050000005e040000130b000011050000" => :series_x,
|
||||
"050000005e040000130b000013050000" => :series_x,
|
||||
"050000005e040000130b000015050000" => :series_x,
|
||||
"050000005e040000130b000017050000" => :series_x,
|
||||
"060000005e040000120b000007050000" => :series_x,
|
||||
"060000005e040000120b00000b050000" => :series_x,
|
||||
"060000005e040000120b00000d050000" => :series_x,
|
||||
"060000005e040000120b00000f050000" => :series_x,
|
||||
"050000005e040000130b000022050000" => :series_x,
|
||||
"060000005e040000120b000011050000" => :series_x,
|
||||
"32386235353630393033393135613831" => :series_x,
|
||||
"050000005e040000120b000000783f00" => :series_x,
|
||||
"050000005e040000120b000000783f80" => :series_x,
|
||||
"050000005e040000130b0000ffff3f00" => :series_x,
|
||||
"65633038363832353634653836396239" => :series_x,
|
||||
"050000005e040000130b0000df870001" => :series_x,
|
||||
"050000005e040000130b0000ff870001" => :series_x,
|
||||
"0300fa675e040000ff02000000007801" => :series_x, # this is my gamepad, but for some reason it is not in the gamecontrollerdb.txt
|
||||
"03000000491900001904000000000000" => :luna,
|
||||
"03000000710100001904000000000000" => :luna,
|
||||
"03000000491900001904000001010000" => :luna,
|
||||
"03000000710100001904000000010000" => :luna,
|
||||
"03000000491900001904000011010000" => :luna,
|
||||
"05000000710100001904000000010000" => :luna,
|
||||
"32333634613735616163326165323731" => :luna,
|
||||
"416d617a6f6e2047616d6520436f6e74" => :luna,
|
||||
"4c756e612047616d6570616400000000" => :luna,
|
||||
"03000000362800000100000000000000" => :ouya,
|
||||
"05000000362800000100000002010000" => :ouya,
|
||||
"05000000362800000100000003010000" => :ouya,
|
||||
"05000000362800000100000004010000" => :ouya,
|
||||
"39383335313438623439373538343266" => :ouya,
|
||||
"4f5559412047616d6520436f6e74726f" => :ouya,
|
||||
"03000000de2800000112000001000000" => :steam_controller,
|
||||
"03000000de2800000112000011010000" => :steam_controller,
|
||||
"03000000de2800000211000001000000" => :steam_controller,
|
||||
"03000000de2800000211000011010000" => :steam_controller,
|
||||
"03000000de2800004211000001000000" => :steam_controller,
|
||||
"03000000de2800004211000011010000" => :steam_controller,
|
||||
"03000000de280000fc11000001000000" => :steam_controller,
|
||||
"05000000de2800000212000001000000" => :steam_controller,
|
||||
"05000000de2800000511000001000000" => :steam_controller,
|
||||
"05000000de2800000611000001000000" => :steam_controller,
|
||||
"30623739343039643830333266346439" => :steam_controller,
|
||||
"31643365666432386133346639383937" => :steam_controller,
|
||||
"03000000de2800000512000010010000" => :steam_deck,
|
||||
"03000000de2800000512000011010000" => :steam_deck,
|
||||
"03000000d11800000094000000000000" => :stadia,
|
||||
"03000000d11800000094000000010000" => :stadia,
|
||||
"03000000d11800000094000011010000" => :stadia,
|
||||
"05000000d11800000094000000010000" => :stadia,
|
||||
"35383633353935396534393230616564" => :stadia,
|
||||
"476f6f676c65204c4c43205374616469" => :stadia,
|
||||
"5374616469614e3848532d6532633400" => :stadia,
|
||||
}
|
||||
|
||||
class << self
|
||||
def icon(gamepad_type = nil)
|
||||
current_gamepad = get_gamepad_type(gamepad_type)
|
||||
|
||||
debug_string = ""
|
||||
iterations = 0
|
||||
|
||||
result = nil
|
||||
while !result
|
||||
if !ICONS[current_gamepad].has_key?(:icon)
|
||||
current_gamepad = ICONS[current_gamepad][:extends]
|
||||
debug_string << "gamepad " << current_gamepad << "\n"
|
||||
iterations += 1
|
||||
if iterations > 10
|
||||
puts debug_string
|
||||
result = [8, 16]
|
||||
end
|
||||
next
|
||||
end
|
||||
result = ICONS[current_gamepad][:icon].clone
|
||||
current_gamepad = ICONS[current_gamepad][:extends]
|
||||
end
|
||||
result
|
||||
end
|
||||
|
||||
def face_skinnable(gamepad_type = nil)
|
||||
current_gamepad = get_gamepad_type(gamepad_type)
|
||||
|
||||
debug_string = ""
|
||||
iterations = 0
|
||||
|
||||
result = nil
|
||||
while result == nil
|
||||
if !ICONS[current_gamepad].has_key?(:face_skinnable)
|
||||
current_gamepad = ICONS[current_gamepad][:extends]
|
||||
debug_string << "gamepad " << current_gamepad << "\n"
|
||||
iterations += 1
|
||||
if iterations > 10
|
||||
puts debug_string
|
||||
result = false
|
||||
end
|
||||
next
|
||||
end
|
||||
result = ICONS[current_gamepad][:face_skinnable]
|
||||
current_gamepad = ICONS[current_gamepad][:extends]
|
||||
end
|
||||
result
|
||||
end
|
||||
|
||||
def button(id, skinned = true, gamepad_type = nil)
|
||||
current_gamepad = gamepad_type
|
||||
if !ICONS.has_key?(gamepad_type)
|
||||
current_gamepad = Input::GamepadType.current_type
|
||||
if !ICONS.has_key?(current_gamepad)
|
||||
current_gamepad = Input::GamepadType::UNKNOWN
|
||||
end
|
||||
end
|
||||
current_gamepad = get_gamepad_type(gamepad_type)
|
||||
|
||||
debug_string = ""
|
||||
iterations = 0
|
||||
|
||||
result = nil
|
||||
while !result
|
||||
if !ICONS[current_gamepad].has_key?(:buttons)
|
||||
current_gamepad = ICONS[current_gamepad][:extends]
|
||||
debug_string << current_gamepad << "\n"
|
||||
iterations += 1
|
||||
if iterations > 10
|
||||
puts debug_string
|
||||
result = [8, 16]
|
||||
end
|
||||
next
|
||||
end
|
||||
result = ICONS[current_gamepad][:buttons][id].clone
|
||||
current_gamepad = ICONS[current_gamepad][:extends]
|
||||
end
|
||||
if skinned
|
||||
if id == Input::GamepadButton::SOUTH ||
|
||||
|
|
@ -525,23 +685,42 @@ module GamepadIcons
|
|||
end
|
||||
|
||||
def axis(id, dir, gamepad_type = nil)
|
||||
current_gamepad = gamepad_type
|
||||
if !ICONS.has_key?(gamepad_type)
|
||||
current_gamepad = Input::GamepadType.current_type
|
||||
if !ICONS.has_key?(current_gamepad)
|
||||
current_gamepad = Input::GamepadType::UNKNOWN
|
||||
end
|
||||
end
|
||||
current_gamepad = get_gamepad_type(gamepad_type)
|
||||
|
||||
debug_string = ""
|
||||
iterations = 0
|
||||
|
||||
result = nil
|
||||
while !result
|
||||
if !ICONS[current_gamepad].has_key?(:axes)
|
||||
current_gamepad = ICONS[current_gamepad][:extends]
|
||||
debug_string << "gamepad " << current_gamepad << "\n"
|
||||
iterations += 1
|
||||
if iterations > 10
|
||||
puts debug_string
|
||||
result = [8, 16]
|
||||
end
|
||||
next
|
||||
end
|
||||
result = ICONS[current_gamepad][:axes][id][1 - dir].clone
|
||||
axis = ICONS[current_gamepad][:axes][id]
|
||||
result = axis[1 - dir].clone if axis
|
||||
current_gamepad = ICONS[current_gamepad][:extends]
|
||||
end
|
||||
result
|
||||
end
|
||||
|
||||
def get_gamepad_type(gamepad_override = nil)
|
||||
current_gamepad = gamepad_override || GamepadIcons::GAMEPADS[Settings[:gamepad_type]]
|
||||
if !ICONS.has_key?(current_gamepad)
|
||||
current_gamepad = GUIDS[Input::GamepadType.current_guid]
|
||||
if !ICONS.has_key?(current_gamepad)
|
||||
current_gamepad = Input::GamepadType.current_type
|
||||
if !ICONS.has_key?(current_gamepad)
|
||||
current_gamepad = Input::GamepadType::UNKNOWN
|
||||
end
|
||||
end
|
||||
end
|
||||
current_gamepad
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -16,6 +16,7 @@ module Settings
|
|||
:twm_shader => true,
|
||||
:light => true,
|
||||
:scaling_mode => 0,
|
||||
:vsync => 0,
|
||||
|
||||
# UI
|
||||
:in_game_timer => false,
|
||||
|
|
@ -205,6 +206,12 @@ class Window_Settings
|
|||
:parameter => :scaling_mode,
|
||||
:values => ["Nearest Neighbor", "Smooth(old)"]
|
||||
},
|
||||
{
|
||||
:type => :enum,
|
||||
:name => "Vsync mode",
|
||||
:parameter => :vsync,
|
||||
:values => ["Normal", "Adaptive", "Disabled"]
|
||||
},
|
||||
{ :type => :sep, :name => "Effects"},
|
||||
{
|
||||
:type => :bool,
|
||||
|
|
@ -294,25 +301,42 @@ class Window_Settings
|
|||
{ :type => :sep, :name => "Gamepad" },
|
||||
{
|
||||
:type => :custom,
|
||||
:name => "Face buttons style",
|
||||
:parameter => :gamepad_face_style,
|
||||
:name => "Your gamepad type",
|
||||
:parameter => :gamepad_type,
|
||||
:default => 0,
|
||||
:callbacks => {
|
||||
:init => proc { |super_proc|
|
||||
@max_value = 5
|
||||
@max_value = GamepadIcons::GAMEPADS.length
|
||||
@texts = [
|
||||
"Auto",
|
||||
"XBOX 360",
|
||||
"XBOX One",
|
||||
"XBOX Series X",
|
||||
"PS 3",
|
||||
"PS 4",
|
||||
"PS 5",
|
||||
"Nintendo Switch Pro",
|
||||
"Nintendo Joycons",
|
||||
"Amazon Luna",
|
||||
"OUYA",
|
||||
"Google Stadia",
|
||||
"Steam Controller",
|
||||
"Steam Deck",
|
||||
"Nintendo GAMECUBE"
|
||||
]
|
||||
|
||||
super_proc.call
|
||||
},
|
||||
:get_display_value => proc { |super_proc|
|
||||
"" # meow >w<
|
||||
""
|
||||
},
|
||||
:redraw => proc { |super_proc|
|
||||
super_proc.call
|
||||
|
||||
x, y = GamepadIcons.button(Input::GamepadButton::SOUTH, false)
|
||||
y += self.value * ICON_SIZE
|
||||
x, y = GamepadIcons.icon()
|
||||
|
||||
@sprite.bitmap.stretch_blt(Rect.new(PARAMETER_WIDTH - ICON_SIZE * 4 * 2, (PARAMETER_HEIGHT - ICON_SIZE * 2) / 2, ICON_SIZE * 4 * 2, ICON_SIZE * 2), RPG::Cache.menu("gamepad_icons"), Rect.new(x, y, ICON_SIZE * 4, ICON_SIZE))
|
||||
@sprite.bitmap.stretch_blt(Rect.new(PARAMETER_WIDTH - ICON_SIZE * 2, PARAMETER_HEIGHT / 2 - ICON_SIZE, ICON_SIZE * 2, ICON_SIZE * 2), RPG::Cache.menu("gamepad_icons"), Rect.new(x * ICON_SIZE, y * ICON_SIZE, ICON_SIZE, ICON_SIZE))
|
||||
@sprite.bitmap.draw_text(@sprite.bitmap.width - @value_width - ICON_SIZE * 2 - 8, 0, @value_width, @sprite.bitmap.height, tr(@texts[self.value]), 2)
|
||||
},
|
||||
:value_set => proc { |super_proc, value|
|
||||
if (value != self.value)
|
||||
|
|
@ -332,9 +356,62 @@ class Window_Settings
|
|||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
:type => :custom,
|
||||
:name => "Face buttons style",
|
||||
:parameter => :gamepad_face_style,
|
||||
:default => 0,
|
||||
:callbacks => {
|
||||
:init => proc { |super_proc|
|
||||
@max_value = 5
|
||||
|
||||
super_proc.call
|
||||
},
|
||||
:get_display_value => proc { |super_proc|
|
||||
"" # meow >w<
|
||||
},
|
||||
:redraw => proc { |super_proc|
|
||||
@disabled = !GamepadIcons.face_skinnable
|
||||
|
||||
super_proc.call
|
||||
|
||||
sx, sy = GamepadIcons.button(Input::GamepadButton::SOUTH, false)
|
||||
wx, wy = GamepadIcons.button(Input::GamepadButton::WEST, false)
|
||||
nx, ny = GamepadIcons.button(Input::GamepadButton::NORTH, false)
|
||||
ex, ey = GamepadIcons.button(Input::GamepadButton::EAST, false)
|
||||
if GamepadIcons.face_skinnable
|
||||
sy += self.value
|
||||
wy += self.value
|
||||
ny += self.value
|
||||
ey += self.value
|
||||
end
|
||||
|
||||
@sprite.bitmap.stretch_blt(Rect.new(PARAMETER_WIDTH - ICON_SIZE * 8, PARAMETER_HEIGHT / 2 - ICON_SIZE, ICON_SIZE * 2, ICON_SIZE * 2), RPG::Cache.menu("gamepad_icons"), Rect.new(sx * ICON_SIZE, sy * ICON_SIZE, ICON_SIZE, ICON_SIZE))
|
||||
@sprite.bitmap.stretch_blt(Rect.new(PARAMETER_WIDTH - ICON_SIZE * 6, PARAMETER_HEIGHT / 2 - ICON_SIZE, ICON_SIZE * 2, ICON_SIZE * 2), RPG::Cache.menu("gamepad_icons"), Rect.new(wx * ICON_SIZE, wy * ICON_SIZE, ICON_SIZE, ICON_SIZE))
|
||||
@sprite.bitmap.stretch_blt(Rect.new(PARAMETER_WIDTH - ICON_SIZE * 4, PARAMETER_HEIGHT / 2 - ICON_SIZE, ICON_SIZE * 2, ICON_SIZE * 2), RPG::Cache.menu("gamepad_icons"), Rect.new(nx * ICON_SIZE, ny * ICON_SIZE, ICON_SIZE, ICON_SIZE))
|
||||
@sprite.bitmap.stretch_blt(Rect.new(PARAMETER_WIDTH - ICON_SIZE * 2, PARAMETER_HEIGHT / 2 - ICON_SIZE, ICON_SIZE * 2, ICON_SIZE * 2), RPG::Cache.menu("gamepad_icons"), Rect.new(ex * ICON_SIZE, ey * ICON_SIZE, ICON_SIZE, ICON_SIZE))
|
||||
},
|
||||
:value_set => proc { |super_proc, value|
|
||||
if (value != self.value)
|
||||
Audio.se_play(PARAMETER_CHANGE_AUDIO, 70, (value.to_f / @max_value.to_f * 50.0).to_i + 75)
|
||||
end
|
||||
super_proc.call(value)
|
||||
},
|
||||
:value_left => proc { |super_proc|
|
||||
next if @disabled
|
||||
self.value = (self.value - 1) % @max_value
|
||||
@settings_content.redraw_all
|
||||
},
|
||||
:value_right => proc { |super_proc|
|
||||
next if @disabled
|
||||
self.value = (self.value + 1) % @max_value
|
||||
@settings_content.redraw_all
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
:type => :bool,
|
||||
:name => "Control LED lighting on gamepads",
|
||||
:name => "Control LED lighting",
|
||||
:parameter => :gamepad_led
|
||||
},
|
||||
{ :type => :sep, :name => "Walk" },
|
||||
|
|
@ -447,45 +524,53 @@ class Window_Settings
|
|||
{
|
||||
:type => :bool,
|
||||
:name => "Show debug character",
|
||||
:parameter => :debug_character
|
||||
:parameter => :debug_character,
|
||||
:icon => [1, 0],
|
||||
},
|
||||
{
|
||||
:type => :bool,
|
||||
:name => "Draw debug text in main menu",
|
||||
:parameter => :debug_text_scene_title
|
||||
:parameter => :debug_text_scene_title,
|
||||
:icon => [1, 0],
|
||||
},
|
||||
{
|
||||
:type => :bool,
|
||||
:name => "Show debug text",
|
||||
:parameter => :debug_text
|
||||
:parameter => :debug_text,
|
||||
:icon => [1, 0],
|
||||
},
|
||||
{
|
||||
:type => :bool,
|
||||
:name => "Show picture names",
|
||||
:parameter => :debug_picture_names
|
||||
:parameter => :debug_picture_names,
|
||||
:icon => [1, 0],
|
||||
},
|
||||
{
|
||||
:type => :bool,
|
||||
:name => "Debug lightmap",
|
||||
:parameter => :debug_lightmap
|
||||
:parameter => :debug_lightmap,
|
||||
:icon => [1, 0],
|
||||
},
|
||||
{
|
||||
:type => :bool,
|
||||
:name => "SDL_HINT_SHUTDOWN_DBUS_ON_QUIT",
|
||||
:parameter => :SDL_HINT_SHUTDOWN_DBUS_ON_QUIT
|
||||
:parameter => :SDL_HINT_SHUTDOWN_DBUS_ON_QUIT,
|
||||
:icon => [1, 0],
|
||||
},
|
||||
{ :type => :sep },
|
||||
{
|
||||
:type => :key,
|
||||
:name => "Debug",
|
||||
:parameter => :controls_debug,
|
||||
:bind => Input::DEBUGACTION
|
||||
:bind => Input::DEBUGACTION,
|
||||
:icon => [1, 0],
|
||||
},
|
||||
{ :type => :sep },
|
||||
{
|
||||
:type => :action,
|
||||
:name => "Clear image cache",
|
||||
:action => Proc.new { RPG::Cache.clear }
|
||||
:action => Proc.new { RPG::Cache.clear },
|
||||
:icon => [1, 0],
|
||||
}
|
||||
],
|
||||
"Mods" => [
|
||||
|
|
@ -503,3 +588,4 @@ class Window_Settings
|
|||
DATA["Mods"] << setting
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ begin
|
|||
Font.default_size = 20
|
||||
#debug shit
|
||||
Input.set_led(255, 150, 30)
|
||||
|
||||
# Load persistent data
|
||||
Persistent.load
|
||||
|
||||
|
|
|
|||
|
|
@ -730,8 +730,9 @@ class Window_Settings
|
|||
def redraw()
|
||||
redraw_icon
|
||||
offset = !!@icon_position ? ICON_SIZE * 2 + 8 : 0
|
||||
if (@parameter)
|
||||
if @parameter && @key_binds != Settings[@parameter]
|
||||
@key_binds = Settings[@parameter]
|
||||
apply
|
||||
end
|
||||
|
||||
@sprite.bitmap.clear
|
||||
|
|
@ -747,7 +748,7 @@ class Window_Settings
|
|||
offset = (@selected && i == @selection ? SELECTED_KEYS_MARGIN : 4)
|
||||
parameter_x = @sprite.bitmap.width - PARAMETER_KEY_WIDTH * (4 - i)
|
||||
key_bind = @key_binds[i]
|
||||
if key_bind && key_bind.type > KeyBind::Type::Key && key_bind.type < KeyBind::Type::JButton
|
||||
if !(@waiting_for_key && i == @selection) && key_bind && key_bind.type > KeyBind::Type::Key && key_bind.type < KeyBind::Type::JButton
|
||||
icon_x, icon_y = case key_bind.type
|
||||
when KeyBind::Type::CButton
|
||||
GamepadIcons.button(key_bind.button)
|
||||
|
|
@ -821,12 +822,12 @@ class Window_Settings
|
|||
@waiting_for_key = @settings_content.waiting_for_key = false
|
||||
apply
|
||||
redraw
|
||||
elsif c_button
|
||||
elsif c_button && (!Input.press?(Input::ACTION) || @accept_action)
|
||||
Settings[@parameter][@selection] = KeyBind.cbutton(c_button)
|
||||
@waiting_for_key = @settings_content.waiting_for_key = false
|
||||
apply
|
||||
redraw
|
||||
elsif c_axis
|
||||
elsif c_axis && (!Input.press?(Input::ACTION) || @accept_action)
|
||||
Settings[@parameter][@selection] = KeyBind.caxis(c_axis, Input::c_axis_pressure(c_axis) > 0 ? KeyBind::Positive : KeyBind::Negative)
|
||||
@waiting_for_key = @settings_content.waiting_for_key = false
|
||||
apply
|
||||
|
|
|
|||
|
|
@ -77,6 +77,16 @@ module Settings
|
|||
end
|
||||
end
|
||||
|
||||
def vsync(value)
|
||||
if value == 0
|
||||
Graphics.setVsync(1)
|
||||
elsif value == 1
|
||||
Graphics.setVsync(-1)
|
||||
else
|
||||
Graphics.setVsync(0)
|
||||
end
|
||||
end
|
||||
|
||||
def SDL_HINT_SHUTDOWN_DBUS_ON_QUIT(value)
|
||||
if value
|
||||
Sunshine.setSDLHint("SDL_HINT_SHUTDOWN_DBUS_ON_QUIT", "1")
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ uniform int lightSourcesCount;
|
|||
uniform float ambientLight;
|
||||
|
||||
uniform sampler2D texture;
|
||||
uniform sampler2D wallMapTexture;
|
||||
//uniform sampler2D wallMapTexture;
|
||||
|
||||
uniform vec2 wallMapResolution;
|
||||
|
||||
|
|
@ -24,8 +24,8 @@ float distance(vec2 a, vec2 b){
|
|||
|
||||
void main(){
|
||||
vec2 screenPoint = v_texCoord / texSizeInv;
|
||||
vec2 mapPoint = cameraPosition + screenPoint;
|
||||
vec2 wallmapUV = mapPoint / tileSize / wallMapResolution;
|
||||
//vec2 mapPoint = cameraPosition + screenPoint;
|
||||
//vec2 wallmapUV = mapPoint / tileSize / wallMapResolution;
|
||||
|
||||
vec3 light = vec3(0, 0, 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ inline uint8_t formatSampleSize(int sdlFormat){
|
|||
case SDL_AUDIO_S16BE :
|
||||
return 2;
|
||||
default :
|
||||
crash(Exception::MEOW, "Unhandled sample format");
|
||||
crash(Exception::SDLError, true, "Unhandled sample format");
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
@ -201,7 +201,7 @@ inline ALenum chooseALFormat(int sampleSize, int channelCount){
|
|||
case 2 : return AL_FORMAT_STEREO16;
|
||||
}
|
||||
default :
|
||||
crash(Exception::MEOW, "Unhandled sample size / channel count");
|
||||
crash(Exception::SDLError, true, "Unhandled sample size / channel count");
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -223,9 +223,8 @@ void ALStream::openSource(const std::string &filename){
|
|||
shState->fileSystem().openRead(handler, filename.c_str());
|
||||
source = handler.source;
|
||||
needsRewind.clear();
|
||||
|
||||
if (!source)
|
||||
crash(Exception::MEOW, "Unable to decode audio stream: %s: %s", filename.c_str(), handler.errorMsg.c_str());
|
||||
crash(Exception::SDLError, true, "Unable to decode audio stream: %s: %s", filename.c_str(), handler.errorMsg.c_str());
|
||||
}
|
||||
|
||||
void ALStream::stopStream(){
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@
|
|||
#define GUARD_MEGA \
|
||||
{ \
|
||||
if (p->megaSurface) \
|
||||
crash(Exception::MKXPError, "Operation not supported for mega surfaces"); \
|
||||
crash(Exception::MKXPError, true, "Operation not supported for mega surfaces"); \
|
||||
}
|
||||
|
||||
#define OUTLINE_SIZE 1
|
||||
|
|
@ -221,12 +221,11 @@ struct BitmapOpenHandler : FileSystem::OpenHandler{
|
|||
|
||||
Bitmap::Bitmap(const char *filename){
|
||||
BitmapOpenHandler handler;
|
||||
char msg[1024];
|
||||
shState->fileSystem().openRead(handler, filename);
|
||||
SDL_Surface *imgSurf = handler.surf;
|
||||
|
||||
if (!imgSurf)
|
||||
crash(Exception::SDLError, "Error loading image '%s': %s", filename, SDL_GetError());
|
||||
crash(Exception::SDLError, true, "Error loading image '%s': %s", filename, SDL_GetError());
|
||||
|
||||
p->ensureFormat(imgSurf, SDL_PIXELFORMAT_ABGR8888);
|
||||
|
||||
|
|
@ -262,7 +261,7 @@ Bitmap::Bitmap(const char *filename){
|
|||
|
||||
Bitmap::Bitmap(int width, int height){
|
||||
if (width <= 0 || height <= 0)
|
||||
crash(Exception::RGSSError, "failed to create bitmap");
|
||||
crash(Exception::RGSSError, true, "failed to create bitmap");
|
||||
|
||||
TEXFBO tex = shState->texPool().request(width, height);
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,6 @@ void Config::read(int argc, char *argv[]){
|
|||
PO_DESC(fixedAspectRatio, bool, true) \
|
||||
/*PO_DESC(AspectPreset, int, 1)*/ \
|
||||
PO_DESC(smoothScaling, bool, false) \
|
||||
PO_DESC(vsync, bool, true) \
|
||||
PO_DESC(defScreenW, int, 0) \
|
||||
PO_DESC(defScreenH, int, 0) \
|
||||
PO_DESC(windowTitle, std::string, "") \
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ struct Config{
|
|||
bool resolutionOverridden;
|
||||
bool Windows_AllocConsole;
|
||||
bool smoothScaling;
|
||||
bool vsync;
|
||||
bool pancakes;
|
||||
int defScreenW;
|
||||
int defScreenH;
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ void Color::serialize(char *buffer) const{
|
|||
|
||||
Color *Color::deserialize(const char *data, int len){
|
||||
if (len != 32)
|
||||
crash(Exception::ArgumentError, "Color: Serialized data invalid");
|
||||
crash(Exception::ArgumentError, true, "Color: Serialized data invalid");
|
||||
|
||||
Color *c = new Color();
|
||||
|
||||
|
|
@ -219,7 +219,7 @@ void Tone::serialize(char *buffer) const{
|
|||
|
||||
Tone *Tone::deserialize(const char *data, int len){
|
||||
if (len != 32)
|
||||
crash(Exception::ArgumentError, "Tone: Serialized data invalid");
|
||||
crash(Exception::ArgumentError, true, "Tone: Serialized data invalid");
|
||||
|
||||
Tone *t = new Tone();
|
||||
|
||||
|
|
@ -350,7 +350,7 @@ void Rect::serialize(char *buffer) const{
|
|||
|
||||
Rect *Rect::deserialize(const char *data, int len){
|
||||
if (len != 16)
|
||||
crash(Exception::ArgumentError, "Rect: Serialized data invalid");
|
||||
crash(Exception::ArgumentError, true, "Rect: Serialized data invalid");
|
||||
|
||||
Rect *r = new Rect();
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#include <SDL3/SDL_touch.h>
|
||||
#include <SDL3/SDL_rect.h>
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <SDL3/SDL_video.h>
|
||||
|
||||
#include "sharedstate.h"
|
||||
#include "graphics.h"
|
||||
|
|
@ -84,6 +85,7 @@ enum{
|
|||
REQUEST_WINMOVETO,
|
||||
REQUEST_MESSAGEBOX,
|
||||
REQUEST_SETCURSORVISIBLE,
|
||||
REQUEST_VSYNC,
|
||||
|
||||
UPDATE_FPS,
|
||||
UPDATE_SCREEN_RECT,
|
||||
|
|
@ -96,15 +98,13 @@ SDL_Gamepad* gc = nullptr;
|
|||
|
||||
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)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
EventThread::EventThread()
|
||||
: fullscreen(false), showCursor(true){}
|
||||
EventThread::EventThread(): fullscreen(false), showCursor(true){}
|
||||
|
||||
void EventThread::process(RGSSThreadData &rtData){
|
||||
SDL_Event event;
|
||||
|
|
@ -412,8 +412,10 @@ void EventThread::process(RGSSThreadData &rtData){
|
|||
|
||||
default :
|
||||
/* Handle user events */
|
||||
switch(event.type - usrIdStart)
|
||||
{
|
||||
switch(event.type - usrIdStart){
|
||||
case REQUEST_VSYNC:
|
||||
SDL_GL_SetSwapInterval(event.user.code);
|
||||
break;
|
||||
case REQUEST_SETFULLSCREEN :
|
||||
setFullscreen(win, static_cast<bool>(event.user.code));
|
||||
break;
|
||||
|
|
@ -511,10 +513,6 @@ bool EventThread::eventFilter(void *data, SDL_Event *event){
|
|||
Debug() << "SDL_EVENT_TERMINATING";
|
||||
return 0;
|
||||
|
||||
case SDL_EVENT_LOW_MEMORY :
|
||||
Debug() << "SDL_EVENT_LOW_MEMORY";
|
||||
return 0;
|
||||
|
||||
/* Workaround for Windows pausing on drag */
|
||||
default:
|
||||
if (event->window.type == SDL_EVENT_WINDOW_MOVED){
|
||||
|
|
@ -579,6 +577,13 @@ void EventThread::requestFullscreenMode(bool mode){
|
|||
SDL_PushEvent(&event);
|
||||
}
|
||||
|
||||
void EventThread::requestVsync(int interval){
|
||||
SDL_Event event;
|
||||
event.type = usrIdStart + REQUEST_VSYNC;
|
||||
event.user.code = interval;
|
||||
SDL_PushEvent(&event);
|
||||
}
|
||||
|
||||
void EventThread::requestWindowMove(int x, int y){
|
||||
SDL_Event event;
|
||||
event.type = usrIdStart + REQUEST_WINMOVETO;
|
||||
|
|
|
|||
|
|
@ -96,6 +96,7 @@ public:
|
|||
void requestWindowMove(int x, int y);
|
||||
void requestWindowResize(int width, int height);
|
||||
void requestShowCursor(bool mode);
|
||||
void requestVsync(int interval);
|
||||
|
||||
void requestTerminate();
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
struct Exception{
|
||||
enum Type{
|
||||
RGSSError,
|
||||
RUBYError,
|
||||
NoFileError,
|
||||
IOError,
|
||||
|
||||
|
|
@ -42,9 +43,6 @@ struct Exception{
|
|||
|
||||
//modloader
|
||||
ModLoaderError,
|
||||
|
||||
// For crash()
|
||||
MEOW
|
||||
};
|
||||
|
||||
Type type;
|
||||
|
|
|
|||
|
|
@ -127,22 +127,20 @@ TTF_Font *SharedFontState::getFont(std::string family, unsigned int size){
|
|||
SDL_IOStream *ops;
|
||||
|
||||
if (family.empty()){
|
||||
crash(Exception::RGSSError, "font does not exist");
|
||||
crash(Exception::RGSSError, true, "font does not exist");
|
||||
}else{
|
||||
/* Use 'other' path as alternative in case
|
||||
* we have no 'regular' styled font asset */
|
||||
const char *path = !req.regular.empty()
|
||||
? req.regular.c_str() : req.other.c_str();
|
||||
|
||||
//ops = SDL_OpenIO();
|
||||
// SDL_IOStream* ops;
|
||||
shState->fileSystem().openReadRaw(ops, path);
|
||||
}
|
||||
|
||||
font = TTF_OpenFontIO(ops, 1, size);
|
||||
|
||||
if (!font){
|
||||
crash(Exception::SDLError, "%s", SDL_GetError());
|
||||
crash(Exception::SDLError, true, "%s", SDL_GetError());
|
||||
}
|
||||
|
||||
p->pool.insert(key, font);
|
||||
|
|
@ -303,7 +301,7 @@ void Font::setSize(int value){
|
|||
|
||||
/* Catch illegal values (according to RMXP) */
|
||||
if (value < 6 || value > 96)
|
||||
crash(Exception::ArgumentError, "%s", "bad value for size");
|
||||
crash(Exception::ArgumentError, true, "%s", "bad value for size");
|
||||
|
||||
p->size = value;
|
||||
p->sdlFont = 0;
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ void initGLFunctions(){
|
|||
int glMajor = *ver - '0';
|
||||
|
||||
if (glMajor < 2)
|
||||
crash(Exception::MKXPError, "At least OpenGL (ES) 2.0 is required");
|
||||
crash(Exception::MKXPError, false, "At least OpenGL (ES) 2.0 is required");
|
||||
|
||||
if (gles){
|
||||
GL_ES_FUN;
|
||||
|
|
@ -126,7 +126,7 @@ void initGLFunctions(){
|
|||
}
|
||||
}
|
||||
else{
|
||||
crash(Exception::MKXPError, "No FBO support available");
|
||||
crash(Exception::MKXPError, false, "No FBO support available");
|
||||
}
|
||||
|
||||
/* VAO entrypoints */
|
||||
|
|
|
|||
|
|
@ -958,6 +958,10 @@ void Graphics::setFullscreen(bool value){
|
|||
p->threadData->ethread->requestFullscreenMode(value);
|
||||
}
|
||||
|
||||
void Graphics::setVsync(int value){
|
||||
p->threadData->ethread->requestVsync(value);
|
||||
}
|
||||
|
||||
bool Graphics::getSmooth() const{
|
||||
return p->threadData->config.smoothScaling;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,6 +58,8 @@ public:
|
|||
|
||||
void reset();
|
||||
|
||||
void setVsync(int value);
|
||||
|
||||
/* Non-standard extension */
|
||||
DECL_ATTR( Fullscreen, bool )
|
||||
DECL_ATTR( ShowCursor, bool )
|
||||
|
|
|
|||
35
src/main.cpp
35
src/main.cpp
|
|
@ -99,7 +99,7 @@ int rgssThreadFun(void *userdata){
|
|||
glCtx = SDL_GL_CreateContext(win);
|
||||
|
||||
if (!glCtx){
|
||||
crash(Exception::MEOW, "Error creating context: %s", SDL_GetError());
|
||||
crash(Exception::SDLError, false, "Error creating context: %s", SDL_GetError());
|
||||
rgssThreadError(threadData, std::string(msg));
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -108,7 +108,7 @@ int rgssThreadFun(void *userdata){
|
|||
initGLFunctions();
|
||||
}
|
||||
catch (const Exception &exc){
|
||||
crash(Exception::MEOW, exc.msg.c_str());
|
||||
crash(Exception::RGSSError, false, exc.msg.c_str());
|
||||
rgssThreadError(threadData, exc.msg);
|
||||
SDL_GL_DestroyContext(glCtx);
|
||||
return 0;
|
||||
|
|
@ -125,9 +125,6 @@ int rgssThreadFun(void *userdata){
|
|||
Debug() << "[main] GL Renderer :" << glGetStringInt(GL_RENDERER);
|
||||
Debug() << "[main] GL Version :" << glGetStringInt(GL_VERSION);
|
||||
Debug() << "[main] GLSL Version :" << glGetStringInt(GL_SHADING_LANGUAGE_VERSION);
|
||||
|
||||
bool vsync = conf.vsync || conf.syncToRefreshrate;
|
||||
SDL_GL_SetSwapInterval(vsync ? 1 : 0);
|
||||
#ifndef NDEBUG
|
||||
GLDebugLogger dLogger;
|
||||
#endif
|
||||
|
|
@ -136,7 +133,6 @@ int rgssThreadFun(void *userdata){
|
|||
ALCcontext *alcCtx = alcCreateContext(threadData->alcDev, 0);
|
||||
|
||||
if (!alcCtx){
|
||||
crash(Exception::MEOW, "Error creating OpenAL context");
|
||||
rgssThreadError(threadData, "Error creating OpenAL context");
|
||||
SDL_GL_DestroyContext(glCtx);
|
||||
return 0;
|
||||
|
|
@ -147,11 +143,9 @@ int rgssThreadFun(void *userdata){
|
|||
try{
|
||||
SharedState::initInstance(threadData);
|
||||
}catch (const Exception &exc){
|
||||
crash(Exception::MEOW, exc.msg.c_str());
|
||||
rgssThreadError(threadData, exc.msg);
|
||||
alcDestroyContext(alcCtx);
|
||||
SDL_GL_DestroyContext(glCtx);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -165,7 +159,6 @@ int rgssThreadFun(void *userdata){
|
|||
|
||||
alcDestroyContext(alcCtx);
|
||||
SDL_GL_DestroyContext(glCtx);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -224,13 +217,11 @@ int main(int argc, char *argv[]){
|
|||
#if dos
|
||||
__djgpp_nearptr_enable();
|
||||
#endif
|
||||
|
||||
SecurityManagerInit();
|
||||
startTime = boost::chrono::high_resolution_clock::now();
|
||||
loadLanguageMetadata(); //there will be a segfault on fclose if I don't move it here
|
||||
|
||||
SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0");
|
||||
SDL_SetAppMetadata("Oneshot: Sunshine", "0.1.1", "com.catwindowteam.sunshine");
|
||||
SDL_SetAppMetadata("Oneshot: Sunshine", "0.1.2", "com.catwindowteam.sunshine");
|
||||
//X11 work on *BSD,Solaris too!
|
||||
#if unix_like
|
||||
SDL_SetHint(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, "0");
|
||||
|
|
@ -250,19 +241,19 @@ int main(int argc, char *argv[]){
|
|||
#endif
|
||||
/* initialize SDL first */
|
||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMEPAD) == false){
|
||||
crash(Exception::MEOW, "Error initializing SDL: %s", SDL_GetError());
|
||||
crash(Exception::SDLError, false, "Error initializing SDL: %s", SDL_GetError());
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef STEAM
|
||||
if (!STEAMSHIM_init()){
|
||||
crash(Exception::MEOW, "Could not initialize Steamworks API");
|
||||
crash(Exception::SDLError, false, "Could not initialize Steamworks API");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!EventThread::allocUserEvents()){
|
||||
crash(Exception::MEOW, "Error allocating SDL user events");
|
||||
crash(Exception::SDLError, false, "Error allocating SDL user events");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -293,7 +284,7 @@ int main(int argc, char *argv[]){
|
|||
|
||||
if (!conf.gameFolder.empty()){
|
||||
if (chdir(conf.gameFolder.c_str()) != 0){
|
||||
crash(Exception::MEOW, "Unable to switch into gameFolder %s", conf.gameFolder.c_str());
|
||||
crash(Exception::SDLError, false, "Unable to switch into gameFolder %s", conf.gameFolder.c_str());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -306,12 +297,12 @@ int main(int argc, char *argv[]){
|
|||
conf.windowTitle = conf.game.title;
|
||||
|
||||
if (TTF_Init() == false){
|
||||
crash(Exception::MEOW, "Error initializing SDL_ttf: %s", SDL_GetError());
|
||||
crash(Exception::SDLError, false,"Error initializing SDL_ttf: %s", SDL_GetError());
|
||||
SDL_Quit();
|
||||
}
|
||||
|
||||
if (Sound_Init() == false){
|
||||
crash(Exception::MEOW, "Error initializing SDL_sound: %s", Sound_GetError());
|
||||
crash(Exception::SDLError, false,"Error initializing SDL_sound: %s", Sound_GetError());
|
||||
TTF_Quit();
|
||||
SDL_Quit();
|
||||
|
||||
|
|
@ -326,7 +317,7 @@ int main(int argc, char *argv[]){
|
|||
SDL_SetWindowFullscreen(win, true);
|
||||
|
||||
if (!win){
|
||||
crash(Exception::MEOW, "Error creating window: %s", SDL_GetError());
|
||||
crash(Exception::SDLError, false,"Error creating window: %s", SDL_GetError());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -342,7 +333,7 @@ int main(int argc, char *argv[]){
|
|||
|
||||
if (!alcDev){
|
||||
SDL_DestroyWindow(win);
|
||||
crash(Exception::MEOW, "Error opening OpenAL device");
|
||||
crash(Exception::SDLError, false, "Error opening OpenAL device");
|
||||
TTF_Quit();
|
||||
SDL_Quit();
|
||||
return 0;
|
||||
|
|
@ -394,7 +385,7 @@ int main(int argc, char *argv[]){
|
|||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, conf.windowTitle.c_str(), "The RGSS script seems to be stuck and Sunshine will now force quit", win);
|
||||
|
||||
if (!rtData.rgssErrorMsg.empty())
|
||||
crash(Exception::MEOW, rtData.rgssErrorMsg.c_str());
|
||||
crash(Exception::RGSSError, false, rtData.rgssErrorMsg.c_str());
|
||||
|
||||
/* Clean up any remainin events */
|
||||
eventThread.cleanup();
|
||||
|
|
@ -409,7 +400,7 @@ int main(int argc, char *argv[]){
|
|||
|
||||
Sound_Quit();
|
||||
TTF_Quit();
|
||||
SDL_Quit(); // i got "Thread 1 received signal ?, Unknown signal" here on windows after closing game
|
||||
SDL_Quit();
|
||||
|
||||
#ifdef STEAM
|
||||
STEAMSHIM_deinit();
|
||||
|
|
|
|||
106
src/meow.cpp
106
src/meow.cpp
|
|
@ -13,30 +13,39 @@
|
|||
#include "gl-debug.h"
|
||||
#include "gl-fun.h"
|
||||
#include "debugwriter.h"
|
||||
#include "define.h"
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <time.h>
|
||||
#include <fstream>
|
||||
#include <ruby/version.h>
|
||||
#include <zlib.h>
|
||||
#include <AL/al.h>
|
||||
#include <boost/version.hpp>
|
||||
#include <physfs.h>
|
||||
#include <pixman.h>
|
||||
#include <SDL3/SDL_system.h>
|
||||
#include <ruby/internal/intern/vm.h>
|
||||
#include <ruby/internal/error.h>
|
||||
#include <ruby/debug.h>
|
||||
#include <ruby.h>
|
||||
#undef vsnprintf
|
||||
#undef snprintf
|
||||
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
#define BOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED
|
||||
#endif
|
||||
#include <boost/stacktrace.hpp>
|
||||
#include <boost/version.hpp>
|
||||
#include <zlib.h>
|
||||
#include <AL/al.h>
|
||||
#include <physfs.h>
|
||||
#include <pixman.h>
|
||||
#include <SDL3/SDL_system.h>
|
||||
#include <SDL3/SDL_cpuinfo.h>
|
||||
#include "sunshine.h"
|
||||
#ifdef __LINUX__
|
||||
#ifdef unix_like
|
||||
#include <gtk/gtk.h>
|
||||
#include "xdg-user-dir-lookup.h"
|
||||
#elif __ANDROID__
|
||||
#elif android
|
||||
#include <android/trace.h>
|
||||
#include <android/api-level.h>
|
||||
#elif __EMSCRIPTEN__
|
||||
#elif web
|
||||
#include <emscripten/console.h>
|
||||
#elif dos
|
||||
#include <dpmi.h>
|
||||
#endif
|
||||
|
||||
SDL_MessageBoxButtonData buttons[] = {
|
||||
|
|
@ -48,8 +57,10 @@ static inline const char* glGetStringInt(GLenum name){
|
|||
return (const char*) gl.GetString(name);
|
||||
}
|
||||
|
||||
void crash(Exception::Type t, const char *fmt, ...){
|
||||
char msg[1024];
|
||||
void crash(Exception::Type t, bool do_crash, const char *fmt, ...){
|
||||
static char msg[1024];
|
||||
static const char* reason = nullptr;
|
||||
static const char* solution = nullptr;
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
va_list args_copy;
|
||||
|
|
@ -59,7 +70,18 @@ void crash(Exception::Type t, const char *fmt, ...){
|
|||
char *buf = (char*)SDL_malloc((size_t)len + 1);
|
||||
SDL_vsnprintf(buf, (size_t)len + 1, fmt, args);
|
||||
va_end(args);
|
||||
SDL_snprintf(msg, sizeof msg, "Error occured! Error message: %s\n\n Want to create a crash SDL_log? You can share the crash SDL_log with the developers and help resolve the issue.", buf);
|
||||
if(t == Exception::ModLoaderError){
|
||||
reason = "Broken mod";
|
||||
solution = "Fix mode manualy or ask developer to fix it or delete mod";
|
||||
}else if(t == Exception::NoFileError){
|
||||
reason = "Broken installation";
|
||||
solution = "Try reinstall game";
|
||||
}else{
|
||||
reason = "Unknown";
|
||||
solution = "Unknown";
|
||||
}
|
||||
|
||||
SDL_snprintf(msg, sizeof msg, "Error occured! Error message: %s\n\nWant to create a crash log? You can share the crash log with the developers and help resolve the issue.\n\nPossible reason:%s\n\nPossible solution: %s", buf, reason, solution);
|
||||
SDL_MessageBoxData messageboxdata = {
|
||||
.flags = SDL_MESSAGEBOX_ERROR,
|
||||
.window = NULL,
|
||||
|
|
@ -85,21 +107,6 @@ void crash(Exception::Type t, const char *fmt, ...){
|
|||
o << "REASON: " << buf << std::endl;
|
||||
o << "[BOOST stacktrace()]" << std::endl;
|
||||
o << boost::stacktrace::stacktrace() << std::endl;
|
||||
o << "[OpenGL]" << std::endl;
|
||||
if (gl.GetString){
|
||||
try{
|
||||
o << "GL Vendor: " << glGetStringInt(GL_VENDOR) << std::endl;
|
||||
o << "GL Renderer: " << glGetStringInt(GL_RENDERER) << std::endl;
|
||||
o << "GL Version: " << glGetStringInt(GL_VERSION) << std::endl;
|
||||
o << "GLSL Version: " << glGetStringInt(GL_SHADING_LANGUAGE_VERSION) << std::endl;
|
||||
o << "Shading language version: " << glGetStringInt(GL_SHADING_LANGUAGE_VERSION) << std::endl;
|
||||
o << "GL Extensions: " << glGetStringInt(GL_EXTENSIONS) << std::endl;
|
||||
}catch(const std::exception& e){
|
||||
o << "Crashed before OpenGL initialization: " << e.what() << std::endl;
|
||||
}
|
||||
}else{
|
||||
o << "OpenGL not initialized yet" << std::endl;
|
||||
}
|
||||
o << "[Versions of libs]" << std::endl;
|
||||
const int sdlcompiled = SDL_VERSION;
|
||||
const int sdllinked = SDL_GetVersion();
|
||||
|
|
@ -119,10 +126,11 @@ void crash(Exception::Type t, const char *fmt, ...){
|
|||
}catch(const std::exception& e){
|
||||
o << "Detected OS: " << e.what() << std::endl;
|
||||
}
|
||||
if(!SDL_getenv("XDG_CURRENT_DESKTOP") == NULL){
|
||||
#ifdef unix_like
|
||||
if(SDL_getenv("XDG_CURRENT_DESKTOP") != nullptr){
|
||||
o << "Desktop enviroment(XDG_CURRENT_DESKTOP): " << SDL_getenv("XDG_CURRENT_DESKTOP") << std::endl;
|
||||
}
|
||||
#ifdef __ANDROID__
|
||||
#elif android
|
||||
o << "Android API version: " << android_get_device_api_level() << std::endl;
|
||||
o << "External storage State: " << SDL_GetAndroidExternalStorageState() << std::endl;
|
||||
o << "Internal storage path: " << SDL_GetAndroidInternalStoragePath() << std::endl;
|
||||
|
|
@ -136,32 +144,54 @@ void crash(Exception::Type t, const char *fmt, ...){
|
|||
o << "Is TV? " << SDL_IsTV() << std::endl;
|
||||
o << "Is Ubuntu Touch? " << SDL_IsUbuntuTouch() << std::endl;
|
||||
}
|
||||
#elif __EMSCRIPTEN__
|
||||
#elif web
|
||||
o << "Emscripten start address of the stack: " << emscripten_stack_get_base() << std::endl;
|
||||
o << "Emscripten end address of the stack: " << emscripten_stack_get_end() << std::endl;
|
||||
o << "Emscripten current stack pointer: " << emscripten_stack_get_current() << std::endl;
|
||||
o << "Emscripten number of free bytes left on stack: " << emscripten_stack_get_free() << std::endl;
|
||||
#elif __PSP__
|
||||
o << "PSPdev MIPS Stack Trace: " << int pspDebugGetStackTrace() << std::endl;
|
||||
#elif psp
|
||||
o << "PSPdev MIPS Stack Trace: " << pspDebugGetStackTrace() << std::endl;
|
||||
#elif dos
|
||||
o << "DPMI virtual interrupt state: " << __dpmi_get_virtual_interrupt_state() << std::endl;
|
||||
o << "DPMI selector increment value: " << __dpmi_get_selector_increment_value() << std::endl;
|
||||
o << "DPMI coprocessor status: " << __dpmi_get_coprocessor_status() << std::endl;
|
||||
o << "DPMI is 80387 processor?: " << _detect_80387() << std::endl;
|
||||
#endif
|
||||
o << "[Hardware]" << std::endl;
|
||||
o << "number of logical CPU cores: " << SDL_GetNumLogicalCPUCores() << std::endl;
|
||||
o << "System RAM size: " << SDL_GetSystemRAM() << " MiB" << std::endl;
|
||||
o << "[Ruby]" << std::endl;
|
||||
o << "Is GC was busy? " << rb_during_gc() << std::endl;
|
||||
o << "[OpenGL]" << std::endl;
|
||||
try{
|
||||
o << "GL Vendor: " << glGetStringInt(GL_VENDOR) << std::endl;
|
||||
o << "GL Renderer: " << glGetStringInt(GL_RENDERER) << std::endl;
|
||||
o << "GL Version: " << glGetStringInt(GL_VERSION) << std::endl;
|
||||
o << "GLSL Version: " << glGetStringInt(GL_SHADING_LANGUAGE_VERSION) << std::endl;
|
||||
o << "Shading language version: " << glGetStringInt(GL_SHADING_LANGUAGE_VERSION) << std::endl;
|
||||
o << "GL Extensions: " << glGetStringInt(GL_EXTENSIONS) << std::endl;
|
||||
}catch(const std::exception& e){
|
||||
o << "Crashed before OpenGL initialization: " << e.what() << std::endl;
|
||||
}
|
||||
o.close();
|
||||
}else{
|
||||
Debug() << "[CRASHLOG] Failed to write crashdump file";
|
||||
ErrorMsg("[CRASHLOG] Failed to write crashdump file");
|
||||
}
|
||||
}
|
||||
|
||||
if(t != Exception::MEOW)
|
||||
throw Exception(t, msg);
|
||||
if(do_crash){
|
||||
rb_exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ErrorMsg(const char* message){
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", message, NULL);
|
||||
if (SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", message, NULL)){
|
||||
//TODO: error handling
|
||||
}
|
||||
}
|
||||
|
||||
void WarnMsg(const char* message){
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, "Warning", message, NULL);
|
||||
if(SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, "Warning", message, NULL)){
|
||||
//TODO: error handling
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "exception.h"
|
||||
|
||||
void crash(Exception::Type t, const char *fmt, ...);
|
||||
void crash(Exception::Type t, bool do_crash, const char *fmt, ...);
|
||||
void ErrorMsg(const char* message);
|
||||
void WarnMsg(const char* message);
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ std::string sha512(const std::string str){
|
|||
std::string sha256_file(const std::string &fn) {
|
||||
FILE *file = fopen(fn.c_str(), "rb");
|
||||
if (!file) {
|
||||
crash(Exception::ModLoaderError, "Failed to load mod, filesystem error.");
|
||||
crash(Exception::IOError, true, "Failed to load mod, filesystem error.");
|
||||
}
|
||||
|
||||
unsigned char buf[1024];
|
||||
|
|
@ -97,7 +97,7 @@ void ModLoader(){
|
|||
std::string full = p.string();
|
||||
int ok = PHYSFS_mount(full.c_str(), "/mod-storage", 0);
|
||||
if (!ok) {
|
||||
crash(Exception::ModLoaderError, "PhysFS_mount failed: %s", PHYSFS_getLastError());
|
||||
crash(Exception::ModLoaderError, false, "PhysFS_mount failed: %s", PHYSFS_getLastError());
|
||||
}
|
||||
Debug() << "[MODLOADER] " << full;
|
||||
mod_list.push_back(full);
|
||||
|
|
@ -111,6 +111,6 @@ void ModLoader(){
|
|||
Debug() << "[MODLOADER] BuildID: " << buildID;
|
||||
modloader_is_enabled = true;
|
||||
}catch(const std::exception& e){
|
||||
crash(Exception::ModLoaderError, "Something is wrong, Exception: %s ", e.what());
|
||||
crash(Exception::ModLoaderError, true, "Something is wrong, Exception: %s ", e.what());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ int screenMain(Config &conf){
|
|||
win = SDL_CreateWindow("The Journal", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, SDL_WINDOW_RESIZABLE | SDL_WINDOW_TRANSPARENT);
|
||||
|
||||
if (!win){
|
||||
crash(Exception::MEOW, "Error creating window: %s", SDL_GetError());
|
||||
crash(Exception::SDLError, true, "Error creating window: %s", SDL_GetError());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
inline char* securitystate = "unsandboxed";
|
||||
inline const char* securitystate = "unsandboxed";
|
||||
void SecurityManagerInit();
|
||||
void SecurityManagerDeInit();
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ SoundBuffer *SoundEmitter::allocateBuffer(const std::string &filename){
|
|||
buffer = handler.buffer;
|
||||
|
||||
if (!buffer){
|
||||
crash(Exception::MEOW, "Unable to decode sound: %s: %s", filename.c_str(), Sound_GetError());
|
||||
crash(Exception::SDLError, false, "Unable to decode sound: %s: %s", filename.c_str(), Sound_GetError());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ void Table::serialize(char *buffer) const{
|
|||
|
||||
Table *Table::deserialize(const char *data, int len){
|
||||
if (len < 20)
|
||||
crash(Exception::RGSSError, "Marshal: Table: bad file format");
|
||||
crash(Exception::RGSSError, true, "Marshal: Table: bad file format");
|
||||
|
||||
readInt32(&data);
|
||||
int x = readInt32(&data);
|
||||
|
|
@ -123,10 +123,10 @@ Table *Table::deserialize(const char *data, int len){
|
|||
int size = readInt32(&data);
|
||||
|
||||
if (size != x*y*z)
|
||||
crash(Exception::RGSSError, "Marshal: Table: bad file format");
|
||||
crash(Exception::RGSSError, true, "Marshal: Table: bad file format");
|
||||
|
||||
if (len != 20 + x*y*z*2)
|
||||
crash(Exception::RGSSError, "Marshal: Table: bad file format");
|
||||
crash(Exception::RGSSError, true, "Marshal: Table: bad file format");
|
||||
|
||||
Table *t = new Table(x, y, z);
|
||||
SDL_memcpy(dataPtr(t->data), data, sizeof(int16_t)*size);
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ TEXFBO TexPool::request(int width, int height){
|
|||
|
||||
int maxSize = glState.caps.maxTexSize;
|
||||
if (width > maxSize || height > maxSize){
|
||||
crash(Exception::MKXPError, "Texture dimensions [%d, %d] exceed hardware capabilities", width, height);
|
||||
crash(Exception::MKXPError, true, "Texture dimensions [%d, %d] exceed hardware capabilities", width, height);
|
||||
}
|
||||
|
||||
/* Nope, create it instead */
|
||||
|
|
@ -162,8 +162,7 @@ void TexPool::release(TEXFBO &obj){
|
|||
|
||||
CNodeList &bucket = p->poolHash[removedSize];
|
||||
|
||||
std::list<CacheNode>::iterator toRemove =
|
||||
std::find(bucket.begin(), bucket.end(), last);
|
||||
std::list<CacheNode>::iterator toRemove = std::find(bucket.begin(), bucket.end(), last);
|
||||
assert(toRemove != bucket.end());
|
||||
bucket.erase(toRemove);
|
||||
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ struct VorbisSource : ALDataSource{
|
|||
|
||||
if (error){
|
||||
SDL_CloseIO(&src);
|
||||
crash(Exception::MKXPError, "Vorbisfile: Cannot read ogg file");
|
||||
crash(Exception::MKXPError, true, "Vorbisfile: Cannot read ogg file");
|
||||
}
|
||||
|
||||
/* Extract bitstream info */
|
||||
|
|
@ -89,7 +89,7 @@ struct VorbisSource : ALDataSource{
|
|||
if (info.channels > 2){
|
||||
ov_clear(&vf);
|
||||
SDL_CloseIO(&src);
|
||||
crash(Exception::MKXPError, "Cannot handle audio with more than 2 channels");
|
||||
crash(Exception::MKXPError, true, "Cannot handle audio with more than 2 channels");
|
||||
}
|
||||
|
||||
info.alFormat = chooseALFormat(sizeof(int16_t), info.channels);
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <stdio.h>
|
||||
/**
|
||||
* xdg_user_dir_lookup_with_fallback:
|
||||
* @type: a string specifying the type of directory
|
||||
|
|
|
|||
Loading…
Reference in a new issue