CmakeLists.txt fix

This commit is contained in:
DepressedTWM 2026-06-26 22:33:18 +04:00
parent 4cad578431
commit 13a113600a
14 changed files with 82 additions and 149 deletions

View file

@ -6,7 +6,9 @@ include(FindPackageHandleStandardArgs)
option(STEAM "Build for Steam" OFF) option(STEAM "Build for Steam" OFF)
option(DEBUG "Debug mode" OFF) option(DEBUG "Debug mode" OFF)
option(NATIVE "Use native instructions(for local use only)" OFF) option(NATIVE "Use native instructions(for local use only)" OFF)
option(MODLOADER "Build with modloader" ON)
#Configuration
set(CMAKE_DISABLE_IN_SOURCE_BUILD TRUE) set(CMAKE_DISABLE_IN_SOURCE_BUILD TRUE)
set(VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION "5.1.2600.0") set(VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION "5.1.2600.0")
set(STEAMWORKS_PATH "${CMAKE_CURRENT_SOURCE_DIR}/steamworks" CACHE PATH "Path to Steamworks folder") set(STEAMWORKS_PATH "${CMAKE_CURRENT_SOURCE_DIR}/steamworks" CACHE PATH "Path to Steamworks folder")
@ -14,30 +16,6 @@ set(ZLIB_USE_STATIC_LIBS ON)
set(OPENSSL_USE_STATIC_LIBS ON) set(OPENSSL_USE_STATIC_LIBS ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_INCLUDE_CURRENT_DIR ON)
if(NATIVE)
if (!MSVC)
add_compile_options(-march=native -mtune=native)
endif()
endif()
if(DEBUG)
if (MSVC)
add_compile_options(/EHr /fsanitize /validate-charset /DEBUG /RTCu /RTCs /RTCc)
else()
add_compile_options(-g3 -O0 -fno-omit-frame-pointer -ggdb -fcheck-new -gbtf)
endif()
else()
if (MSVC)
add_compile_options(/O2 /fp:fast /GL /GF /GA)
else()
add_compile_options(-O2 -ffast-math -fipa-pta -ftree-vectorize -fstdarg-opt -fomit-frame-pointer -frename-registers)
if(!WIN32)
add_compile_options(-flto)
endif()
add_link_options(-Wl,-O2)
endif()
endif()
# main stuff # main stuff
set(MAIN_HEADERS set(MAIN_HEADERS
src/quadarray.h src/quadarray.h
@ -172,9 +150,12 @@ elseif(BSD)
list(APPEND MAIN_SOURCE src/xdg-user-dir-lookup.c) list(APPEND MAIN_SOURCE src/xdg-user-dir-lookup.c)
list(APPEND MAIN_HEADERS src/xdg-user-dir-lookup.h) list(APPEND MAIN_HEADERS src/xdg-user-dir-lookup.h)
set(STEAM OFF) set(STEAM OFF)
set(MODLOADER OFF)
elseif(EMSCRIPTEN) elseif(EMSCRIPTEN)
set(STEAM OFF) set(STEAM OFF)
set(CMAKE_EXECUTABLE_SUFFIX ".html" CACHE INTERNAL "") set(CMAKE_EXECUTABLE_SUFFIX ".html" CACHE INTERNAL "")
elseif(APPLE)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND cmake -P "${CMAKE_SOURCE_DIR}/patches/mac/CompleteBundle.cmake" VERBATIM)
endif() endif()
if (STEAM) if (STEAM)
@ -229,11 +210,30 @@ set(EMBEDDED_INPUT
binding-mri/module_rpg1.rb binding-mri/module_rpg1.rb
) )
# Настройки зависимые от компилятора
if (MSVC) if (MSVC)
list(APPEND DEFINES list(APPEND DEFINES
_CRT_SECURE_NO_WARNINGS _CRT_SECURE_NO_WARNINGS
NOMINMAX NOMINMAX
) )
if(DEBUG)
add_compile_options(/EHr /fsanitize /validate-charset /DEBUG /RTCu /RTCs /RTCc)
else()
add_compile_options(/O2 /fp:fast /GL /GF /GA)
endif()
else()
if(NATIVE)
add_compile_options(-march=native -mtune=native)
endif()
if(DEBUG)
add_compile_options(-g3 -O0 -fno-omit-frame-pointer -ggdb -fcheck-new -gbtf)
else()
add_compile_options(-O2 -ffast-math -fipa-pta -ftree-vectorize -fstdarg-opt -fomit-frame-pointer -frename-registers)
add_link_options(-Wl,-O2)
if(!WIN32)
add_compile_options(-flto)
endif()
endif()
endif() endif()
## Process Embeddeds ## ## Process Embeddeds ##
@ -329,11 +329,7 @@ add_executable(${PROJECT_NAME} MACOSX_BUNDLE WIN32
${EMBEDDED_SOURCE} ${EMBEDDED_SOURCE}
) )
if(LINUX)
pkg_check_modules(SECCOMP REQUIRED libseccomp)
target_include_directories(${PROJECT_NAME} PRIVATE ${SECCOMP_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PRIVATE ${SECCOMP_LIBRARIES})
endif()
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)
find_package(ZLIB REQUIRED) find_package(ZLIB REQUIRED)
@ -350,35 +346,30 @@ find_package(Ruby 3.0 REQUIRED COMPONENTS Development)
pkg_check_modules(VORBISFILE REQUIRED vorbisfile) pkg_check_modules(VORBISFILE REQUIRED vorbisfile)
find_package_handle_standard_args(pixman-1 DEFAULT_MSG PIXMAN_LIBRARY PIXMAN_INCLUDE_DIR) find_package_handle_standard_args(pixman-1 DEFAULT_MSG PIXMAN_LIBRARY PIXMAN_INCLUDE_DIR)
mark_as_advanced(PIXMAN_INCLUDE_DIR PIXMAN_LIBRARY) mark_as_advanced(PIXMAN_INCLUDE_DIR PIXMAN_LIBRARY)
if(EMSCRIPTEN) if(MODLOADER)
else()
find_package(OpenSSL CONFIG REQUIRED COMPONENTS Crypto) find_package(OpenSSL CONFIG REQUIRED COMPONENTS Crypto)
pkg_check_modules(SIGC2 REQUIRED sigc++-2.0) pkg_check_modules(SIGC2 REQUIRED sigc++-2.0)
pkg_check_modules(LIBZIP REQUIRED libzip) pkg_check_modules(LIBZIP REQUIRED libzip)
endif() endif()
target_compile_definitions(${PROJECT_NAME} PRIVATE ${DEFINES}) target_compile_definitions(${PROJECT_NAME} PRIVATE ${DEFINES})
if(EMSCRIPTEN) target_include_directories(${PROJECT_NAME} PRIVATE src include ${PIXMAN_INCLUDE_DIR} ${SIGC2_INCLUDE_DIRS}
target_include_directories(${PROJECT_NAME} PRIVATE src include ${PIXMAN_INCLUDE_DIR} ${Ruby_INCLUDE_DIRS} Boost::boost ${Boost_INCLUDE_DIRS}
${Ruby_INCLUDE_DIRS} Boost::boost ${Boost_INCLUDE_DIRS} ${VORBISFILE_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS}) ${VORBISFILE_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PRIVATE SDL3::SDL3 SDL3_image::SDL3_image SDL3_sound::SDL3_sound SDL3_ttf::SDL3_ttf OpenAL::OpenAL target_link_libraries(${PROJECT_NAME} PRIVATE SDL3::SDL3 SDL3_image::SDL3_image
physfs ${PIXMAN_LIBRARY} ${PLATFORM_LIBRARIES} ${Ruby_LIBRARIES} Boost::boost Boost::chrono ${Boost_LIBRARIES} SDL3_sound::SDL3_sound SDL3_ttf::SDL3_ttf OpenAL::OpenAL
${VORBISFILE_LIBRARIES} ZLIB::ZLIB ${PLATFORM_LIBS}) physfs ${PIXMAN_LIBRARY} ${SIGC2_LIBRARIES} ${PLATFORM_LIBRARIES}
${Ruby_LIBRARIES} Boost::boost Boost::chrono ${Boost_LIBRARIES}
${VORBISFILE_LIBRARIES} ZLIB::ZLIB ${PLATFORM_LIBS})
if(MODLOADER)
target_include_directories(${PROJECT_NAME} PRIVATE ${LIBZIP_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR})
target_link_libraries(${PROJECT_NAME} PRIVATE ${LIBZIP_LIBRARIES} OpenSSL::Crypto)
else() else()
target_include_directories(${PROJECT_NAME} PRIVATE src include ${LIBZIP_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR} ${PIXMAN_INCLUDE_DIR} ${SIGC2_INCLUDE_DIRS}
${Ruby_INCLUDE_DIRS} Boost::boost ${Boost_INCLUDE_DIRS} ${VORBISFILE_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PRIVATE SDL3::SDL3 SDL3_image::SDL3_image SDL3_sound::SDL3_sound SDL3_ttf::SDL3_ttf OpenSSL::Crypto OpenAL::OpenAL
physfs ${LIBZIP_LIBRARIES} ${PIXMAN_LIBRARY} ${SIGC2_LIBRARIES} ${PLATFORM_LIBRARIES} ${Ruby_LIBRARIES} Boost::boost Boost::chrono ${Boost_LIBRARIES}
${VORBISFILE_LIBRARIES} ZLIB::ZLIB ${PLATFORM_LIBS})
endif() endif()
IF(APPLE)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND cmake -P "${CMAKE_SOURCE_DIR}/patches/mac/CompleteBundle.cmake" VERBATIM)
ENDIF()
if(STEAM) if(STEAM)
add_subdirectory(steamshim_parent) add_subdirectory(steamshim_parent)

21
PORTING.md Normal file
View file

@ -0,0 +1,21 @@
О состоянии портов
Windows: 100% Состояние: Играбельно
Linux: 90% Состояние: В работе но уже играбельно
TODO:
* Fix Wallpaper manager
*BSD: 3% Состояние: в работе
GNU/Hurd: 1% Состояние: В работе
Solaris/OpenSolaris: 1% Состояние: В работе
RedoxOS: 0% Состояние: Не хватает библеотек
Android: 1% Состояние: В работе
MacOS: ? Состояние: Нет подходящего оборудования/людей
PS Vita: 0% Состояние: В работе
PSP: 0% Состояние: В работе
Emspritein(web): 10% Состояние: Нет хватает библеотек
HaikuOS: 0% Состояние: В работе
IOS: 0% Состояние: Нет подходящего оборудования/людей
Nintendo 3DS: 0% Состояние: Нет подходящего оборудования/людей
XBOX: 0% Состояние: Нет лицензии
Risc OS: 0% Состояние: Неизвестно
DOS: 0.1% Состояние: Мысленный эксперемент, одна строчка кода для поддержка сделана XD

View file

@ -221,11 +221,6 @@ class Window_Settings
}, },
], ],
tr("Controls") => [ tr("Controls") => [
{
:type => :base,
:name => tr('Configure controls'),
:default => tr("Press F1")
},
{ {
:type => :bool, :type => :bool,
:name => tr('Control LED lighting on gamepads'), :name => tr('Control LED lighting on gamepads'),

View file

@ -339,7 +339,11 @@ class Game_Character
when 44 # Play SE when 44 # Play SE
$game_system.se_play(command.parameters[0]) $game_system.se_play(command.parameters[0])
when 45 # Script when 45 # Script
eval(command.parameters[0]) begin
eval(command.parameters[0])
rescue
STDERR.puts "[Game_Character_2.rb] Failed to execute script #{command.parameters[0]}"
end
end end
@move_route_index += 1 @move_route_index += 1
end end

View file

@ -40,10 +40,7 @@ class Game_Event < Game_Character
special = SpecialEventData.get(name.captures[0].to_sym) special = SpecialEventData.get(name.captures[0].to_sym)
@custom_flags.concat(special.flags) @custom_flags.concat(special.flags)
@collision = special.collision @collision = special.collision
end end
RPG::Mod.exec_hooks("hooks/Game_Event/init", binding)
# Move to starting position # Move to starting position
moveto(@event.x, @event.y) moveto(@event.x, @event.y)
refresh refresh

View file

@ -83,7 +83,6 @@ class Game_Map
@map_id = 0 @map_id = 0
@display_x = 0 @display_x = 0
@display_y = 0 @display_y = 0
RPG::Mod.exec_hooks("hooks/Game_Map/init", binding)
end end
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# * Setup # * Setup
@ -555,3 +554,4 @@ class Game_Map
end end
end end
end end
Скажи, нужно ли блокирование света стенами (тени/окклюзия).

View file

@ -11,14 +11,12 @@ class Game_Switches
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
def initialize def initialize
@data = [] @data = []
RPG::Mod.exec_hooks("hooks/Game_Switches/init", binding)
end end
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# * Get Switch # * Get Switch
# switch_id : switch ID # switch_id : switch ID
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
def [](switch_id) def [](switch_id)
assert_not_deprecated(switch_id)
return true if switch_id == 25 return true if switch_id == 25
if switch_id <= 5000 and @data[switch_id] != nil if switch_id <= 5000 and @data[switch_id] != nil
return @data[switch_id] return @data[switch_id]
@ -32,20 +30,8 @@ class Game_Switches
# value : ON (true) / OFF (false) # value : ON (true) / OFF (false)
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
def []=(switch_id, value) def []=(switch_id, value)
assert_not_deprecated(switch_id)
if switch_id <= 5000 if switch_id <= 5000
@data[switch_id] = value @data[switch_id] = value
end end
end end
def assert_not_deprecated(switch_id)
if switch_id == 10 || switch_id == 21
STDERR.puts "deprecated switch referenced in map #{$game_map.map_id}"
end
end
end end
# some switches that we know of
# 101 - Use tower footsplashes i think
# 112 - Niko in minecart
# 160 - re-playing game (when Niko is TWM)

View file

@ -16,11 +16,6 @@ class Interpreter
def initialize(depth = 0, main = false) def initialize(depth = 0, main = false)
@depth = depth @depth = depth
@main = main @main = main
# Depth goes up to level 100
if depth > 100
print("Common event call has exceeded maximum limit.")
exit
end
# Clear inner situation of interpreter # Clear inner situation of interpreter
clear clear
end end

View file

@ -256,15 +256,12 @@ class Interpreter
# Advance index # Advance index
@index += 1 @index += 1
end end
# Evaluation
#result = eval(script)
# If return value is false
#if result == false
# # End
# return false
#end
# Continue # Continue
eval(script) begin
eval(script)
rescue
STDERR.puts "[EVENT] Failed to execute script #{script}"
end
return true return true
end end
end end

View file

@ -30,12 +30,6 @@ begin
# Prepare for transition # Prepare for transition
Graphics.freeze Graphics.freeze
gs = Game_Switches.new
if Graphics.width == 1280
gs[400] = true
else
gs[400] = false
end
# Make scene object (title screen) # Make scene object (title screen)
$scene = Scene_Title.new $scene = Scene_Title.new
Oneshot.allow_exit false Oneshot.allow_exit false

View file

@ -11,7 +11,7 @@ def fake_save
Dir.mkdir(Oneshot::GAME_PATH) unless File.exist?(Oneshot::GAME_PATH) Dir.mkdir(Oneshot::GAME_PATH) unless File.exist?(Oneshot::GAME_PATH)
Dir.mkdir(Oneshot::GAME_PATH + "/Oneshot") unless File.exist?(Oneshot::GAME_PATH + "/Oneshot") Dir.mkdir(Oneshot::GAME_PATH + "/Oneshot") unless File.exist?(Oneshot::GAME_PATH + "/Oneshot")
File.open(FAKE_SAVE_NAME, 'wb+') do |file| File.open(FAKE_SAVE_NAME, 'wb+') do |file|
# Wrire frame count for measuring play time # Write frame count for measuring play time
Marshal.dump(Graphics.frame_count, file) Marshal.dump(Graphics.frame_count, file)
# Increase save count by 1 # Increase save count by 1
$game_system.save_count += 1 $game_system.save_count += 1
@ -127,6 +127,7 @@ def load(filename)
# Read each type of game object # Read each type of game object
$game_system = Marshal.load(file) $game_system = Marshal.load(file)
$game_switches = Marshal.load(file) $game_switches = Marshal.load(file)
$game_switches[400] = Graphics.width > 1000
$game_variables = Marshal.load(file) $game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file) $game_self_switches = Marshal.load(file)
$game_screen = Marshal.load(file) $game_screen = Marshal.load(file)
@ -137,7 +138,7 @@ def load(filename)
$game_followers = Marshal.load(file) $game_followers = Marshal.load(file)
$game_oneshot = Marshal.load(file) $game_oneshot = Marshal.load(file)
$game_fasttravel = Marshal.load(file) $game_fasttravel = Marshal.load(file)
$game_temp.footstep_sfx = Marshal.load(file) $game_temp.footstep_sfx = Marshal.load(file)
# If magic number is different from when saving # If magic number is different from when saving
# (if editing was added with editor) # (if editing was added with editor)
if $game_system.magic_number != $data_system.magic_number if $game_system.magic_number != $data_system.magic_number

View file

@ -28,7 +28,7 @@ class Scene_Title
$game_temp = Game_Temp.new $game_temp = Game_Temp.new
new_game new_game
$game_system = Game_System.new $game_system = Game_System.new
Settings.load! # loading settings Settings.load! # loading settings
load_perma_flags load_perma_flags
@ -244,6 +244,7 @@ class Scene_Title
# Make each type of game object # Make each type of game object
$game_system = Game_System.new $game_system = Game_System.new
$game_switches = Game_Switches.new $game_switches = Game_Switches.new
$game_switches[400] = Graphics.width > 1000
$game_variables = Game_Variables.new $game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new $game_self_switches = Game_SelfSwitches.new
$game_screen = Game_Screen.new $game_screen = Game_Screen.new

View file

@ -48,57 +48,4 @@ module Settings
end end
end end
end end
#module Legacy
# FILE_PATH = [Oneshot::SAVE_PATH, 'settings.conf'].join '/'
#
# def self.load!
# if not FileTest.exist?(Settings::Legacy::FILE_PATH)
# Settings::Legacy.save!
# return
# end
#
# File.foreach(Settings::Legacy::FILE_PATH) do |line|
# if not line.include? "="
# next
# end
#
# key, value = line.strip.split("=", 2)
# puts ([key, value].join '=')
# case key
# when "bgm_volume"
# Audio.bgm_volume = value.to_i
# when "sfx_volume"
# Audio.sfx_volume = value.to_i
# when "fullscreen"
# Graphics.fullscreen = (value.casecmp "true") == 0
# when "default_run"
# $game_switches[251] = (value.casecmp "true") == 0
# when "colorblind_mode"
# $game_switches[252] = (value.casecmp "true") == 0
# when "automash_enabled"
# $game_switches[253] = (value.casecmp "true") == 0
# when "frameskip"
# Graphics.frameskip = (value.casecmp "true") == 0
# when "in_game_timer"
# $game_temp.igt_timer_visible = (value.casecmp "true") == 0
# $scene.in_game_timer.visible = $game_temp.igt_timer_visible if $scene.is_a?(Scene_Map)
# end
# end
# end
#
# def self.save!
# $persistent.save
# File.open(Settings::Legacy::FILE_PATH, 'w') do |f|
# f.puts (["bgm_volume", Audio.bgm_volume].join '=')
# f.puts (["sfx_volume", Audio.sfx_volume].join '=')
# f.puts (["fullscreen", Graphics.fullscreen].join '=')
# f.puts (["default_run", ($game_switches[251])].join '=')
# f.puts (["colorblind_mode", ($game_switches[252])].join '=')
# f.puts (["automash_enabled", ($game_switches[253])].join '=')
# f.puts (["frameskip", Graphics.frameskip].join '=')
# f.puts (["in_game_timer", $game_temp.igt_timer_visible].join '=')
# end
# end
#end
end end

View file

@ -4,6 +4,10 @@
//помойка ебаная //помойка ебаная
inline boost::chrono::high_resolution_clock::time_point startTime; inline boost::chrono::high_resolution_clock::time_point startTime;
#if defined(__linux__) || defined(BSD) || defined(__sun) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__GNU__) || defined(__hurd__) || defined(__DragonFly__)
#define unix_like
#endif
class Sunshine{ class Sunshine{
public: public:
Sunshine(); Sunshine();
@ -16,4 +20,4 @@ public:
private: private:
bool noiseLoaded = false; bool noiseLoaded = false;
}; };