AIO: Merge Vista/7/10, don't delete existing config when updating

This commit is contained in:
nastys
2020-09-24 00:31:09 +02:00
parent 2182d68f1d
commit d641ee1639
28 changed files with 161 additions and 168 deletions
+5 -57
View File
@@ -14,20 +14,10 @@ after_build:
md %TMP%\full\plugins\
md %TMP%\full\plugins\pv_equip\
md %TMP%\full\ram\
md %TMP%\full\ram\databank\
md %TMP%\update\
md %TMP%\update\patches\
md %TMP%\update\plugins\
md %TMP%\update\plugins\pv_equip\
md %TMP%\full\ram\databank_template\
md %TMP%\amd-pack\
md %TMP%\amd-pack\plugins\
@@ -40,27 +30,7 @@ after_build:
copy %APPVEYOR_BUILD_FOLDER%\source-code\x64\%CONFIGURATION%\dinput8.dll %TMP%\update\
copy %APPVEYOR_BUILD_FOLDER%\source-code\x64\%CONFIGURATION%\*.dva %TMP%\update\plugins\
del %TMP%\update\plugins\Novidia.dva
copy "%APPVEYOR_BUILD_FOLDER%\source-code\data\README - PD Loader.url" %TMP%\update\
copy %APPVEYOR_BUILD_FOLDER%\source-code\data\verify_base_game.sfv %TMP%\update\
copy %APPVEYOR_BUILD_FOLDER%\source-code\data\verify_base_game.md5 %TMP%\update\
copy %APPVEYOR_BUILD_FOLDER%\source-code\data\verify_mount_data.sfv %TMP%\update\
copy %APPVEYOR_BUILD_FOLDER%\source-code\data\verify_mount_data.md5 %TMP%\update\
copy %APPVEYOR_BUILD_FOLDER%\source-code\data\plugins\ShaderPatch.ini %TMP%\update\plugins\
copy %APPVEYOR_BUILD_FOLDER%\source-code\data\patches\custom_freeplay_text_example.p %TMP%\update\patches\
copy %APPVEYOR_BUILD_FOLDER%\source-code\x64\%CONFIGURATION%\dinput8.dll %TMP%\full\
copy %APPVEYOR_BUILD_FOLDER%\source-code\x64\%CONFIGURATION%\dnsapi.dll %TMP%\full\
copy %APPVEYOR_BUILD_FOLDER%\source-code\x64\%CONFIGURATION%\*.dva %TMP%\full\plugins\
@@ -80,9 +50,7 @@ after_build:
copy %APPVEYOR_BUILD_FOLDER%\source-code\data\plugins\*.* %TMP%\full\plugins\
copy %APPVEYOR_BUILD_FOLDER%\source-code\data\plugins\pv_equip\*.* %TMP%\full\plugins\pv_equip\
copy %APPVEYOR_BUILD_FOLDER%\source-code\data\ram\databank\*.dat %TMP%\full\ram\databank\
copy %APPVEYOR_BUILD_FOLDER%\source-code\data\ram\databank_template\*.dat %TMP%\full\ram\databank_template\
copy %APPVEYOR_BUILD_FOLDER%\source-code\data\patches\custom_freeplay_text_example.p %TMP%\full\patches\
@@ -98,28 +66,8 @@ after_build:
cd %TMP%\full\
echo del dnsapi.dll > "DELETE DNSAPI.DLL.bat"
7z a %APPVEYOR_BUILD_FOLDER%\PD-Loader-%CONFIGURATION%-AppVeyor.zip *
ren dinput8.dll dnsapi.dll
del "DELETE DNSAPI.DLL.bat"
7z a %APPVEYOR_BUILD_FOLDER%\PD-Loader-%CONFIGURATION%-AppVeyor-Vista7.zip *
cd %TMP%\update\
echo del dnsapi.dll > "DELETE DNSAPI.DLL.bat"
7z a %APPVEYOR_BUILD_FOLDER%\PD-Loader-%CONFIGURATION%-Update-AppVeyor.zip *
ren dinput8.dll dnsapi.dll
del "DELETE DNSAPI.DLL.bat"
7z a %APPVEYOR_BUILD_FOLDER%\PD-Loader-%CONFIGURATION%-Update-AppVeyor-Vista7.zip *
cd %TMP%\amd-pack\amd-tools\
C:\Python38\python.exe -m pip install cx_freeze
@@ -23,10 +23,6 @@ player_data_manager = true
# adjusts 2D and 3D animations to retain their original speed at different frame rates.
frame_rate_manager = false
# sets an unlimited per session play count for the normal game mode.
# this means the player won't be sent back to the title screen after 2 plays.
stage_manager = false
# skip unnecessary DATA_INITIALIZE loading time, speed up SYSTEM_STARTUP and skip the startup WARNING message.
# further improvements can be achieved by shortening the duration of the pv_999 script file as it's test loaded during the SYSTEM_STARTUP.
fast_loader = true
@@ -1,10 +0,0 @@
#Check you Vendor ID and Product ID in Device Manager or dxdiag tool
[genericusbinput]
VID = 046D
PID = C216
[customkeymapping]
GU_BUTTON8 = GU_BUTTON1 + GU_BUTTON2 + GU_BUTTON3 + GU_BUTTON4
@@ -18,6 +18,11 @@ touch_slider_emulation_speed = 750.0
# Preferred Xinput controller (0-3)
xinput_preferred =0
# DirectInput Vendor ID and Product ID
# Check them in Device Manager or dxdiag.exe
VID = 046D
PID = C216
# Rumble (Xinput)
rumble =true
@@ -1,2 +0,0 @@
[modules]
# Manual editing is NOT recommended as the game will save here during gameplay
@@ -1,4 +0,0 @@
[SFX]
# INI Format = ' pv.xxx.btn = sfx id (ex. 5) '
# pv.001.btn=2 for example
# pv.xxx.btn, pv.xxx.chain, pv.xxx.slide & pv.xxx.touch can all be assigned using the format
@@ -1,3 +0,0 @@
[skins]
# INI Format = ' pv.xxx.skin = skin ID (ex. 123) '
# pv.001.skin=100 for example
@@ -52,7 +52,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<TargetName>dinput8</TargetName>
<TargetName>dnsapi</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
@@ -100,6 +100,10 @@
<ModuleDefinitionFile>x64.def</ModuleDefinitionFile>
<AdditionalOptions>-d2:-FH4- %(AdditionalOptions)</AdditionalOptions>
</Link>
<Manifest>
<EnableDpiAwareness>
</EnableDpiAwareness>
</Manifest>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="exception.hpp" />
+134 -7
View File
@@ -1,5 +1,14 @@
#include "framework.h"
#include "exception.hpp"
#include <VersionHelpers.h>
#include <Shlwapi.h>
#pragma comment(lib, "Shlwapi.lib")
#include <filesystem>
#include <fstream>
#include <iostream>
#pragma comment(linker,"\"/manifestdependency:type='win32' \
name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \
processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
HMODULE hm;
std::vector<std::wstring> iniPaths;
@@ -180,7 +189,7 @@ void LoadDVA(std::wstring &path, LPCWSTR dir, LPCWSTR fileName)
default:
msg.append(L"\n\nAre all dependencies installed?");
}
msg.append(L"\nPlease refer to the quick start guide or the wiki.");
msg.append(L"\nPlease refer to the quick start guide or the wiki.\n\nAlso, please note that 3rd-party plugins may require additional libraries.");
MessageBoxW(0, msg.c_str(), L"PD Loader", MB_ICONERROR);
}
}
@@ -718,12 +727,90 @@ LONG WINAPI CustomUnhandledExceptionFilter(LPEXCEPTION_POINTERS ExceptionInfo)
void Init()
{
SetProcessDPIAware();
auto dir = GetModuleFileNameW(hm).substr(0, GetModuleFileNameW(hm).find_last_of(L"/\\") + 1);
SetCurrentDirectoryW(dir.c_str());
std::wstring modulePath = GetModuleFileNameW(hm);
std::wstring moduleName = modulePath.substr(modulePath.find_last_of(L"/\\") + 1);
moduleName.resize(moduleName.find_last_of(L'.'));
modulePath.resize(modulePath.find_last_of(L"/\\") + 1);
iniPaths.emplace_back(modulePath + moduleName + L".ini");
iniPaths.emplace_back(modulePath + L"plugins\\config.ini");
const auto CONFIG_FILE = L"plugins\\config.ini";
const auto CONFIG_FILE_TEMPLATE = L"plugins\\config_template.bin";
iniPaths.emplace_back(modulePath + CONFIG_FILE);
// initialize configuration files.
CopyFileW(CONFIG_FILE_TEMPLATE, CONFIG_FILE, true);
const auto COMPONENTS_TEMPLATE = L"plugins\\components_template.bin";
const auto COMPONENTS = L"plugins\\components.ini";
CopyFileW(COMPONENTS_TEMPLATE, COMPONENTS, true);
const auto KEYCONFIG_TEMPLATE = L"plugins\\keyconfig_template.bin";
const auto KEYCONFIG = L"plugins\\keyconfig.ini";
CopyFileW(KEYCONFIG_TEMPLATE, KEYCONFIG, true);
const auto PLAYERDATA_TEMPLATE = L"plugins\\playerdata_template.bin";
const auto PLAYERDATA = L"plugins\\playerdata.ini";
CopyFileW(PLAYERDATA_TEMPLATE, PLAYERDATA, true);
const auto DIVASOUND_TEMPLATE = L"plugins\\DivaSound_template.bin";
const auto DIVASOUND = L"plugins\\DivaSound.ini";
CopyFileW(DIVASOUND_TEMPLATE, DIVASOUND, true);
const auto SHADERPATCH_TEMPLATE = L"plugins\\ShaderPatch_template.bin";
const auto SHADERPATCH = L"plugins\\ShaderPatch.ini";
CopyFileW(SHADERPATCH_TEMPLATE, SHADERPATCH, true);
const auto SHADERPATCHCONFIG_TEMPLATE = L"plugins\\ShaderPatchConfig_template.bin";
const auto SHADERPATCHCONFIG = L"plugins\\ShaderPatchConfig.ini";
CopyFileW(SHADERPATCHCONFIG_TEMPLATE, SHADERPATCHCONFIG, true);
if ((PathFileExistsW(CONFIG_FILE_TEMPLATE) && !PathFileExistsW(CONFIG_FILE)) ||
(PathFileExistsW(COMPONENTS_TEMPLATE) && !PathFileExistsW(COMPONENTS)) ||
(PathFileExistsW(KEYCONFIG_TEMPLATE) && !PathFileExistsW(KEYCONFIG)) ||
(PathFileExistsW(PLAYERDATA_TEMPLATE) && !PathFileExistsW(PLAYERDATA)) ||
(PathFileExistsW(DIVASOUND_TEMPLATE) && !PathFileExistsW(DIVASOUND)) ||
(PathFileExistsW(SHADERPATCH_TEMPLATE) && !PathFileExistsW(SHADERPATCH)) ||
(PathFileExistsW(SHADERPATCHCONFIG_TEMPLATE) && !PathFileExistsW(SHADERPATCHCONFIG))
)
MessageBoxW(0, L"Could not install configuration files. Is the game in a read-only folder?", L"PD Loader", MB_ICONWARNING);
CreateDirectoryW(L"plugins\\pv_equip", NULL);
const auto eq_modules = L"plugins\\pv_equip\\modules.ini";
if (!PathFileExistsW(eq_modules))
{
std::ofstream stream(eq_modules);
stream << "[modules]\n# Manual editing is NOT recommended as the game will save here during gameplay";
stream.close();
}
const auto eq_sfx = L"plugins\\pv_equip\\sfx.ini";
if (!PathFileExistsW(eq_sfx))
{
std::ofstream stream(eq_sfx);
stream << "[SFX]\n# INI Format = ' pv.xxx.btn = sfx id (ex. 5) '\n# pv.001.btn=2 for example\n# pv.xxx.btn, pv.xxx.chain, pv.xxx.slide & pv.xxx.touch can all be assigned using the format";
stream.close();
}
const auto eq_skins = L"plugins\\pv_equip\\skins.ini";
if (!PathFileExistsW(eq_skins))
{
std::ofstream stream(eq_skins);
stream << "[skins]\n# INI Format = ' pv.xxx.skin = skin ID (ex. 123) '\n# pv.001.skin=100 for example";
stream.close();
}
const std::filesystem::path databank_template = L"ram\\databank_template";
const std::filesystem::path databank = L"ram\\databank";
if (!std::filesystem::exists(databank)&&std::filesystem::exists(databank_template))
{
try
{
std::filesystem::create_directories(databank);
std::filesystem::copy(databank_template, databank, std::filesystem::copy_options::recursive);
}
catch (std::exception& e)
{
std::cout << "[PD Loader] databank copy exception: " << e.what() << std::endl;
MessageBoxW(0, L"Could not install databank files. Is the game in a read-only folder?\n\n", L"PD Loader", MB_ICONWARNING);
}
}
std::wstring m = GetModuleFileNameW(NULL);
m = m.substr(0, m.find_last_of(L"/\\") + 1) + L"logs";
@@ -745,19 +832,59 @@ void Init()
VirtualProtect(&SetUnhandledExceptionFilter, sizeof(ret), protect[0], &protect[1]);
}
auto szSelfName = GetSelfName();
if (iequals(szSelfName, L"dinput8.dll"))
DeleteFileW(L"~dinput8.dll");
std::wstring szSelfName = GetSelfName();
if (iequals(szSelfName, L"DINPUT8.dll"))
{
auto dir = GetCurrentDirectoryW();
WIN32_FIND_DATAW fd;
HANDLE dnsloader = FindFirstFileW(L"dnsapi.dll", &fd);
if (dnsloader != INVALID_HANDLE_VALUE)
{
MessageBoxW(0, L"PD Loader was loaded from dinput8.dll, but dnsapi.dll was found. Aborting.\nPlease refer to the quick start guide or the wiki.", L"PD Loader", MB_ICONERROR);
MessageBoxW(0, L"PD Loader was loaded from \"dinput8.dll\", but \"dnsapi.dll\" was found. Aborting.\nPlease refer to the quick start guide or the wiki.", L"PD Loader", MB_ICONERROR);
exit(1);
}
}
else if (iequals(szSelfName, L"DNSAPI.dll"))
{
WIN32_FIND_DATAW fd;
HANDLE dnsloader = FindFirstFileW(L"dinput8.dll", &fd);
if (dnsloader != INVALID_HANDLE_VALUE)
{
auto dinput_handle = GetModuleHandleW(L"DINPUT8.dll");
if (dinput_handle&&!FreeLibrary(dinput_handle))
{
MessageBoxW(0, L"PD Loader was loaded from \"dnsapi.dll\", but \"dinput8.dll\" was found and PD Loader could not unload it. Please delete \"dinput8.dll\".", L"PD Loader", MB_ICONERROR);
exit(1);
}
else if (!MoveFileExW(L"dinput8.dll", L"~dinput8.dll", MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH))
{
MessageBoxW(0, L"PD Loader was loaded from \"dnsapi.dll\", but \"dinput8.dll\" was found and PD Loader could not delete it automatically\nIs it read-only?", L"PD Loader", MB_ICONERROR);
exit(1);
}
}
if(IsWindows8OrGreater())
{
if (MoveFileExW(L"dnsapi.dll", L"dinput8.dll", MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH))
{
WCHAR DIVA_EXECUTABLE[MAX_PATH];
GetModuleFileNameW(NULL, DIVA_EXECUTABLE, MAX_PATH);
LPWSTR DIVA_COMMAND_LINE = GetCommandLineW();
STARTUPINFOW si;
PROCESS_INFORMATION pi;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
ZeroMemory(&pi, sizeof(pi));
CreateProcessW(DIVA_EXECUTABLE, DIVA_COMMAND_LINE, NULL, NULL, false, CREATE_NEW_CONSOLE, NULL, NULL, &si, &pi);
exit(0);
}
else MessageBoxW(0, L"It is highly recommended to rename \"dnsapi.dll\" \"dinput8.dll\" on Windows 8/8.1/10 to avoid issues, but PD Loader could not rename the file automatically.\nIs it read-only?", L"PD Loader", MB_ICONWARNING);
}
}
else
{
MessageBoxW(0, L"Supported file names:\n\"dnsapi.dll\" (Windows Vista/7)\n\"dinput8.dll\"", L"PD Loader", MB_ICONERROR);
exit(1);
}
LoadEverything();
@@ -927,10 +927,15 @@ public:
int width = GetPrivateProfileIntW(_iniSectionName, _iniVarName, -39, _iniFilePath);
int height = GetPrivateProfileIntW(_iniSectionName, _iniVarName2, -39, _iniFilePath);
if (width == -39 || height == -39) {
tempSysStr = Convert::ToInt32(_defaultVal.width).ToString() + L"x" + Convert::ToInt32(_defaultVal.height).ToString();
combobox->Text = tempSysStr;
if (_defaultVal.width == -1 || _defaultVal.height == -1)
width = -1;
else
{
tempSysStr = Convert::ToInt32(_defaultVal.width).ToString() + L"x" + Convert::ToInt32(_defaultVal.height).ToString();
combobox->Text = tempSysStr;
}
}
else if (width == -1 || height == -1) { // -1 -> Match window/screen
if (width == -1 || height == -1) { // -1 -> Match window/screen
if (_opts & RESOPT_INCLUDE_MATCH_WINDOW)
combobox->Text = RESOPT_MATCH_WINDOW_TEXT;
else if (_opts & RESOPT_INCLUDE_MATCH_SCREEN)
@@ -273,9 +273,7 @@ ConfigOptionBase* componentsArray[] = {
new BooleanOption(L"player_data_manager", COMPONENTS_SECTION, COMPONENTS_FILE, L"Player Data Manager", L"Loads user-defined values into the PlayerData struct.\nRequired for modules and game mode modifiers.", false, true),
new BooleanOption(L"frame_rate_manager", COMPONENTS_SECTION, COMPONENTS_FILE, L"Frame Rate Manager", L"Adjusts animations to the correct speed at different frame rates.\nOnly needed when FPS isn't locket at 60.", false, true),
new BooleanOption(L"stage_manager", COMPONENTS_SECTION, COMPONENTS_FILE, L"Stage Manager", L"Allows for playing unlimited songs per session.", false, true),
new BooleanOption(L"frame_rate_manager", COMPONENTS_SECTION, COMPONENTS_FILE, L"Frame Rate Manager", L"Adjusts animations to the correct speed at different frame rates.\nOnly needed when FPS isn't locked at 60.", false, true),
new BooleanOption(L"fast_loader", COMPONENTS_SECTION, COMPONENTS_FILE, L"Fast Loader", L"Skip or speed up unnecessary loading steps.", false, true),
+2 -1
View File
@@ -33,17 +33,18 @@ namespace Launcher {
this->ClientSize = Drawing::Size(444, 323);
TabPadding^ tabpad = gcnew TabPadding(tabControl);
// if components.ini has no section name, add one
if (!IsLineInFile("[components]", COMPONENTS_FILE))
{
PrependFile("[components]\n", COMPONENTS_FILE);
*ComponentsConfigChanged = true;
}
// if playerdata.ini has no section name, add one
if (!IsLineInFile("[playerdata]", PLAYERDATA_FILE))
{
PrependFile("[playerdata]\n", PLAYERDATA_FILE);
*PlayerdataConfigChanged = true;
}
// if keyconfig.ini has no section name, add one
@@ -7,7 +7,6 @@
#include "PlayerDataManager.h"
#include "FrameRateManager.h"
#include "FastLoader.h"
#include "StageManager.h"
#include "CameraController.h"
#include "DebugComponent.h"
#include "ScaleComponent.h"
@@ -43,7 +42,6 @@ namespace TLAC::Components
new FastLoader(),
new ScaleComponent(),
new ScoreSaver(),
new StageManager(),
new CameraController(),
new DebugComponent(),
};
@@ -1,41 +0,0 @@
#include "StageManager.h"
#include "../Constants.h"
#include <windows.h>
namespace TLAC::Components
{
StageManager::StageManager()
{
}
StageManager::~StageManager()
{
}
const char* StageManager::GetDisplayName()
{
return "stage_manager";
}
void StageManager::Initialize(ComponentsManager*)
{
// add the offset between moving 2 into ebx and the start of the function
int32_t* playCount = (int32_t*)(((uint8_t*)PLAYS_PER_SESSION_GETTER_ADDRESS) + 0x7);
DWORD oldProtect;
VirtualProtect(playCount, sizeof(int32_t), PAGE_EXECUTE_READWRITE, &oldProtect);
// set ’Ê탂[ƒh per session play count
*playCount = GetPlayCount();
}
void StageManager::Update()
{
return;
}
int32_t StageManager::GetPlayCount()
{
return INT32_MAX;
}
}
@@ -1,21 +0,0 @@
#pragma once
#include "EmulatorComponent.h"
#include <stdint.h>
namespace TLAC::Components
{
class StageManager : public EmulatorComponent
{
public:
StageManager();
~StageManager();
virtual const char* GetDisplayName() override;
virtual void Initialize(ComponentsManager*) override;
virtual void Update() override;
private:
int32_t GetPlayCount();
};
}
@@ -5,7 +5,7 @@
#include "../../../FileSystem/ConfigFile.h"
#include <stdio.h>
const std::string GU_CONFIG_FILE_NAME = "genericusbinput.ini";
const std::string GU_CONFIG_FILE_NAME = "keyconfig.ini";
namespace TLAC::Input
{
@@ -133,7 +133,6 @@
<ClInclude Include="Components\PlayerDataManager.h" />
<ClInclude Include="Components\ScaleComponent.h" />
<ClInclude Include="Components\ScoreSaver.h" />
<ClInclude Include="Components\StageManager.h" />
<ClInclude Include="Constants.h" />
<ClInclude Include="FileSystem\ConfigFile.h" />
<ClInclude Include="FileSystem\TextFile.h" />
@@ -192,7 +191,6 @@
<ClCompile Include="Components\PlayerDataManager.cpp" />
<ClCompile Include="Components\ScaleComponent.cpp" />
<ClCompile Include="Components\ScoreSaver.cpp" />
<ClCompile Include="Components\StageManager.cpp" />
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="FileSystem\ConfigFile.cpp" />
<ClCompile Include="FileSystem\TextFile.cpp" />
@@ -51,9 +51,6 @@
<ClInclude Include="Components\PlayerDataManager.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Components\StageManager.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Components\Input\InputBufferType.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -245,9 +242,6 @@
<ClCompile Include="Components\PlayerDataManager.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Components\StageManager.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Components\Input\InputEmulator.cpp">
<Filter>Source Files</Filter>
</ClCompile>