Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,18 @@ ipch/
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
vc16/otclient.vcxproj
vc16/otclient/DirectX/otclient_dx.iobj
vc16/otclient/DirectX/otclient.tlog/CL.command.1.tlog
vc16/otclient/DirectX/otclient.tlog/Cl.items.tlog
vc16/otclient/DirectX/otclient.tlog/CL.read.1.tlog
vc16/otclient/DirectX/otclient.tlog/CL.write.1.tlog
vc16/otclient/DirectX/otclient.tlog/link.command.1.tlog
vc16/otclient/DirectX/otclient.tlog/link.read.1.tlog
vc16/otclient/DirectX/otclient.tlog/link.secondary.1.tlog
vc16/otclient/DirectX/otclient.tlog/link.write.1.tlog
vc16/otclient/DirectX/otclient.tlog/otclient.lastbuildstate
vc16/otclient/DirectX/otclient.tlog/rc.command.1.tlog
vc16/otclient/DirectX/otclient.tlog/rc.read.1.tlog
vc16/otclient/DirectX/otclient.tlog/rc.write.1.tlog
vc16/otclient.vcxproj
1 change: 0 additions & 1 deletion init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ if not g_resources.directoryExists("/modules") then
end

-- settings
g_configs.loadSettings("/config.otml")

-- set layout
local settings = g_configs.getSettings()
Expand Down
29 changes: 28 additions & 1 deletion modules/client_options/graphics.otui
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,33 @@ OptionPanel
id: separator
margin: 5 5 5 5

OptionCheckBox
id: useAdvancedGraphics
!text: tr('Advanced rendering options')
!tooltip: tr('Enable manual selection of the graphics engine')

Label
id: rendererLabel
margin-top: 8
!text: tr("graphics engine")

ComboBox
id: renderer
margin-top: 3
margin-right: 2
margin-left: 2
visible: false
@onOptionChange: modules.client_options.setOption('renderer', self:getText())
@onSetup: |
self:addOption("Auto")
self:addOption("OpenGL")
self:addOption("DirectX")

HorizontalSeparator
id: separator2
margin-top: 12
margin-bottom: 12

OptionCheckBox
id: vsync
!text: tr('Enable vertical synchronization')
Expand Down Expand Up @@ -95,6 +122,6 @@ OptionPanel
text-auto-resize: true
text-align: left
text-wrap: true
!text: tr("If you have FPS issues:\n- Use OpenGL version (_gl)\n- Disable vertical synchronization\n- Set higher optimization level\n- Lower screen resolution\nOr report it on forum: http://otclient.net")
!text: tr("If you have FPS issues:\n- Use OpenGL version\n- Disable vertical synchronization\n- Set higher optimization level\n- Lower screen resolution\nOr report it on forum: otclient.net")
$mobile:
visible: false
35 changes: 33 additions & 2 deletions modules/client_options/options.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local defaultOptions = {
layout = DEFAULT_LAYOUT, -- set in init.lua
layout = DEFAULT_LAYOUT,
vsync = true,
showFps = true,
showPing = true,
Expand Down Expand Up @@ -66,7 +66,10 @@ local defaultOptions = {

profile = 1,

antialiasing = true
antialiasing = true,

renderer = "Auto",
useAdvancedGraphics = false,
}

local optionsWindow
Expand Down Expand Up @@ -350,8 +353,36 @@ function setOption(key, value, force)
generalPanel:getChildById('walkCtrlTurnDelayLabel'):setText(tr('Walk delay after ctrl turn: %s ms', value))
elseif key == "antialiasing" then
g_app.setSmooth(value)
elseif key == 'useAdvancedGraphics' then
local rendererCombo = graphicsPanel:getChildById('renderer')
local rendererLabel = graphicsPanel:getChildById('rendererLabel')
if value then
rendererCombo:setVisible(true)
rendererLabel:setVisible(true)
else
rendererCombo:setVisible(false)
rendererLabel:setVisible(false)
end
elseif key == 'renderer' then
if g_configs and g_configs.set then
g_configs.set('renderer', value)
end
if not force then
local messageBox
local function restart()
g_app.restart()
end
local function cancel()
if messageBox then
messageBox:destroy()
messageBox = nil
end
end
messageBox = displayGeneralBox(tr('Graphics Engine'), tr('You need to restart the application for the changes to take effect.\nDo you want to restart now?'), {{text=tr('Yes'), callback=restart}, {text=tr('No'), callback=cancel}}, restart, cancel)
end
end


-- change value for keybind updates
for _,panel in pairs(optionsTabBar:getTabsPanel()) do
local widget = panel:recursiveGetChildById(key)
Expand Down
32 changes: 8 additions & 24 deletions src/framework/core/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@
#include <framework/platform/platform.h>
#include <framework/http/http.h>

#if not(defined(ANDROID) || defined(FREE_VERSION))
#include <boost/process.hpp>
#endif

#include <locale>

#include <framework/net/connection.h>
Expand Down Expand Up @@ -99,6 +95,7 @@ void Application::init(std::vector<std::string>& args)

// initialize configs
g_configs.init();
g_configs.loadSettings("/config.otml");

// initialize lua
g_lua.init();
Expand Down Expand Up @@ -182,32 +179,19 @@ void Application::close()

void Application::restart()
{
#if not(defined(ANDROID) || defined(FREE_VERSION))
boost::process::child c(g_resources.getBinaryName());
std::error_code ec2;
if (c.wait_for(std::chrono::seconds(1), ec2)) {
g_logger.fatal("Updater restart error. Please restart application");
}
c.detach();
quick_exit();
#else
g_logger.info(stdext::format("Attempting to restart: %s", g_resources.getBinaryName()));

if(g_platform.restartProcess())
g_logger.info("restartProcess success");
else
g_logger.error("restartProcess failed");

exit();
#endif
}

void Application::restartArgs(const std::vector<std::string>& args)
{
#if not(defined(ANDROID) || defined(FREE_VERSION))
boost::process::child c(g_resources.getBinaryName(), boost::process::args(args));
std::error_code ec2;
if (c.wait_for(std::chrono::seconds(1), ec2)) {
g_logger.fatal("Updater restart error. Please restart application");
}
c.detach();
quick_exit();
#else
exit();
#endif
}

std::string Application::getOs()
Expand Down
Loading
Loading