i think i broke something

This commit is contained in:
ZakatTeamI2P 2026-05-26 19:15:37 +04:00
parent 7d65fadbc7
commit 13f319a265
6 changed files with 103 additions and 6 deletions

View file

@ -90,6 +90,7 @@ set(MAIN_HEADERS
chromasdk/RzErrors.h
chromasdk/ChromaApi.h
src/i18n.h
src/meow.h
)
set(MAIN_SOURCE
@ -132,6 +133,7 @@ set(MAIN_SOURCE
src/oneshot.cpp
src/screen.cpp
src/i18n.cpp
src/meow.cpp
)
if(WIN32)
@ -294,7 +296,7 @@ set(BINDING_SOURCE
binding-mri/module_rpg.cpp
binding-mri/filesystem-binding.cpp
binding-mri/oneshot-binding.cpp
binding-mri/sunshine-binding.cpp
binding-mri/sunshine-binding.cpp
binding-mri/steam-binding.cpp
binding-mri/wallpaper-binding.cpp
binding-mri/journal-binding.cpp

View file

@ -115,7 +115,7 @@ static void mriBindingInit(){
wallpaperBindingInit();
nikoBindingInit();
oneshotBindingInit();
SunshineBindingInit();
SunshineBindingInit();
steamBindingInit();
chromaBindingInit();

View file

@ -28,6 +28,7 @@
#include "sharedstate.h"
#include "boost-hash.h"
#include "debugwriter.h"
#include "meow.h"
#include <physfs.h>
@ -53,8 +54,8 @@ struct SDLRWIoContext{
filename(filename)
{
if (!ops)
throw Exception(Exception::SDLError,
"Failed to open file: %s", SDL_GetError());
crash("Failed to open file", 0);
throw Exception(Exception::SDLError, "Failed to open file: %s", SDL_GetError());
}
~SDLRWIoContext(){

View file

@ -49,6 +49,8 @@
#include "gl-fun.h"
#include "i18n.h"
#include "meow.h"
#include "binding.h"
#include "icon.png.xxd"
@ -95,7 +97,6 @@ int rgssThreadFun(void *userdata){
catch (const Exception &exc){
rgssThreadError(threadData, exc.msg);
SDL_GL_DestroyContext(glCtx);
return 0;
}
@ -375,7 +376,7 @@ int main(int argc, char *argv[]){
if (rtData.rqTermAck)
SDL_WaitThread(rgssThread, 0);
else
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, conf.windowTitle.c_str(), "The RGSS script seems to be stuck and OneShot will now force quit", win);
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, conf.windowTitle.c_str(), "The RGSS script seems to be stuck and OneShot: Sunshine will now force quit", win);
if (!rtData.rgssErrorMsg.empty()){
Debug() << rtData.rgssErrorMsg;

92
src/meow.cpp Normal file
View file

@ -0,0 +1,92 @@
#include <SDL3/SDL_messagebox.h>
#include <SDL3/SDL_dialog.h>
#include <SDL3/SDL_version.h>
#include <SDL3/SDL_platform.h>
#include "meow.h"
#include "config.h"
#include <stdio.h>
#include <time.h>
#include <fstream>
#include <ruby.h>
#ifdef __LINUX__
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#endif
SDL_MessageBoxButtonData buttons[] = {
{ SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, 1, "Yes" },
{ SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT, 2, "No" }
};
int crash(const char* reason, int exit_code){
const Config conf;
SDL_MessageBoxData messageboxdata = {
.flags = SDL_MESSAGEBOX_ERROR,
.window = NULL,
.title = "Crashdump",
.message = "Error occured! Want to create a crash log?",
.numbuttons = SDL_arraysize(buttons),
.buttons = buttons,
.colorScheme = NULL
};
int buttonid = 0;
if (SDL_ShowMessageBox(&messageboxdata, &buttonid) == false) {
printf("[CRASHDUMP] %s\n", reason);
}
if(buttonid == 1){
std::ofstream out;
time_t mtime = time(NULL);
struct tm *now = localtime(&mtime);
std::string time = std::to_string(now->tm_hour) + "." + std::to_string(now->tm_min) + "." + std::to_string(now->tm_sec);
out.open("crash_" + time + ".txt");
const int sdlcompiled = SDL_VERSION;
const int sdllinked = SDL_GetVersion();
if (out.is_open()){
out << "[SUNSHINE CRASHDUMP]" << std::endl;
out << "CONFIG" << std::endl;
out << "defScreenW: " << conf.defScreenW << std::endl;
out << "defScreenH: " << conf.defScreenH << std::endl;
out << "debugMode: " << conf.debugMode << std::endl;
out << "screenMode: " << conf.screenMode << std::endl;
out << "fullscreen: " << conf.fullscreen << std::endl;
out << "fixedAspectRatio: " << conf.fixedAspectRatio << std::endl;
out << "smoothScaling: " << conf.smoothScaling << std::endl;
out << "vsync: " << conf.vsync << std::endl;
out << "EnableSixteenByNine: " << conf.EnableSixteenByNine << std::endl;
out << "windowTitle: " << conf.windowTitle << std::endl;
out << "defSfixedFrameratecreenW: " << conf.fixedFramerate << std::endl;
out << "frameSkip: " << conf.frameSkip << std::endl;
out << "syncToRefreshrate: " << conf.syncToRefreshrate << std::endl;
out << "solidFonts: " << conf.solidFonts << std::endl;
out << "subImageFix: " << conf.subImageFix << std::endl;
out << "enableBlitting: " << conf.enableBlitting << std::endl;
out << "maxTextureSize: " << conf.maxTextureSize << std::endl;
out << "gameFolder: " << conf.gameFolder << std::endl;
out << "allowSymlinks: " << conf.allowSymlinks << std::endl;
out << "pathCache: " << conf.pathCache << std::endl;
out << "iconPath: " << conf.iconPath << std::endl;
out << "useScriptNames: " << conf.useScriptNames << std::endl;
out << "customScript: " << conf.customScript << std::endl;
out << "customDataPath: " << conf.customDataPath << std::endl;
out << "commonDataPath: " << conf.commonDataPath << std::endl;
out << "" << std::endl;
out << "Ruby version: " << rb_gv_get("ruby_version") << std::endl;
out << "SDL(compiled) version: " << SDL_VERSIONNUM_MAJOR(sdlcompiled) << "." << SDL_VERSIONNUM_MINOR(sdlcompiled) << "." << SDL_VERSIONNUM_MICRO(sdlcompiled) << std::endl;
out << "SDL(linked) version: " << SDL_VERSIONNUM_MAJOR(sdllinked) << "." << SDL_VERSIONNUM_MINOR(sdllinked) << "." << SDL_VERSIONNUM_MICRO(sdllinked) << std::endl;
out << "Detected OS: " << SDL_GetPlatform() << std::endl;
#ifdef __LINUX__
out << "GTK(compiled) version: " << GTK_MAJOR_VERSION << "." << GTK_MINOR_VERSION << "." << GTK_MICRO_VERSION << std::endl;
#endif
out.close();
}else{
printf("[CRASHLOG] Failed to write crashdump file\n");
}
}
return exit_code;
}

1
src/meow.h Normal file
View file

@ -0,0 +1 @@
int crash(const char* reason, int exit_code);