Inject layout files to VFS

LTO-timing^2
Andrei Kortunov 3 years ago
parent 2630bc21dd
commit c47a48e25d

@ -521,7 +521,6 @@ void OMW::Engine::setDataDirs (const Files::PathContainer& dataDirs)
{
mDataDirs = dataDirs;
mDataDirs.insert(mDataDirs.begin(), (mResDir / "vfs"));
mDataDirs.insert(mDataDirs.begin(), (mResDir / "mygui"));
mFileCollections = Files::Collections (mDataDirs, !mFSStrict);
}
@ -701,7 +700,7 @@ void OMW::Engine::createWindow()
void OMW::Engine::setWindowIcon()
{
std::ifstream windowIconStream;
std::string windowIcon = (mResDir / "mygui" / "openmw.png").string();
std::string windowIcon = (mResDir / "openmw.png").string();
windowIconStream.open(windowIcon, std::ios_base::in | std::ios_base::binary);
if (windowIconStream.fail())
Log(Debug::Error) << "Error: Failed to open " << windowIcon;
@ -816,7 +815,6 @@ void OMW::Engine::prepareEngine()
exts->glRenderbufferStorageMultisampleCoverageNV = nullptr;
#endif
std::string myguiResources = (mResDir / "mygui").string();
osg::ref_ptr<osg::Group> guiRoot = new osg::Group;
guiRoot->setName("GUI Root");
guiRoot->setNodeMask(MWRender::Mask_GUI);
@ -824,7 +822,7 @@ void OMW::Engine::prepareEngine()
rootNode->addChild(guiRoot);
mWindowManager = std::make_unique<MWGui::WindowManager>(mWindow, mViewer, guiRoot, mResourceSystem.get(), mWorkQueue.get(),
mCfgMgr.getLogPath().string() + std::string("/"), myguiResources,
mCfgMgr.getLogPath().string() + std::string("/"),
mScriptConsoleMode, mTranslationDataStorage, mEncoding, mExportFonts,
Version::getOpenmwVersionDescription(mResDir.string()), shadersSupported);
mEnvironment.setWindowManager(*mWindowManager);

@ -128,7 +128,7 @@ namespace MWGui
{
WindowManager::WindowManager(
SDL_Window* window, osgViewer::Viewer* viewer, osg::Group* guiRoot, Resource::ResourceSystem* resourceSystem, SceneUtil::WorkQueue* workQueue,
const std::string& logpath, const std::string& resourcePath, bool consoleOnlyScripts, Translation::Storage& translationDataStorage,
const std::string& logpath, bool consoleOnlyScripts, Translation::Storage& translationDataStorage,
ToUTF8::FromType encoding, bool exportFonts, const std::string& versionDescription, bool useShaders)
: mOldUpdateMask(0)
, mOldCullMask(0)
@ -195,7 +195,7 @@ namespace MWGui
{
mScalingFactor = std::clamp(Settings::Manager::getFloat("scaling factor", "GUI"), 0.5f, 8.f);
mGuiPlatform = new osgMyGUI::Platform(viewer, guiRoot, resourceSystem->getImageManager(), mScalingFactor);
mGuiPlatform->initialise(resourceSystem->getVFS(), resourcePath, (std::filesystem::path(logpath) / "MyGUI.log").generic_string());
mGuiPlatform->initialise(resourceSystem->getVFS(), "mygui", (std::filesystem::path(logpath) / "MyGUI.log").generic_string());
mGui = new MyGUI::Gui;
mGui->initialise("");

@ -135,7 +135,7 @@ namespace MWGui
typedef std::vector<Faction> FactionList;
WindowManager(SDL_Window* window, osgViewer::Viewer* viewer, osg::Group* guiRoot, Resource::ResourceSystem* resourceSystem, SceneUtil::WorkQueue* workQueue,
const std::string& logpath, const std::string& cacheDir, bool consoleOnlyScripts, Translation::Storage& translationDataStorage,
const std::string& logpath, bool consoleOnlyScripts, Translation::Storage& translationDataStorage,
ToUTF8::FromType encoding, bool exportFonts, const std::string& versionDescription, bool useShaders);
virtual ~WindowManager();

@ -213,11 +213,18 @@ namespace Gui
return;
}
std::string oldDataPath = dataManager->getDataPath("");
dataManager->setResourcePath("fonts");
for (const auto& name : mVFS->getRecursiveDirectoryIterator("Fonts/"))
{
std::filesystem::path path = name;
std::cout << name << std::endl;
if (Misc::getFileExtension(name) == "omwfont")
MyGUI::ResourceManager::getInstance().load(name);
MyGUI::ResourceManager::getInstance().load(path.filename());
}
dataManager->setResourcePath(oldDataPath);
}
typedef struct

@ -22,7 +22,7 @@ MyGUI::IDataStream *DataManager::getData(const std::string &name) const
{
// Note: MyGUI is supposed to read/free input steam itself,
// so copy data from VFS stream to the string stream and pass it to MyGUI.
Files::IStreamPtr streamPtr = mVfs->get(name);
Files::IStreamPtr streamPtr = mVfs->get(mResourcePath + "\\" + name);
std::istream* fileStream = streamPtr.get();
std::unique_ptr<std::stringstream> dataStream;
dataStream.reset(new std::stringstream);
@ -37,7 +37,7 @@ void DataManager::freeData(MyGUI::IDataStream *data)
bool DataManager::isDataExist(const std::string &name) const
{
return mVfs->exists(name);
return mVfs->exists(mResourcePath + "\\" + name);
}
void DataManager::setVfs(const VFS::Manager* vfs)
@ -52,7 +52,17 @@ const MyGUI::VectorString &DataManager::getDataListNames(const std::string &patt
const std::string &DataManager::getDataPath(const std::string &name) const
{
throw std::runtime_error("DataManager::getDataPath is not implemented - VFS is used");
static std::string result;
result.clear();
if (name.empty())
return mResourcePath;
if (!isDataExist(name))
return result;
result = mResourcePath + "\\" + name;
return result;
}
}

@ -1,4 +1,3 @@
add_subdirectory(mygui)
add_subdirectory(shaders)
add_subdirectory(data)
add_subdirectory(lua_api)

@ -69,8 +69,98 @@ set(BUILTIN_DATA_FILES
shaders/main.omwfx
shaders/displaydepth.omwfx
mygui/core.skin
mygui/core.xml
mygui/core_layouteditor.xml
mygui/openmw_alchemy_window.layout
mygui/openmw_book.layout
mygui/openmw_box.skin.xml
mygui/openmw_button.skin.xml
mygui/openmw_chargen_birth.layout
mygui/openmw_chargen_class_description.layout
mygui/openmw_chargen_class.layout
mygui/openmw_chargen_create_class.layout
mygui/openmw_chargen_generate_class_result.layout
mygui/openmw_chargen_race.layout
mygui/openmw_chargen_review.layout
mygui/openmw_chargen_select_attribute.layout
mygui/openmw_chargen_select_skill.layout
mygui/openmw_chargen_select_specialization.layout
mygui/openmw_confirmation_dialog.layout
mygui/openmw_console.layout
mygui/openmw_console.skin.xml
mygui/openmw_container_window.layout
mygui/openmw_count_window.layout
mygui/openmw_dialogue_window.layout
mygui/openmw_dialogue_window.skin.xml
mygui/openmw_edit.skin.xml
mygui/openmw_hud_box.skin.xml
mygui/openmw_hud_energybar.skin.xml
mygui/openmw_hud.layout
mygui/openmw_infobox.layout
mygui/openmw_interactive_messagebox.layout
mygui/openmw_interactive_messagebox_notransp.layout
mygui/openmw_inventory_window.layout
mygui/openmw_journal.layout
mygui/openmw_journal.skin.xml
mygui/openmw_layers.xml
mygui/openmw_lua.xml
mygui/openmw_list.skin.xml
mygui/openmw_mainmenu.layout
mygui/openmw_mainmenu.skin.xml
mygui/openmw_map_window.layout
mygui/openmw_map_window.skin.xml
mygui/openmw_messagebox.layout
mygui/openmw_pointer.xml
mygui/openmw_progress.skin.xml
mygui/openmw_resources.xml
mygui/openmw_scroll.layout
mygui/openmw_scroll.skin.xml
mygui/openmw_settings_window.layout
mygui/openmw_settings.xml
mygui/openmw_spell_window.layout
mygui/openmw_stats_window.layout
mygui/openmw_text_input.layout
mygui/openmw_text.skin.xml
mygui/openmw_tooltips.layout
mygui/openmw_trade_window.layout
mygui/openmw_spell_buying_window.layout
mygui/openmw_windows.skin.xml
mygui/openmw_quickkeys_menu.layout
mygui/openmw_quickkeys_menu_assign.layout
mygui/openmw_itemselection_dialog.layout
mygui/openmw_magicselection_dialog.layout
mygui/openmw_spell_buying_window.layout
mygui/openmw_loading_screen.layout
mygui/openmw_levelup_dialog.layout
mygui/openmw_wait_dialog.layout
mygui/openmw_wait_dialog_progressbar.layout
mygui/openmw_spellcreation_dialog.layout
mygui/openmw_edit_effect.layout
mygui/openmw_enchanting_dialog.layout
mygui/openmw_trainingwindow.layout
mygui/openmw_travel_window.layout
mygui/openmw_persuasion_dialog.layout
mygui/openmw_merchantrepair.layout
mygui/openmw_repair.layout
mygui/openmw_companion_window.layout
mygui/openmw_savegame_dialog.layout
mygui/openmw_recharge_dialog.layout
mygui/openmw_screen_fader.layout
mygui/openmw_screen_fader_hit.layout
mygui/openmw_edit_note.layout
mygui/openmw_debug_window.layout
mygui/openmw_debug_window.skin.xml
mygui/openmw_postprocessor_hud.layout
mygui/openmw_postprocessor_hud.skin.xml
mygui/openmw_jail_screen.layout
mygui/OpenMWResourcePlugin.xml
mygui/skins.xml
)
foreach (f ${BUILTIN_DATA_FILES})
copy_resource_file("${CMAKE_CURRENT_SOURCE_DIR}/${f}" "${OPENMW_RESOURCES_ROOT}" "resources/vfs/${f}")
endforeach (f)
copy_resource_file("../launcher/images/openmw.png" "${OPENMW_RESOURCES_ROOT}" "resources/openmw.png")

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Resource" version="1.1">
<Resource type="ResourceTrueTypeFont" name="dejavusansmono">
<Property key="Source" value="Fonts/DejaVuLGCSansMono.ttf"/>
<Property key="Source" value="DejaVuLGCSansMono.ttf"/>
<Property key="Antialias" value="false"/>
<Property key="TabWidth" value="8"/>
<Property key="OffsetHeight" value="0"/>

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Resource" version="1.1">
<Resource type="ResourceTrueTypeFont" name="ayembedt">
<Property key="Source" value="Fonts/OMWAyembedt.ttf"/>
<Property key="Source" value="OMWAyembedt.ttf"/>
<Property key="Antialias" value="false"/>
<Property key="TabWidth" value="8"/>
<Property key="OffsetHeight" value="0"/>

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Resource" version="1.1">
<Resource type="ResourceTrueTypeFont" name="pelagiad">
<Property key="Source" value="Fonts/Pelagiad.ttf"/>
<Property key="Source" value="Pelagiad.ttf"/>
<Property key="Antialias" value="false"/>
<Property key="TabWidth" value="8"/>
<Property key="OffsetHeight" value="0"/>

@ -1,101 +0,0 @@
if (NOT DEFINED OPENMW_RESOURCES_ROOT)
return()
endif()
# Copy resource files into the build directory
set(SDIR ${CMAKE_CURRENT_SOURCE_DIR})
set(DDIRRELATIVE resources/mygui)
set(MYGUI_FILES
core.skin
core.xml
core_layouteditor.xml
openmw_alchemy_window.layout
openmw_book.layout
openmw_box.skin.xml
openmw_button.skin.xml
openmw_chargen_birth.layout
openmw_chargen_class_description.layout
openmw_chargen_class.layout
openmw_chargen_create_class.layout
openmw_chargen_generate_class_result.layout
openmw_chargen_race.layout
openmw_chargen_review.layout
openmw_chargen_select_attribute.layout
openmw_chargen_select_skill.layout
openmw_chargen_select_specialization.layout
openmw_confirmation_dialog.layout
openmw_console.layout
openmw_console.skin.xml
openmw_container_window.layout
openmw_count_window.layout
openmw_dialogue_window.layout
openmw_dialogue_window.skin.xml
openmw_edit.skin.xml
openmw_hud_box.skin.xml
openmw_hud_energybar.skin.xml
openmw_hud.layout
openmw_infobox.layout
openmw_interactive_messagebox.layout
openmw_interactive_messagebox_notransp.layout
openmw_inventory_window.layout
openmw_journal.layout
openmw_journal.skin.xml
openmw_layers.xml
openmw_lua.xml
openmw_list.skin.xml
openmw_mainmenu.layout
openmw_mainmenu.skin.xml
openmw_map_window.layout
openmw_map_window.skin.xml
openmw_messagebox.layout
openmw_pointer.xml
openmw_progress.skin.xml
openmw_resources.xml
openmw_scroll.layout
openmw_scroll.skin.xml
openmw_settings_window.layout
openmw_settings.xml
openmw_spell_window.layout
openmw_stats_window.layout
openmw_text_input.layout
openmw_text.skin.xml
openmw_tooltips.layout
openmw_trade_window.layout
openmw_spell_buying_window.layout
openmw_windows.skin.xml
openmw_quickkeys_menu.layout
openmw_quickkeys_menu_assign.layout
openmw_itemselection_dialog.layout
openmw_magicselection_dialog.layout
openmw_spell_buying_window.layout
openmw_loading_screen.layout
openmw_levelup_dialog.layout
openmw_wait_dialog.layout
openmw_wait_dialog_progressbar.layout
openmw_spellcreation_dialog.layout
openmw_edit_effect.layout
openmw_enchanting_dialog.layout
openmw_trainingwindow.layout
openmw_travel_window.layout
openmw_persuasion_dialog.layout
openmw_merchantrepair.layout
openmw_repair.layout
openmw_companion_window.layout
openmw_savegame_dialog.layout
openmw_recharge_dialog.layout
openmw_screen_fader.layout
openmw_screen_fader_hit.layout
openmw_edit_note.layout
openmw_debug_window.layout
openmw_debug_window.skin.xml
openmw_postprocessor_hud.layout
openmw_postprocessor_hud.skin.xml
openmw_jail_screen.layout
../launcher/images/openmw.png
OpenMWResourcePlugin.xml
skins.xml
)
copy_all_resource_files(${CMAKE_CURRENT_SOURCE_DIR} ${OPENMW_RESOURCES_ROOT} ${DDIRRELATIVE} "${MYGUI_FILES}")

@ -1,99 +0,0 @@
Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
Glyphs imported from Arev fonts are (c) Tavmjong Bah (see below)
Bitstream Vera Fonts Copyright
------------------------------
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is
a trademark of Bitstream, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of the fonts accompanying this license ("Fonts") and associated
documentation files (the "Font Software"), to reproduce and distribute the
Font Software, including without limitation the rights to use, copy, merge,
publish, distribute, and/or sell copies of the Font Software, and to permit
persons to whom the Font Software is furnished to do so, subject to the
following conditions:
The above copyright and trademark notices and this permission notice shall
be included in all copies of one or more of the Font Software typefaces.
The Font Software may be modified, altered, or added to, and in particular
the designs of glyphs or characters in the Fonts may be modified and
additional glyphs or characters may be added to the Fonts, only if the fonts
are renamed to names not containing either the words "Bitstream" or the word
"Vera".
This License becomes null and void to the extent applicable to Fonts or Font
Software that has been modified and is distributed under the "Bitstream
Vera" names.
The Font Software may be sold as part of a larger software package but no
copy of one or more of the Font Software typefaces may be sold by itself.
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME
FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING
ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE
FONT SOFTWARE.
Except as contained in this notice, the names of Gnome, the Gnome
Foundation, and Bitstream Inc., shall not be used in advertising or
otherwise to promote the sale, use or other dealings in this Font Software
without prior written authorization from the Gnome Foundation or Bitstream
Inc., respectively. For further information, contact: fonts at gnome dot
org.
Arev Fonts Copyright
------------------------------
Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining
a copy of the fonts accompanying this license ("Fonts") and
associated documentation files (the "Font Software"), to reproduce
and distribute the modifications to the Bitstream Vera Font Software,
including without limitation the rights to use, copy, merge, publish,
distribute, and/or sell copies of the Font Software, and to permit
persons to whom the Font Software is furnished to do so, subject to
the following conditions:
The above copyright and trademark notices and this permission notice
shall be included in all copies of one or more of the Font Software
typefaces.
The Font Software may be modified, altered, or added to, and in
particular the designs of glyphs or characters in the Fonts may be
modified and additional glyphs or characters may be added to the
Fonts, only if the fonts are renamed to names not containing either
the words "Tavmjong Bah" or the word "Arev".
This License becomes null and void to the extent applicable to Fonts
or Font Software that has been modified and is distributed under the
"Tavmjong Bah Arev" names.
The Font Software may be sold as part of a larger software package but
no copy of one or more of the Font Software typefaces may be sold by
itself.
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL
TAVMJONG BAH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Except as contained in this notice, the name of Tavmjong Bah shall not
be used in advertising or otherwise to promote the sale, use or other
dealings in this Font Software without prior written authorization
from Tavmjong Bah. For further information, contact: tavmjong @ free
. fr.
$Id: LICENSE 2133 2007-11-28 02:46:28Z lechimp $
Loading…
Cancel
Save