mirror of
https://github.com/libretro/devilutionX.git
synced 2026-11-11 02:41:35 -10:00
https://github.com/diasurgical/devilutionx-mpq-tools produces an unpacked MPQ with all the graphics converted to CLX and the unused files removed. This is primarily useful on RAM-constrained platforms, such as PS2, because it eliminates the MPQ overhead. Adds a build option to load from such unpacked directories instead of the MPQ. These directories are searched for in the same locations where the MPQs would be searched for otherwise. Example directory layout: * /usr/local/share/diasurgical/devilutionx/diabdat/ -- unpacked and converted diabdat.mpq * /usr/local/share/diasurgical/devilutionx/hellfire/ -- unpacked and converted hellfire MPQs (all of them merged into 1 directory) * /usr/local/share/diasurgical/devilutionx/fonts/ -- unpacked fonts.mpq * /usr/local/share/diasurgical/devilutionx/pl/ -- unpacked pl.mpq These directory structure is produced by calling `unpack_and_minify_mpq`
73 lines
1.7 KiB
C++
73 lines
1.7 KiB
C++
#include <filesystem>
|
|
#include <gtest/gtest.h>
|
|
#include <iostream>
|
|
|
|
#include "diablo.h"
|
|
#include "engine/demomode.h"
|
|
#include "options.h"
|
|
#include "pfile.h"
|
|
#include "utils/display.h"
|
|
#include "utils/paths.h"
|
|
|
|
using namespace devilution;
|
|
|
|
namespace {
|
|
|
|
bool Dummy_GetHeroInfo(_uiheroinfo *pInfo)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
void RunTimedemo(std::string timedemoFolderName)
|
|
{
|
|
std::string unitTestFolderCompletePath = paths::BasePath() + "/test/fixtures/timedemo/" + timedemoFolderName;
|
|
paths::SetPrefPath(unitTestFolderCompletePath);
|
|
paths::SetConfigPath(unitTestFolderCompletePath);
|
|
LoadCoreArchives();
|
|
LoadGameArchives();
|
|
|
|
// The tests need spawn.mpq or diabdat.mpq
|
|
// Please provide them so that the tests can run successfully
|
|
ASSERT_TRUE(HaveSpawn() || HaveDiabdat());
|
|
|
|
InitKeymapActions();
|
|
LoadOptions();
|
|
|
|
const int demoNumber = 0;
|
|
|
|
Players.resize(1);
|
|
MyPlayerId = demoNumber;
|
|
MyPlayer = &Players[MyPlayerId];
|
|
*MyPlayer = {};
|
|
|
|
// Currently only spawn.mpq is present when building on github actions
|
|
gbIsSpawn = true;
|
|
gbIsHellfire = false;
|
|
gbMusicOn = false;
|
|
gbSoundOn = false;
|
|
HeadlessMode = true;
|
|
demo::InitPlayBack(demoNumber, true);
|
|
|
|
pfile_ui_set_hero_infos(Dummy_GetHeroInfo);
|
|
gbLoadGame = true;
|
|
|
|
demo::OverrideOptions();
|
|
|
|
AdjustToScreenGeometry(*sgOptions.Graphics.resolution);
|
|
|
|
StartGame(false, true);
|
|
|
|
HeroCompareResult result = pfile_compare_hero_demo(demoNumber, true);
|
|
ASSERT_EQ(result.status, HeroCompareResult::Same) << result.message;
|
|
ASSERT_FALSE(gbRunGame);
|
|
gbRunGame = false;
|
|
init_cleanup();
|
|
}
|
|
|
|
} // namespace
|
|
|
|
TEST(Timedemo, WarriorLevel1to2)
|
|
{
|
|
RunTimedemo("WarriorLevel1to2");
|
|
}
|