mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-30 15:32:38 +00:00
Add -noinapp option to disable Steam "in game" visibility (fix #4314)
Some minor changes in this commit includes the usage of std::unique_ptr for the Pimpl-idiom in steam::SteamAPI class and renaming the SteamAPI::initialized() to SteamAPI::isInitialized() to avoid confusion reading the code. Forum post: https://steamcommunity.com/app/431730/discussions/2/7260435303111061192/
This commit is contained in:
parent
5337a728be
commit
0d5075ff93
@ -775,7 +775,10 @@ if(ENABLE_UPDATER)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ENABLE_STEAM)
|
if(ENABLE_STEAM)
|
||||||
add_definitions(-DENABLE_STEAM)
|
# We need the ENABLE_STEAM flag in main module too so AppOptions are
|
||||||
|
# equal in both modules, app-lib and main (that's why this flag is
|
||||||
|
# marked as PUBLIC).
|
||||||
|
target_compile_definitions(app-lib PUBLIC -DENABLE_STEAM)
|
||||||
target_link_libraries(app-lib steam-lib)
|
target_link_libraries(app-lib steam-lib)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2018-2023 Igara Studio S.A.
|
// Copyright (C) 2018-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -328,6 +328,11 @@ int App::initialize(const AppOptions& options)
|
|||||||
app_configure_drm();
|
app_configure_drm();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef ENABLE_STEAM
|
||||||
|
if (options.noInApp())
|
||||||
|
m_inAppSteam = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Load modules
|
// Load modules
|
||||||
m_modules = std::make_unique<Modules>(createLogInDesktop, preferences());
|
m_modules = std::make_unique<Modules>(createLogInDesktop, preferences());
|
||||||
m_legacy = std::make_unique<LegacyModules>(isGui() ? REQUIRE_INTERFACE: 0);
|
m_legacy = std::make_unique<LegacyModules>(isGui() ? REQUIRE_INTERFACE: 0);
|
||||||
@ -510,9 +515,18 @@ void App::run()
|
|||||||
|
|
||||||
// Initialize Steam API
|
// Initialize Steam API
|
||||||
#ifdef ENABLE_STEAM
|
#ifdef ENABLE_STEAM
|
||||||
steam::SteamAPI steam;
|
std::unique_ptr<steam::SteamAPI> steam;
|
||||||
if (steam.initialized())
|
if (m_inAppSteam) {
|
||||||
os::instance()->activateApp();
|
steam = std::make_unique<steam::SteamAPI>();
|
||||||
|
if (steam->isInitialized())
|
||||||
|
os::instance()->activateApp();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// We tried to load the Steam SDK without calling
|
||||||
|
// SteamAPI_InitSafe() to check if we could run the program
|
||||||
|
// without "in game" indication but still capturing screenshots
|
||||||
|
// on Steam, and that wasn't the case.
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_DEBUG) || defined(ENABLE_DEVMODE)
|
#if defined(_DEBUG) || defined(ENABLE_DEVMODE)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2018-2023 Igara Studio S.A.
|
// Copyright (C) 2018-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -142,6 +142,9 @@ namespace app {
|
|||||||
std::unique_ptr<LegacyModules> m_legacy;
|
std::unique_ptr<LegacyModules> m_legacy;
|
||||||
bool m_isGui;
|
bool m_isGui;
|
||||||
bool m_isShell;
|
bool m_isShell;
|
||||||
|
#ifdef ENABLE_STEAM
|
||||||
|
bool m_inAppSteam = true;
|
||||||
|
#endif
|
||||||
std::unique_ptr<MainWindow> m_mainWindow;
|
std::unique_ptr<MainWindow> m_mainWindow;
|
||||||
base::paths m_files;
|
base::paths m_files;
|
||||||
#ifdef ENABLE_UI
|
#ifdef ENABLE_UI
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2018-2022 Igara Studio S.A.
|
// Copyright (C) 2018-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2017 David Capello
|
// Copyright (C) 2001-2017 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -79,6 +79,9 @@ AppOptions::AppOptions(int argc, const char* argv[])
|
|||||||
, m_exportTileset(m_po.add("export-tileset").description("Export only tilesets from visible tilemap layers"))
|
, m_exportTileset(m_po.add("export-tileset").description("Export only tilesets from visible tilemap layers"))
|
||||||
, m_verbose(m_po.add("verbose").mnemonic('v').description("Explain what is being done"))
|
, m_verbose(m_po.add("verbose").mnemonic('v').description("Explain what is being done"))
|
||||||
, m_debug(m_po.add("debug").description("Extreme verbose mode and\ncopy log to desktop"))
|
, m_debug(m_po.add("debug").description("Extreme verbose mode and\ncopy log to desktop"))
|
||||||
|
#ifdef ENABLE_STEAM
|
||||||
|
, m_noInApp(m_po.add("noinapp").description("Disable \"in game\" visibility on Steam\nDoesn't count playtime"))
|
||||||
|
#endif
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
, m_disableWintab(m_po.add("disable-wintab").description("Don't load wintab32.dll library"))
|
, m_disableWintab(m_po.add("disable-wintab").description("Don't load wintab32.dll library"))
|
||||||
#endif
|
#endif
|
||||||
@ -121,6 +124,13 @@ bool AppOptions::hasExporterParams() const
|
|||||||
m_po.enabled(m_sheet);
|
m_po.enabled(m_sheet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_STEAM
|
||||||
|
bool AppOptions::noInApp() const
|
||||||
|
{
|
||||||
|
return m_po.enabled(m_noInApp);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
bool AppOptions::disableWintab() const
|
bool AppOptions::disableWintab() const
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2018-2022 Igara Studio S.A.
|
// Copyright (C) 2018-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2017 David Capello
|
// Copyright (C) 2001-2017 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -95,6 +95,9 @@ public:
|
|||||||
const Option& exportTileset() const { return m_exportTileset; }
|
const Option& exportTileset() const { return m_exportTileset; }
|
||||||
|
|
||||||
bool hasExporterParams() const;
|
bool hasExporterParams() const;
|
||||||
|
#ifdef ENABLE_STEAM
|
||||||
|
bool noInApp() const;
|
||||||
|
#endif
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
bool disableWintab() const;
|
bool disableWintab() const;
|
||||||
#endif
|
#endif
|
||||||
@ -166,6 +169,9 @@ private:
|
|||||||
|
|
||||||
Option& m_verbose;
|
Option& m_verbose;
|
||||||
Option& m_debug;
|
Option& m_debug;
|
||||||
|
#ifdef ENABLE_STEAM
|
||||||
|
Option& m_noInApp;
|
||||||
|
#endif
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
Option& m_disableWintab;
|
Option& m_disableWintab;
|
||||||
#endif
|
#endif
|
||||||
|
@ -134,7 +134,7 @@ public:
|
|||||||
unloadLib();
|
unloadLib();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool initialized() const {
|
bool isInitialized() const {
|
||||||
return m_initialized;
|
return m_initialized;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,7 +239,7 @@ SteamAPI* SteamAPI::instance()
|
|||||||
}
|
}
|
||||||
|
|
||||||
SteamAPI::SteamAPI()
|
SteamAPI::SteamAPI()
|
||||||
: m_impl(new Impl)
|
: m_impl(std::make_unique<Impl>())
|
||||||
{
|
{
|
||||||
ASSERT(g_instance == nullptr);
|
ASSERT(g_instance == nullptr);
|
||||||
g_instance = this;
|
g_instance = this;
|
||||||
@ -247,15 +247,13 @@ SteamAPI::SteamAPI()
|
|||||||
|
|
||||||
SteamAPI::~SteamAPI()
|
SteamAPI::~SteamAPI()
|
||||||
{
|
{
|
||||||
delete m_impl;
|
|
||||||
|
|
||||||
ASSERT(g_instance == this);
|
ASSERT(g_instance == this);
|
||||||
g_instance = nullptr;
|
g_instance = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SteamAPI::initialized() const
|
bool SteamAPI::isInitialized() const
|
||||||
{
|
{
|
||||||
return m_impl->initialized();
|
return m_impl->isInitialized();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SteamAPI::runCallbacks()
|
void SteamAPI::runCallbacks()
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite Steam Wrapper
|
// Aseprite Steam Wrapper
|
||||||
// Copyright (c) 2020 Igara Studio S.A.
|
// Copyright (c) 2020-2024 Igara Studio S.A.
|
||||||
// Copyright (c) 2016 David Capello
|
// Copyright (c) 2016 David Capello
|
||||||
//
|
//
|
||||||
// This file is released under the terms of the MIT license.
|
// This file is released under the terms of the MIT license.
|
||||||
@ -9,6 +9,8 @@
|
|||||||
#define STEAM_STEAM_H_INCLUDED
|
#define STEAM_STEAM_H_INCLUDED
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace steam {
|
namespace steam {
|
||||||
|
|
||||||
class SteamAPI {
|
class SteamAPI {
|
||||||
@ -18,7 +20,7 @@ public:
|
|||||||
SteamAPI();
|
SteamAPI();
|
||||||
~SteamAPI();
|
~SteamAPI();
|
||||||
|
|
||||||
bool initialized() const;
|
bool isInitialized() const;
|
||||||
void runCallbacks();
|
void runCallbacks();
|
||||||
|
|
||||||
bool writeScreenshot(void* rgbBuffer,
|
bool writeScreenshot(void* rgbBuffer,
|
||||||
@ -27,7 +29,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
class Impl;
|
class Impl;
|
||||||
Impl* m_impl;
|
std::unique_ptr<Impl> m_impl;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace steam
|
} // namespace steam
|
||||||
|
Loading…
x
Reference in New Issue
Block a user