This commit is contained in:
DepressedTWM 2026-08-19 09:24:15 +04:00
parent 8da6b3d7d6
commit f96527d3e1
13 changed files with 50 additions and 52 deletions

View file

@ -3,6 +3,14 @@ project(oneshot)
include(FindPackageHandleStandardArgs)
include(CheckCXXCompilerFlag)
include(CheckCCompilerFlag)
include(CheckIPOSupported)
check_ipo_supported(
RESULT ipo_supported
OUTPUT ipo_error
LANGUAGES CXX C
)
# Helper for checking if options supported
function(check_option var a)
set(all ${a})
@ -346,7 +354,8 @@ if(DEBUG)
-g3
-fno-omit-frame-pointer
-Og
-fcheck-new)
-fcheck-new
-fstrict-flex-arrays=3)
add_compile_options(${OPTIONS_DEBUG})
if("${ARCH_DEBUG}" STREQUAL "")
@ -369,7 +378,9 @@ else()
-frename-registers
-fuse-linker-plugin
-fipa-pta
-fext-dce)
-fext-dce
-fstrict-enums
-fimplicit-constexpr)
add_compile_options(${OPTIONS_RELEASE})
add_link_options(-Wl,-O2
@ -378,11 +389,7 @@ else()
-Wl,--no-undefined
-Wl,--strip-all
-Wl,--no-copy-dt-needed-entries)
if(NOT WIN32)
check_option(OPTIONS_RELEASE_WIN32_FLTO -flto=thin)
add_compile_options(${OPTIONS_RELEASE_WIN32_FLTO})
add_link_options(${OPTIONS_RELEASE_WIN32_FLTO})
endif()
if("${ARCH_RELEASE}" STREQUAL "")
message(STATUS "ARCH_RELEASE empty")
else()
@ -409,6 +416,17 @@ else()
)
endif()
if(NOT DEBUG)
if(ipo_supported)
set_property(
TARGET ${PROJECT_NAME}
PROPERTY INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE
)
else()
message(WARNING "IPO/LTO is not supported: ${ipo_error}")
endif()
endif()
if(DEVBUILD)
target_compile_definitions(${PROJECT_NAME} PRIVATE DEVBUILD)
endif()

View file

@ -108,7 +108,6 @@ RB_METHOD(audioReset) {
}
void audioBindingInit(){
printf("[audioBindingInit] Initialing Audio binding\n");
VALUE module = rb_define_module("Audio");
rb_define_singleton_method(module, "create_sound", RUBY_METHOD_FUNC(rb_audio_createAudioPlayback), -1);

View file

@ -423,9 +423,13 @@ static void runRMXPScripts(BacktraceData &btData){
}
//Execute preloaded scripts
if(modloader_is_enabled){
for (std::set<std::string>::iterator i = preloadScripts.begin();
i != preloadScripts.end(); ++i)
i != preloadScripts.end(); ++i){
runCustomScript(*i);
}
}
VALUE exc = rb_gv_get("$!");
if (exc != Qnil)

View file

@ -139,9 +139,6 @@ RB_METHOD(kernelSaveData){
VALUE filename;
rb_get_args(argc, argv, "oS", &obj, &filename);
#ifdef DEBUG
printf("[kernelSaveData] Filename: %s\n", rb_str_to_str(filename));
#endif
VALUE file = rb_file_open_str(filename, "wb");
VALUE marsh = rb_const_get(rb_cObject, rb_intern("Marshal"));

View file

@ -343,7 +343,6 @@ static buttonCodes[] = {
static elementsN(buttonCodes);
void inputBindingInit(){
printf("[inputBindingInit] Initializing Input binding\n");
VALUE module = rb_define_module("Input");
initGamepadBinding(module);

View file

@ -29,7 +29,6 @@ VALUE meow(const std::vector<std::string> vec){
return ary;
}
static VALUE hooks(int argc, VALUE *argv, VALUE self) {
VALUE v_path = Qnil;
rb_scan_args(argc, argv, "01", &v_path);

View file

@ -55,7 +55,6 @@ RB_METHOD(steamUnlocked){
}
void steamBindingInit(){
printf("[steamBindingInit] Initializing Steam binding\n");
VALUE module = rb_define_module("Steam");
/* Constants */

View file

@ -83,7 +83,6 @@
}
void desktopEnvironmentInit(){
printf("[desktopEnvironmentInit] desktopEnvironmentInit()\n");
if (desktop != "uninitialized")
return;

View file

@ -67,3 +67,4 @@ GNOME support fixed
Fixed small defect on cg_wake5
Added ModLoader loading screen
Added [Function():string number] debug information in logs
SecurityEngine now enabled only when Modloader is active

View file

@ -67,19 +67,19 @@ public:
~Debug(){
std::ostringstream result;
result << "[" << location.line() << ":" << location.function_name() << "] " << buf.str();
result << "[" << location.line() << ":" << location.function_name() << "] " << buf.view();
#ifdef __ANDROID__
__android_log_write(ANDROID_LOG_DEBUG, "sunshine", result.str().c_str());
__android_log_write(ANDROID_LOG_DEBUG, "sunshine", result.view().c_str());
#elif __EMSCRIPTEN__
emscripten_console_log(result.str().c_str());
emscripten_console_log(result.view().c_str());
#else
logs.push_back(result.str());
std::cout << result.str() << "\n";
logs.emplace_back(result.view());
std::cout << std::move(result).str() << '\n';
#endif
}
private:
std::stringstream buf;
std::ostringstream buf;
std::source_location location;
};

View file

@ -33,7 +33,6 @@
#else
#include <unistd.h>
#endif
#include <assert.h>
#include <string>
#include <iostream>
#include <fstream>
@ -48,7 +47,6 @@
#include "exception.h"
#include "gl-fun.h"
#include "i18n.h"
#include "security.h"
#include "sunshine.h"
#include "modloader.h"
@ -59,19 +57,12 @@
#include "binding.h"
#include "icon.png.xxd"
#include <SDL3/SDL_system.h>
#ifdef STEAM
#include "steamshim/steamshim_child.h"
#else
#include "gamecontrollerdb.txt.xxd"
#endif
#ifdef ps2
#ifdef DEBUG
SDL_PS2_SKIP_IOP_RESET();
#endif
#endif
#ifndef VERSION_STRING
#define VERSION_STRING ">w<"
#endif
@ -82,10 +73,6 @@ static void rgssThreadError(RGSSThreadData *rtData, const std::string &msg){
rtData->rqTermAck.set();
}
static inline const char* glGetStringInt(GLenum name){
return (const char*) gl.GetString(name);
}
int rgssThreadFun(void *userdata){
RGSSThreadData *threadData = static_cast<RGSSThreadData*>(userdata);
const Config &conf = threadData->config;
@ -123,10 +110,6 @@ int rgssThreadFun(void *userdata){
gl.Clear(GL_COLOR_BUFFER_BIT);
SDL_GL_SwapWindow(win);
Debug() << "[main] GL Vendor :" << glGetStringInt(GL_VENDOR);
Debug() << "[main] GL Renderer :" << glGetStringInt(GL_RENDERER);
Debug() << "[main] GL Version :" << glGetStringInt(GL_VERSION);
Debug() << "[main] GLSL Version :" << glGetStringInt(GL_SHADING_LANGUAGE_VERSION);
#ifndef NDEBUG
GLDebugLogger dLogger;
#endif
@ -168,10 +151,13 @@ static void setupWindowIcon(const Config &conf, SDL_Window *win){
}
int main(int argc, char *argv[]){
//I WANT FUCKING OPTIMIZE EVERYFING IN THIS BULLSHIT
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
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.2", "meow.catwindowteam.sunshine");
SDL_SetAppMetadata("Oneshot: Sunshine", VERSION_STRING, "meow.catwindowteam.sunshine");
//X11 work on *BSD,Solaris too!
#if unix_like
SDL_SetHint(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, "0");
@ -184,8 +170,6 @@ int main(int argc, char *argv[]){
SDL_SetHint(SDL_HINT_ANDROID_ALLOW_PERSISTENT_FOLDER_ACCESS, "1");
#elif vita
SDL_SetHint(SDL_HINT_VITA_RESOLUTION, "1080");
#elif ps2
SFL_SetHint(SDL_HINT_PS2_GS_MODE, "NTSC");
#endif
/* initialize SDL first */
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMEPAD) == false){
@ -219,9 +203,6 @@ int main(int argc, char *argv[]){
/* now we load the config */
Config conf;
conf.read(argc, argv);
if(conf.SecurityEngine){
SecurityManagerInit();
}
#if windows
if(conf.Windows_AllocConsole == true){
AllocConsole();

View file

@ -368,4 +368,3 @@ void WarnMsg(const char *fmt, ...) {
Debug() << "[WARNMSG]" << buf;
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, "Warning", buf, NULL);
}

View file

@ -2,6 +2,7 @@
#include "debugwriter.h"
#include "meow.h"
#include "config.h"
#include "security.h"
#include <filesystem>
#include <string>
@ -24,7 +25,7 @@ const static std::size_t N = 46;
static void modloader_add_to_log(const std::string data){
Debug() << "[MODLOADER] " << data;
modloader_logs.push_back(data);
modloader_logs.emplace_back(data);
}
static int renderer_thread(void* data){
@ -74,7 +75,9 @@ void ModLoader(Config conf, SDL_Window* win){
Debug() << "[MODLOADER] Mods directory empty, skip.";
return;
}
if(conf.SecurityEngine){
SecurityManagerInit();
}
SDL_Thread* render_thread_pointer = SDL_CreateThread(renderer_thread, "ModRenderer", win);
if (!render_thread_pointer) {
//TODO: Error handling
@ -92,7 +95,7 @@ void ModLoader(Config conf, SDL_Window* win){
if (ext == ".zip") {
int ok = PHYSFS_mount(full.c_str(), "/mod-storage", 0);
mod_list.push_back(full);
mod_list.emplace_back(full);
modloader_add_to_log("Added mod " + full);
mods_count++;
} else if (ext == ".rb") {