From f55a5f2b21664ccd2af1c24ef68f14f73e418b1c Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Sun, 20 Dec 2015 21:08:14 +0000 Subject: Managed to remove SaveGame and SaveGameGamebryo classes from organizer --- src/CMakeLists.txt | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3c786868..428f18f9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -20,8 +20,6 @@ SET(organizer_SRCS selectiondialog.cpp savegameinfowidgetgamebryo.cpp savegameinfowidget.cpp - savegamegamebryo.cpp - savegame.cpp queryoverwritedialog.cpp profilesdialog.cpp profile.cpp @@ -114,8 +112,6 @@ SET(organizer_HDRS selectiondialog.h savegameinfowidgetgamebryo.h savegameinfowidget.h - savegamegamebyro.h - savegame.h queryoverwritedialog.h profilesdialog.h profile.h -- cgit v1.3.1 From ae6bb99c521af611989439b6db8a14a1b27866fc Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Sat, 26 Dec 2015 08:23:43 +0000 Subject: Remove savegameinfowidget from organizer core --- src/CMakeLists.txt | 5 - src/mainwindow.cpp | 3 - src/mainwindow.h | 1 - src/organizer.pro | 5 - src/savegameinfowidget.cpp | 83 --------------- src/savegameinfowidget.h | 63 ----------- src/savegameinfowidget.ui | 209 ------------------------------------- src/savegameinfowidgetgamebryo.cpp | 86 --------------- src/savegameinfowidgetgamebryo.h | 42 -------- 9 files changed, 497 deletions(-) delete mode 100644 src/savegameinfowidget.cpp delete mode 100644 src/savegameinfowidget.h delete mode 100644 src/savegameinfowidget.ui delete mode 100644 src/savegameinfowidgetgamebryo.cpp delete mode 100644 src/savegameinfowidgetgamebryo.h (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 428f18f9..b80283af 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -18,8 +18,6 @@ SET(organizer_SRCS settings.cpp selfupdater.cpp selectiondialog.cpp - savegameinfowidgetgamebryo.cpp - savegameinfowidget.cpp queryoverwritedialog.cpp profilesdialog.cpp profile.cpp @@ -110,8 +108,6 @@ SET(organizer_HDRS settings.h selfupdater.h selectiondialog.h - savegameinfowidgetgamebryo.h - savegameinfowidget.h queryoverwritedialog.h profilesdialog.h profile.h @@ -200,7 +196,6 @@ SET(organizer_UIS simpleinstalldialog.ui settingsdialog.ui selectiondialog.ui - savegameinfowidget.ui queryoverwritedialog.ui profilesdialog.ui overwriteinfodialog.ui diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 0a690a8e..4d608d59 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -72,8 +72,6 @@ along with Mod Organizer. If not, see . #include "browserdialog.h" #include "aboutdialog.h" #include "safewritefile.h" -#include "savegameinfowidget.h" -#include "savegameinfowidgetgamebryo.h" #include "nxmaccessmanager.h" #include "appconfig.h" #include @@ -869,7 +867,6 @@ void MainWindow::displaySaveGameInfo(QListWidgetItem *newItem) { QString const &save = newItem->data(Qt::UserRole).toString(); if (m_CurrentSaveView == nullptr) { - //FIXME Is this the right place? IPluginGame const *game = m_OrganizerCore.managedGame(); SaveGameInfo const *info = game->feature(); if (info != nullptr) { diff --git a/src/mainwindow.h b/src/mainwindow.h index 0fd15d85..177048b4 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -39,7 +39,6 @@ class LockedDialog; class OrganizerCore; #include "plugincontainer.h" //class PluginContainer; class PluginListSortProxy; -class SaveGameInfoWidget; namespace BSA { class Archive; } #include "iplugingame.h" //namespace MOBase { class IPluginGame; } namespace MOBase { class IPluginModPage; } diff --git a/src/organizer.pro b/src/organizer.pro index ee0526ed..0ef2638b 100644 --- a/src/organizer.pro +++ b/src/organizer.pro @@ -27,8 +27,6 @@ SOURCES += \ settings.cpp \ selfupdater.cpp \ selectiondialog.cpp \ - savegameinfowidgetgamebryo.cpp \ - savegameinfowidget.cpp \ queryoverwritedialog.cpp \ profilesdialog.cpp \ profile.cpp \ @@ -105,8 +103,6 @@ HEADERS += \ settings.h \ selfupdater.h \ selectiondialog.h \ - savegameinfowidgetgamebryo.h \ - savegameinfowidget.h \ queryoverwritedialog.h \ profilesdialog.h \ profile.h \ @@ -179,7 +175,6 @@ FORMS += \ simpleinstalldialog.ui \ settingsdialog.ui \ selectiondialog.ui \ - savegameinfowidget.ui \ queryoverwritedialog.ui \ profilesdialog.ui \ overwriteinfodialog.ui \ diff --git a/src/savegameinfowidget.cpp b/src/savegameinfowidget.cpp deleted file mode 100644 index bf4a9598..00000000 --- a/src/savegameinfowidget.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* -Copyright (C) 2012 Sebastian Herbord. All rights reserved. - -This file is part of Mod Organizer. - -Mod Organizer is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Mod Organizer is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Mod Organizer. If not, see . -*/ - -#include "savegameinfowidget.h" -#include "ui_savegameinfowidget.h" - -#include "isavegame.h" -#include "gamebryosavegame.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - - -SaveGameInfoWidget::SaveGameInfoWidget(QWidget *parent) - : QWidget(parent) - , ui(new Ui::SaveGameInfoWidget) -{ - ui->setupUi(this); - this->setWindowFlags(Qt::ToolTip | Qt::BypassGraphicsProxyWidget); - setWindowOpacity(style()->styleHint(QStyle::SH_ToolTipLabel_Opacity, 0, this) / qreal(255.0)); - ui->gameFrame->setStyleSheet("background-color: transparent;"); -// installEventFilter(this); -} - -SaveGameInfoWidget::~SaveGameInfoWidget() -{ - delete ui; -} - - -void SaveGameInfoWidget::setSave(MOBase::ISaveGame const *saveGame) -{ - GamebryoSaveGame const *game = dynamic_cast(saveGame); - ui->saveNumLabel->setText(QString("%1").arg(game->getSaveNumber())); - ui->characterLabel->setText(game->getPCName()); - ui->locationLabel->setText(game->getPCLocation()); - ui->levelLabel->setText(QString("%1").arg(game->getPCLevel())); - //This somewhat contorted code is because on my system at least, the - //old way of doing this appears to give short date and long time. - QDateTime t = saveGame->getCreationTime(); - ui->dateLabel->setText(t.date().toString(Qt::DefaultLocaleShortDate) + " " + - t.time().toString(Qt::DefaultLocaleLongDate)); - ui->screenshotLabel->setPixmap(QPixmap::fromImage(game->getScreenshot())); - if (ui->gameFrame->layout() != nullptr) { - QLayoutItem *item = nullptr; - while ((item = ui->gameFrame->layout()->takeAt(0)) != nullptr) { - delete item->widget(); - delete item; - } - ui->gameFrame->layout()->setSizeConstraint(QLayout::SetFixedSize); - } -} - -QFrame *SaveGameInfoWidget::getGameFrame() -{ - return ui->gameFrame; -} diff --git a/src/savegameinfowidget.h b/src/savegameinfowidget.h deleted file mode 100644 index c811313c..00000000 --- a/src/savegameinfowidget.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -Copyright (C) 2012 Sebastian Herbord. All rights reserved. - -This file is part of Mod Organizer. - -Mod Organizer is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Mod Organizer is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Mod Organizer. If not, see . -*/ - -#ifndef SAVEGAMEINFOWIDGET_H -#define SAVEGAMEINFOWIDGET_H - -#include -#include - -class QFrame; - -namespace Ui { -class SaveGameInfoWidget; -} - -namespace MOBase { class ISaveGame; } - -class SaveGameInfoWidget : public QWidget -{ - Q_OBJECT - -public: - - explicit SaveGameInfoWidget(QWidget *parent = 0); - ~SaveGameInfoWidget(); - - virtual void setSave(MOBase::ISaveGame const *saveGame); - -signals: - - void closeSaveInfo(); - -protected: - -// virtual bool eventFilter(QObject *object, QEvent *event); - - QFrame *getGameFrame(); - -private: - -private: - - Ui::SaveGameInfoWidget *ui; - -}; - -#endif // SAVEGAMEINFOWIDGET_H diff --git a/src/savegameinfowidget.ui b/src/savegameinfowidget.ui deleted file mode 100644 index e2e9588c..00000000 --- a/src/savegameinfowidget.ui +++ /dev/null @@ -1,209 +0,0 @@ - - - SaveGameInfoWidget - - - - 0 - 0 - 400 - 300 - - - - - 0 - 0 - - - - - - - - - - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - - true - - - - Save # - - - - - - - - true - - - - Character - - - - - - - - true - - - - Level - - - - - - - - true - - - - Location - - - - - - - - true - - - - Date - - - - - - - - 75 - true - - - - - - - - - - - - 75 - true - - - - - - - - - - - - 75 - true - - - - - - - - - - - - 75 - true - - - - - - - - - - - - 75 - true - - - - - - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - false - - - - - - Qt::AlignCenter - - - - - - - - diff --git a/src/savegameinfowidgetgamebryo.cpp b/src/savegameinfowidgetgamebryo.cpp deleted file mode 100644 index 1836a8f2..00000000 --- a/src/savegameinfowidgetgamebryo.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* -Copyright (C) 2012 Sebastian Herbord. All rights reserved. - -This file is part of Mod Organizer. - -Mod Organizer is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Mod Organizer is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Mod Organizer. If not, see . -*/ - -#include "savegameinfowidgetgamebryo.h" - -#include "pluginlist.h" -#include "gamebryosavegame.h" - -#include -#include -#include -#include - - -SaveGameInfoWidgetGamebryo::SaveGameInfoWidgetGamebryo(MOBase::ISaveGame const *saveGame, PluginList *pluginList, QWidget *parent) - : SaveGameInfoWidget(parent), m_PluginList(pluginList) -{ - QVBoxLayout *gameLayout = new QVBoxLayout(); - gameLayout->setMargin(0); - gameLayout->setSpacing(2); - getGameFrame()->setLayout(gameLayout); - setSave(saveGame); -} - - -void SaveGameInfoWidgetGamebryo::setSave(MOBase::ISaveGame const *saveGame) -{ - SaveGameInfoWidget::setSave(saveGame); - GamebryoSaveGame const *gamebryoSave = dynamic_cast(saveGame); - QLayout *layout = getGameFrame()->layout(); - QLabel *header = new QLabel(tr("Missing ESPs")); - QFont headerFont = header->font(); - QFont contentFont = headerFont; - headerFont.setItalic(true); - contentFont.setBold(true); - contentFont.setPointSize(7); - header->setFont(headerFont); - layout->addWidget(header); - int count = 0; - for (QString const &pluginName : gamebryoSave->getPlugins()) { - //if (m_PluginList->isEnabled(pluginName)) { - //should use IPluginList * in interface - if (m_PluginList->state(pluginName) == MOBase::IPluginList::STATE_ACTIVE) { - continue; - } - - ++count; - - if (count > 10) { - break; - } - - QLabel *pluginLabel = new QLabel(pluginName); - pluginLabel->setIndent(10); - pluginLabel->setFont(contentFont); - layout->addWidget(pluginLabel); - } - if (count > 10) { - QLabel *dotDotLabel = new QLabel("..."); - dotDotLabel->setIndent(10); - dotDotLabel->setFont(contentFont); - layout->addWidget(dotDotLabel); - } - if (count == 0) { - QLabel *dotDotLabel = new QLabel(tr("None")); - dotDotLabel->setIndent(10); - dotDotLabel->setFont(contentFont); - layout->addWidget(dotDotLabel); - } -} diff --git a/src/savegameinfowidgetgamebryo.h b/src/savegameinfowidgetgamebryo.h deleted file mode 100644 index db6c91df..00000000 --- a/src/savegameinfowidgetgamebryo.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -Copyright (C) 2012 Sebastian Herbord. All rights reserved. - -This file is part of Mod Organizer. - -Mod Organizer is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Mod Organizer is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Mod Organizer. If not, see . -*/ - -#ifndef SAVEGAMEINFOWIDGETGAMEBRYO_H -#define SAVEGAMEINFOWIDGETGAMEBRYO_H - - -#include "savegameinfowidget.h" - -class PluginList; - -class SaveGameInfoWidgetGamebryo : public SaveGameInfoWidget -{ -public: - - explicit SaveGameInfoWidgetGamebryo(MOBase::ISaveGame const *saveGame, PluginList *pluginList, QWidget *parent = 0); - - virtual void setSave(MOBase::ISaveGame const *saveGame); - -private: - - PluginList *m_PluginList; - -}; - -#endif // SAVEGAMEINFOWIDGETGAMEBRYO_H -- cgit v1.3.1 From a4dbe82be792a75091ac57500c56b565778bc62a Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Sun, 27 Dec 2015 13:50:46 +0000 Subject: Removes the gameinfo + related files from shared to hookdll --- src/CMakeLists.txt | 10 --- src/shared/fallout3info.cpp | 88 ----------------------- src/shared/fallout3info.h | 59 ---------------- src/shared/falloutnvinfo.cpp | 88 ----------------------- src/shared/falloutnvinfo.h | 59 ---------------- src/shared/gameinfo.cpp | 164 ------------------------------------------- src/shared/gameinfo.h | 95 ------------------------- src/shared/oblivioninfo.cpp | 88 ----------------------- src/shared/oblivioninfo.h | 58 --------------- src/shared/shared.pro | 10 --- src/shared/skyriminfo.cpp | 104 --------------------------- src/shared/skyriminfo.h | 62 ---------------- win.imp | 10 ++- 13 files changed, 9 insertions(+), 886 deletions(-) delete mode 100644 src/shared/fallout3info.cpp delete mode 100644 src/shared/fallout3info.h delete mode 100644 src/shared/falloutnvinfo.cpp delete mode 100644 src/shared/falloutnvinfo.h delete mode 100644 src/shared/gameinfo.cpp delete mode 100644 src/shared/gameinfo.h delete mode 100644 src/shared/oblivioninfo.cpp delete mode 100644 src/shared/oblivioninfo.h delete mode 100644 src/shared/skyriminfo.cpp delete mode 100644 src/shared/skyriminfo.h (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b80283af..94b75031 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -88,12 +88,7 @@ SET(organizer_SRCS shared/windows_error.cpp shared/error_report.cpp shared/directoryentry.cpp - shared/gameinfo.cpp - shared/oblivioninfo.cpp - shared/fallout3info.cpp - shared/falloutnvinfo.cpp shared/util.cpp - shared/skyriminfo.cpp shared/appconfig.cpp shared/leaktrace.cpp shared/stackdata.cpp @@ -178,12 +173,7 @@ SET(organizer_HDRS shared/windows_error.h shared/error_report.h shared/directoryentry.h - shared/gameinfo.h - shared/oblivioninfo.h - shared/fallout3info.h - shared/falloutnvinfo.h shared/util.h - shared/skyriminfo.h shared/appconfig.h shared/appconfig.inc shared/leaktrace.h diff --git a/src/shared/fallout3info.cpp b/src/shared/fallout3info.cpp deleted file mode 100644 index 797d68ec..00000000 --- a/src/shared/fallout3info.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* -Copyright (C) 2012 Sebastian Herbord. All rights reserved. - -This file is part of Mod Organizer. - -Mod Organizer is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Mod Organizer is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Mod Organizer. If not, see . -*/ - -#include "fallout3info.h" -#include "util.h" -#include -#include -#include -#include "windows_error.h" -#include "error_report.h" -#define WIN32_LEAN_AND_MEAN -#include -#include - -namespace MOShared { - -Fallout3Info::Fallout3Info(const std::wstring &gameDirectory) - : GameInfo(gameDirectory) -{ - identifyMyGamesDirectory(L"fallout3"); -} - -bool Fallout3Info::identifyGame(const std::wstring &searchPath) -{ - return FileExists(searchPath, L"Fallout3.exe") && - FileExists(searchPath, L"FalloutLauncher.exe"); -} - -std::wstring Fallout3Info::getRegPathStatic() -{ - HKEY key; - LONG errorcode = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Bethesda Softworks\\Fallout3", - 0, KEY_QUERY_VALUE, &key); - - if (errorcode != ERROR_SUCCESS) { - return std::wstring(); - } - - WCHAR temp[MAX_PATH]; - DWORD bufferSize = MAX_PATH; - - if (::RegQueryValueExW(key, L"Installed Path", nullptr, nullptr, (LPBYTE)temp, &bufferSize) == ERROR_SUCCESS) { - return std::wstring(temp); - } else { - return std::wstring(); - } -} - - -std::vector Fallout3Info::getIniFileNames() const -{ - return boost::assign::list_of(L"fallout.ini")(L"falloutprefs.ini"); -} - -std::wstring Fallout3Info::getReferenceDataFile() const -{ - return L"Fallout - Meshes.bsa"; -} - -bool Fallout3Info::rerouteToProfile(const wchar_t *fileName, const wchar_t*) const -{ - static LPCWSTR profileFiles[] = { L"fallout.ini", L"falloutprefs.ini", L"plugins.txt", nullptr }; - - for (int i = 0; profileFiles[i] != nullptr; ++i) { - if (_wcsicmp(fileName, profileFiles[i]) == 0) { - return true; - } - } - return false; -} - -} // namespace MOShared diff --git a/src/shared/fallout3info.h b/src/shared/fallout3info.h deleted file mode 100644 index 5cf98e3b..00000000 --- a/src/shared/fallout3info.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -Copyright (C) 2012 Sebastian Herbord. All rights reserved. - -This file is part of Mod Organizer. - -Mod Organizer is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Mod Organizer is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Mod Organizer. If not, see . -*/ - -#ifndef FALLOUT3INFO_H -#define FALLOUT3INFO_H - -#include "gameinfo.h" - -namespace MOShared { - - -class Fallout3Info : public GameInfo -{ - - friend class GameInfo; - -public: - - virtual ~Fallout3Info() {} - - static std::wstring getRegPathStatic(); - virtual std::wstring getRegPath() const { return getRegPathStatic(); } - - // file name of this games ini (no path) - virtual std::vector getIniFileNames() const; - - virtual std::wstring getReferenceDataFile() const; - - virtual bool rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath) const; - - virtual std::wstring archiveListKey() const { return L"SArchiveList"; } - -private: - - Fallout3Info(const std::wstring &gameDirectory); - - static bool identifyGame(const std::wstring &searchPath); - -}; - -} // namespace MOShared - -#endif // FALLOUT3INFO_H diff --git a/src/shared/falloutnvinfo.cpp b/src/shared/falloutnvinfo.cpp deleted file mode 100644 index 6347224d..00000000 --- a/src/shared/falloutnvinfo.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* -Copyright (C) 2012 Sebastian Herbord. All rights reserved. - -This file is part of Mod Organizer. - -Mod Organizer is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Mod Organizer is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Mod Organizer. If not, see . -*/ - -#include "falloutnvinfo.h" -#include "util.h" -#include -#include -#include -#include "windows_error.h" -#include "error_report.h" -#define WIN32_LEAN_AND_MEAN -#include -#include - -namespace MOShared { - - -FalloutNVInfo::FalloutNVInfo(const std::wstring &gameDirectory) - : GameInfo(gameDirectory) -{ - identifyMyGamesDirectory(L"falloutnv"); -} - -bool FalloutNVInfo::identifyGame(const std::wstring &searchPath) -{ - return FileExists(searchPath, L"FalloutNV.exe") && - FileExists(searchPath, L"FalloutNVLauncher.exe"); -} - -std::wstring FalloutNVInfo::getRegPathStatic() -{ - HKEY key; - LONG errorcode = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Bethesda Softworks\\FalloutNV", - 0, KEY_QUERY_VALUE, &key); - - if (errorcode != ERROR_SUCCESS) { - return std::wstring(); - } - - WCHAR temp[MAX_PATH]; - DWORD bufferSize = MAX_PATH; - - if (::RegQueryValueExW(key, L"Installed Path", nullptr, nullptr, (LPBYTE)temp, &bufferSize) == ERROR_SUCCESS) { - return std::wstring(temp); - } else { - return std::wstring(); - } -} - -std::vector FalloutNVInfo::getIniFileNames() const -{ - return boost::assign::list_of(L"fallout.ini")(L"falloutprefs.ini"); -} - -std::wstring FalloutNVInfo::getReferenceDataFile() const -{ - return L"Fallout - Meshes.bsa"; -} - -bool FalloutNVInfo::rerouteToProfile(const wchar_t *fileName, const wchar_t*) const -{ - static LPCWSTR profileFiles[] = { L"fallout.ini", L"falloutprefs.ini", L"plugins.txt", nullptr }; - - for (int i = 0; profileFiles[i] != nullptr; ++i) { - if (_wcsicmp(fileName, profileFiles[i]) == 0) { - return true; - } - } - return false; -} - -} // namespace MOShared diff --git a/src/shared/falloutnvinfo.h b/src/shared/falloutnvinfo.h deleted file mode 100644 index 04c13c7d..00000000 --- a/src/shared/falloutnvinfo.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -Copyright (C) 2012 Sebastian Herbord. All rights reserved. - -This file is part of Mod Organizer. - -Mod Organizer is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Mod Organizer is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Mod Organizer. If not, see . -*/ - -#ifndef FALLOUTNVINFO_H -#define FALLOUTNVINFO_H - - -#include "gameinfo.h" - -namespace MOShared { - - -class FalloutNVInfo : public GameInfo -{ - - friend class GameInfo; - -public: - - virtual ~FalloutNVInfo() {} - - static std::wstring getRegPathStatic(); - virtual std::wstring getRegPath() const { return getRegPathStatic(); } - - // file name of this games ini (no path) - virtual std::vector getIniFileNames() const; - - virtual std::wstring getReferenceDataFile() const; - - virtual bool rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath) const; - - virtual std::wstring archiveListKey() const { return L"SArchiveList"; } - -private: - - FalloutNVInfo(const std::wstring &gameDirectory); - - static bool identifyGame(const std::wstring &searchPath); -}; - -} // namespace MOShared - -#endif // FALLOUTNVINFO_H diff --git a/src/shared/gameinfo.cpp b/src/shared/gameinfo.cpp deleted file mode 100644 index 5c13a520..00000000 --- a/src/shared/gameinfo.cpp +++ /dev/null @@ -1,164 +0,0 @@ -/* -Copyright (C) 2012 Sebastian Herbord. All rights reserved. - -This file is part of Mod Organizer. - -Mod Organizer is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Mod Organizer is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Mod Organizer. If not, see . -*/ - -#include "gameinfo.h" - -#include "windows_error.h" - -#include "oblivioninfo.h" -#include "fallout3info.h" -#include "falloutnvinfo.h" -#include "skyriminfo.h" -#include "util.h" - -#include -#include - -#include -#include -#include - -namespace MOShared { - - -GameInfo* GameInfo::s_Instance = nullptr; - - -GameInfo::GameInfo(const std::wstring &gameDirectory) - : m_GameDirectory(gameDirectory) -{ - atexit(&cleanup); -} - - -void GameInfo::cleanup() { - delete GameInfo::s_Instance; - GameInfo::s_Instance = nullptr; -} - - -void GameInfo::identifyMyGamesDirectory(const std::wstring &file) -{ - // this function attempts 3 (three!) ways to determine the correct "My Games" folder. - wchar_t myDocuments[MAX_PATH]; - memset(myDocuments, '\0', MAX_PATH * sizeof(wchar_t)); - - m_MyGamesDirectory.clear(); - - // a) this is the way it should work. get the configured My Documents\My Games directory - if (::SHGetFolderPathW(nullptr, CSIDL_PERSONAL, nullptr, SHGFP_TYPE_CURRENT, myDocuments) == S_OK) { - m_MyGamesDirectory = std::wstring(myDocuments) + L"\\My Games"; - } - - // b) if there is no directory there, look in the default directory - if (m_MyGamesDirectory.empty() - || !FileExists(m_MyGamesDirectory + L"\\" + file)) { - if (::SHGetFolderPathW(nullptr, CSIDL_PERSONAL, nullptr, SHGFP_TYPE_DEFAULT, myDocuments) == S_OK) { - std::wstring fromDefault = std::wstring(myDocuments) + L"\\My Games"; - if (FileExists(fromDefault + L"\\" + file)) { - m_MyGamesDirectory = fromDefault; - } - } - } - // c) finally, look in the registry. This is discouraged - if (m_MyGamesDirectory.empty() - || !FileExists(m_MyGamesDirectory + L"\\" + file)) { - std::wstring fromRegistry = getSpecialPath(L"Personal") + L"\\My Games"; - if (FileExists(fromRegistry + L"\\" + file)) { - m_MyGamesDirectory = fromRegistry; - } - } -} - -bool GameInfo::identifyGame(const std::wstring &searchPath) -{ - if (OblivionInfo::identifyGame(searchPath)) { - s_Instance = new OblivionInfo(searchPath); - } else if (Fallout3Info::identifyGame(searchPath)) { - s_Instance = new Fallout3Info(searchPath); - } else if (FalloutNVInfo::identifyGame(searchPath)) { - s_Instance = new FalloutNVInfo(searchPath); - } else if (SkyrimInfo::identifyGame(searchPath)) { - s_Instance = new SkyrimInfo(searchPath); - } - - return s_Instance != nullptr; -} - - -bool GameInfo::init(const std::wstring &moDirectory, const std::wstring &gamePath) -{ - if (s_Instance == nullptr) { - if (gamePath.length() == 0) { - // search upward in the directory until a recognized game-binary is found - std::wstring searchPath(moDirectory); - while (!identifyGame(searchPath)) { - size_t lastSep = searchPath.find_last_of(L"/\\"); - if (lastSep == std::string::npos) { - return false; - } - searchPath.erase(lastSep); - } - } else if (!identifyGame(gamePath)) { - return false; - } - } - return true; -} - - -GameInfo &GameInfo::instance() -{ - assert(s_Instance != nullptr && "gameinfo not yet initialized"); - return *s_Instance; -} - -std::wstring GameInfo::getGameDirectory() const -{ - return m_GameDirectory; -} - -std::wstring GameInfo::getSpecialPath(LPCWSTR name) const -{ - HKEY key; - LONG errorcode = ::RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders", - 0, KEY_QUERY_VALUE, &key); - - if (errorcode != ERROR_SUCCESS) { - throw windows_error("failed to look up special folder (path)", errorcode); - } - - WCHAR temp[MAX_PATH]; - DWORD bufferSize = MAX_PATH; - - errorcode = ::RegQueryValueExW(key, name, nullptr, nullptr, (LPBYTE)temp, &bufferSize); - if (errorcode != ERROR_SUCCESS) { - throw windows_error((boost::format("failed to look up special folder (%1%)") % ToString(name, true)).str(), errorcode); - } - - WCHAR temp2[MAX_PATH]; - // try to expand variables in the path, if any - if (::ExpandEnvironmentStringsW(temp, temp2, MAX_PATH) != 0) { - return temp2; - } else { - return temp; - } -} - -} // namespace MOShared diff --git a/src/shared/gameinfo.h b/src/shared/gameinfo.h deleted file mode 100644 index 7bc86d3a..00000000 --- a/src/shared/gameinfo.h +++ /dev/null @@ -1,95 +0,0 @@ -/* -Copyright (C) 2012 Sebastian Herbord. All rights reserved. - -This file is part of Mod Organizer. - -Mod Organizer is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Mod Organizer is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Mod Organizer. If not, see . -*/ - -#ifndef GAMEINFO_H -#define GAMEINFO_H - -#include -#include -#include - -#define WIN32_LEAN_AND_MEAN -#include - -namespace MOShared { - - -/** - Class to manage information that depends on the used game type. The intention is to keep - as much of the rest of omo is game-agnostic. It is mostly concerned with figuring out the - correct paths, filenames and data types. -*/ -class GameInfo -{ - -public: - - virtual ~GameInfo() {} - - //**USED IN HOOKDLL and at startup to set up for hookdll to work - // initialise with the path to the mo directory (needs to be where hook.dll is stored). This - // needs to be called before the instance can be retrieved - static bool init(const std::wstring &moDirectory, const std::wstring &gamePath = L""); - - //**USED ONLY IN HOOKDLL - static GameInfo& instance(); - - //**USED ONLY IN HOOKDLL - virtual std::wstring getGameDirectory() const; - - //**USED ONLY IN HOOKDLL - virtual std::wstring getRegPath() const = 0; - - //**USED ONLY IN HOOKDLL - // file name of this games ini file(s) - virtual std::vector getIniFileNames() const = 0; - - //**USED ONLY IN HOOKDLL - virtual std::wstring getReferenceDataFile() const = 0; - - //**USED ONLY IN HOOKDLL - virtual bool rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath) const = 0; - -protected: - - GameInfo(const std::wstring &gameDirectory); - - void identifyMyGamesDirectory(const std::wstring &file); - -private: - - static bool identifyGame(const std::wstring &searchPath); - std::wstring getSpecialPath(LPCWSTR name) const; - - static void cleanup(); - -private: - - static GameInfo *s_Instance; - - std::wstring m_MyGamesDirectory; - - std::wstring m_GameDirectory; - -}; - - -} // namespace MOShared - -#endif // GAMEINFO_H diff --git a/src/shared/oblivioninfo.cpp b/src/shared/oblivioninfo.cpp deleted file mode 100644 index b50f1daa..00000000 --- a/src/shared/oblivioninfo.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* -Copyright (C) 2012 Sebastian Herbord. All rights reserved. - -This file is part of Mod Organizer. - -Mod Organizer is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Mod Organizer is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Mod Organizer. If not, see . -*/ - -#include "oblivioninfo.h" -#include -#include -#include "util.h" -#include -#include "windows_error.h" -#include "error_report.h" -#define WIN32_LEAN_AND_MEAN -#include -#include - -namespace MOShared { - - -OblivionInfo::OblivionInfo(const std::wstring &gameDirectory) - : GameInfo(gameDirectory) -{ - identifyMyGamesDirectory(L"oblivion"); -} - -bool OblivionInfo::identifyGame(const std::wstring &searchPath) -{ - return FileExists(searchPath, L"Oblivion.exe") && - FileExists(searchPath, L"OblivionLauncher.exe"); -} - -std::wstring OblivionInfo::getRegPathStatic() -{ - HKEY key; - LONG errorcode = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Bethesda Softworks\\Oblivion", - 0, KEY_QUERY_VALUE, &key); - - if (errorcode != ERROR_SUCCESS) { - return std::wstring(); - } - - WCHAR temp[MAX_PATH]; - DWORD bufferSize = MAX_PATH; - - if (::RegQueryValueExW(key, L"Installed Path", nullptr, nullptr, (LPBYTE)temp, &bufferSize) == ERROR_SUCCESS) { - return std::wstring(temp); - } else { - return std::wstring(); - } -} - -std::vector OblivionInfo::getIniFileNames() const -{ - return boost::assign::list_of(L"oblivion.ini")(L"oblivionprefs.ini"); -} - -bool OblivionInfo::rerouteToProfile(const wchar_t *fileName, const wchar_t*) const -{ - static LPCWSTR profileFiles[] = { L"oblivion.ini", L"oblivionprefs.ini", L"plugins.txt", nullptr }; - - for (int i = 0; profileFiles[i] != nullptr; ++i) { - if (_wcsicmp(fileName, profileFiles[i]) == 0) { - return true; - } - } - return false; -} - -std::wstring OblivionInfo::getReferenceDataFile() const -{ - return L"Oblivion - Meshes.bsa"; -} - -} // namespace MOShared diff --git a/src/shared/oblivioninfo.h b/src/shared/oblivioninfo.h deleted file mode 100644 index bf0b2707..00000000 --- a/src/shared/oblivioninfo.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -Copyright (C) 2012 Sebastian Herbord. All rights reserved. - -This file is part of Mod Organizer. - -Mod Organizer is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Mod Organizer is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Mod Organizer. If not, see . -*/ - -#ifndef OBLIVIONINFO_H -#define OBLIVIONINFO_H - -#include "gameinfo.h" - -namespace MOShared { - -class OblivionInfo : public GameInfo -{ - - friend class GameInfo; - -public: - - virtual ~OblivionInfo() {} - - static std::wstring getRegPathStatic(); - virtual std::wstring getRegPath() const { return getRegPathStatic(); } - - // file name of this games ini (no path) - virtual std::vector getIniFileNames() const; - - virtual std::wstring getReferenceDataFile() const; - - virtual bool rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath) const; - - virtual std::wstring archiveListKey() const { return L"SArchiveList"; } - -private: - - OblivionInfo(const std::wstring &gameDirectory); - - static bool identifyGame(const std::wstring &searchPath); - -}; - -} // namespace MOShared - -#endif // OBLIVIONINFO_H diff --git a/src/shared/shared.pro b/src/shared/shared.pro index a64e781d..517e1e86 100644 --- a/src/shared/shared.pro +++ b/src/shared/shared.pro @@ -21,12 +21,7 @@ SOURCES += \ windows_error.cpp \ error_report.cpp \ directoryentry.cpp \ - gameinfo.cpp \ - oblivioninfo.cpp \ - fallout3info.cpp \ - falloutnvinfo.cpp \ util.cpp \ - skyriminfo.cpp \ appconfig.cpp \ leaktrace.cpp \ stackdata.cpp @@ -36,12 +31,7 @@ HEADERS += \ windows_error.h \ error_report.h \ directoryentry.h \ - gameinfo.h \ - oblivioninfo.h \ - fallout3info.h \ - falloutnvinfo.h \ util.h \ - skyriminfo.h \ appconfig.h \ appconfig.inc \ leaktrace.h \ diff --git a/src/shared/skyriminfo.cpp b/src/shared/skyriminfo.cpp deleted file mode 100644 index 9662e66d..00000000 --- a/src/shared/skyriminfo.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/* -Copyright (C) 2012 Sebastian Herbord. All rights reserved. - -This file is part of Mod Organizer. - -Mod Organizer is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Mod Organizer is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Mod Organizer. If not, see . -*/ - -#include "skyriminfo.h" - -#include "util.h" -#include -#include -#include -#include "windows_error.h" -#include "error_report.h" -#define WIN32_LEAN_AND_MEAN -#include -#include -#include - -namespace MOShared { - - -SkyrimInfo::SkyrimInfo(const std::wstring &gameDirectory) - : GameInfo(gameDirectory) -{ - identifyMyGamesDirectory(L"skyrim"); - - wchar_t appDataPath[MAX_PATH]; - if (SUCCEEDED(SHGetFolderPathW(nullptr, CSIDL_LOCAL_APPDATA, nullptr, SHGFP_TYPE_CURRENT, appDataPath))) { - m_AppData = appDataPath; - } -} - -bool SkyrimInfo::identifyGame(const std::wstring &searchPath) -{ - return FileExists(searchPath, L"TESV.exe") && - FileExists(searchPath, L"SkyrimLauncher.exe"); -} - - - - -std::wstring SkyrimInfo::getRegPathStatic() -{ - HKEY key; - LONG errorcode = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Bethesda Softworks\\Skyrim", - 0, KEY_QUERY_VALUE, &key); - - if (errorcode != ERROR_SUCCESS) { - return std::wstring(); - } - - WCHAR temp[MAX_PATH]; - DWORD bufferSize = MAX_PATH; - - if (::RegQueryValueExW(key, L"Installed Path", nullptr, nullptr, (LPBYTE)temp, &bufferSize) == ERROR_SUCCESS) { - return std::wstring(temp); - } else { - return std::wstring(); - } -} - -std::vector SkyrimInfo::getIniFileNames() const -{ - return boost::assign::list_of(L"skyrim.ini")(L"skyrimprefs.ini"); -} - -std::wstring SkyrimInfo::getReferenceDataFile() const -{ - return L"Skyrim - Meshes.bsa"; -} - -bool SkyrimInfo::rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath) const -{ - static LPCWSTR profileFiles[] = { L"skyrim.ini", L"skyrimprefs.ini", L"loadorder.txt", nullptr }; - - for (int i = 0; profileFiles[i] != nullptr; ++i) { - if (_wcsicmp(fileName, profileFiles[i]) == 0) { - return true; - } - } - - if ((_wcsicmp(fileName, L"plugins.txt") == 0) && - (m_AppData.empty() || (StrStrIW(fullPath, m_AppData.c_str()) != nullptr))) { - return true; - } - - return false; -} - -} // namespace MOShared diff --git a/src/shared/skyriminfo.h b/src/shared/skyriminfo.h deleted file mode 100644 index bd329403..00000000 --- a/src/shared/skyriminfo.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright (C) 2012 Sebastian Herbord. All rights reserved. - -This file is part of Mod Organizer. - -Mod Organizer is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Mod Organizer is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Mod Organizer. If not, see . -*/ - -#ifndef SKYRIMINFO_H -#define SKYRIMINFO_H - - -#include "gameinfo.h" - -namespace MOShared { - - -class SkyrimInfo : public GameInfo -{ - - friend class GameInfo; - -public: - - virtual ~SkyrimInfo() {} - - static std::wstring getRegPathStatic(); - virtual std::wstring getRegPath() const { return getRegPathStatic(); } - - // file name of this games ini (no path) - virtual std::vector getIniFileNames() const; - - virtual std::wstring getReferenceDataFile() const; - - virtual bool rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath) const; - -private: - - SkyrimInfo(const std::wstring &gameDirectory); - - static bool identifyGame(const std::wstring &searchPath); - -private: - - std::wstring m_AppData; - -}; - -} // namespace MOShared - -#endif // SKYRIMINFO_H diff --git a/win.imp b/win.imp index cbecdc43..24635775 100644 --- a/win.imp +++ b/win.imp @@ -54,10 +54,18 @@ { include: [ "", "private", "", "public" ] }, # official name according to website { include: [ "", "private", "", "public" ] }, # - { include: [ "", "private", "", "public" ] }, { include: [ "", "private", "", "public" ] }, { include: [ "", "private", "", "public" ] }, +# These ones are in shtypes.h but the only documentation I can find says +# to include Knownfolders.h for these + { symbol: [ "REFKNOWNFOLDERID", "private", "", "public" ] }, + { symbol: [ "KNOWNFOLDERID", "private", "", "public" ] }, + +# IWYU doesn't understand upper/lower case which is *really* annoying on +# windows, though to be fair I'm not sure M/S understand it either. + { include: [ "", "private", "", "public" ] }, + # Files that are included by other files which seem to then come for free in Windows.h but # shouldn't. Again, should be cleaned up. -- cgit v1.3.1