Skip to content

Commit

Permalink
Remove old patches.xml.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpd002 committed Jan 14, 2025
1 parent 06db080 commit a7edad8
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 93 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.gradle
build
build_android/build
build_android/src/main/assets/patches.xml
build_android/src/main/assets/GameConfig.xml
build_android/local.properties
build_android/proguard-project.txt
build_android/.*
Expand Down
66 changes: 0 additions & 66 deletions Source/ee/PS2OS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
// game's lifetime doesn't seem to be used, so this bug probably doesn't have any side effect.
#define SEMA_ID_BASE 0

#define PATCHESFILENAME "patches.xml"
#define GAMECONFIG_FILENAME "GameConfig.xml"

#define LOG_NAME ("ps2os")
Expand Down Expand Up @@ -437,7 +436,6 @@ void CPS2OS::LoadELF(Framework::CStream* stream, const char* executablePath, con
}();

LoadExecutableInternal();
ApplyPatches();
ApplyGameConfig();

OnExecutableChange();
Expand Down Expand Up @@ -571,70 +569,6 @@ uint32 CPS2OS::LoadExecutable(const char* path, const char* section)
return result;
}

void CPS2OS::ApplyPatches()
{
std::unique_ptr<Framework::Xml::CNode> document;
try
{
#ifdef __ANDROID__
Framework::Android::CAssetStream patchesStream(PATCHESFILENAME);
#else
auto patchesPath = Framework::PathUtils::GetAppResourcesPath() / PATCHESFILENAME;
Framework::CStdStream patchesStream(Framework::CreateInputStdStream(patchesPath.native()));
#endif
document = Framework::Xml::CParser::ParseDocument(patchesStream);
if(!document) return;
}
catch(const std::exception& exception)
{
CLog::GetInstance().Print(LOG_NAME, "Failed to open patch definition file: %s.\r\n", exception.what());
return;
}

auto patchesNode = document->Select("Patches");
if(patchesNode == NULL)
{
return;
}

for(Framework::Xml::CFilteringNodeIterator itNode(patchesNode, "Executable"); !itNode.IsEnd(); itNode++)
{
auto executableNode = (*itNode);

const char* name = executableNode->GetAttribute("Name");
if(name == NULL) continue;

if(!strcmp(name, GetExecutableName()))
{
//Found the right executable
unsigned int patchCount = 0;

for(Framework::Xml::CFilteringNodeIterator itNode(executableNode, "Patch"); !itNode.IsEnd(); itNode++)
{
auto patch = (*itNode);

const char* addressString = patch->GetAttribute("Address");
const char* valueString = patch->GetAttribute("Value");

if(addressString == nullptr) continue;
if(valueString == nullptr) continue;

uint32 value = 0, address = 0;
if(sscanf(addressString, "%x", &address) == 0) continue;
if(sscanf(valueString, "%x", &value) == 0) continue;

*(uint32*)&m_ram[address] = value;

patchCount++;
}

CLog::GetInstance().Print(LOG_NAME, "Applied %i patch(es).\r\n", patchCount);

break;
}
}
}

void CPS2OS::ApplyGameConfig()
{
std::unique_ptr<Framework::Xml::CNode> document;
Expand Down
1 change: 0 additions & 1 deletion Source/ee/PS2OS.h
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,6 @@ class CPS2OS : public CBiosDebugInfoProvider
void LoadExecutableInternal();
void UnloadExecutable();

void ApplyPatches();
void ApplyGameConfig();

void DisassembleSysCall(uint8);
Expand Down
2 changes: 1 addition & 1 deletion Source/ui_ios/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ set(OSX_HEADERS
)

set(OSX_RES
${CMAKE_CURRENT_SOURCE_DIR}/../../patches.xml
${CMAKE_CURRENT_SOURCE_DIR}/../../GameConfig.xml
${CMAKE_CURRENT_SOURCE_DIR}/Base.lproj/Main.storyboard
${CMAKE_CURRENT_SOURCE_DIR}/Resources/[email protected]
${CMAKE_CURRENT_SOURCE_DIR}/Resources/boxart.png
Expand Down
2 changes: 1 addition & 1 deletion Source/ui_qt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ if(TARGET_PLATFORM_MACOS)
FILE(GLOB ARCADE_DEFS ${CMAKE_CURRENT_SOURCE_DIR}/../../arcadedefs/*.arcadedef)
set(OSX_RES
${CMAKE_CURRENT_SOURCE_DIR}/macos/AppIcon.icns
${CMAKE_CURRENT_SOURCE_DIR}/../../patches.xml
${CMAKE_CURRENT_SOURCE_DIR}/../../GameConfig.xml
)
if(DEBUGGER_INCLUDED)
list(APPEND OSX_RES ${CMAKE_CURRENT_SOURCE_DIR}/../../ee_functions.xml)
Expand Down
2 changes: 1 addition & 1 deletion build_android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ android {
}

task copyPatchesFile(type: Copy) {
from '../patches.xml'
from '../GameConfig.xml'
into 'src/main/assets'
}

Expand Down
4 changes: 2 additions & 2 deletions installer_win32/installer32.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Section "Play! (required)"
File /oname=platforms\qwindows.dll "${BINARY_INPUT_PATH}\platforms\qwindows.dll"
File /oname=styles\qwindowsvistastyle.dll "${BINARY_INPUT_PATH}\styles\qwindowsvistastyle.dll"
File /oname=imageformats\qjpeg.dll "${BINARY_INPUT_PATH}\imageformats\qjpeg.dll"
File "..\Patches.xml"
File "..\GameConfig.xml"
File "..\states.db"

SetOutPath $INSTDIR\arcadedefs
Expand Down Expand Up @@ -131,7 +131,7 @@ Section "Uninstall"
Delete $INSTDIR\platforms\qwindows.dll
Delete $INSTDIR\styles\qwindowsvistastyle.dll
Delete $INSTDIR\imageformats\qjpeg.dll
Delete $INSTDIR\Patches.xml
Delete $INSTDIR\GameConfig.xml
Delete $INSTDIR\states.db
Delete $INSTDIR\arcadedefs\*
Delete $INSTDIR\uninstall.exe
Expand Down
2 changes: 0 additions & 2 deletions installer_win32/installer64.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ Section "Play! (required)"
File /oname=platforms\qwindows.dll "${BINARY_INPUT_PATH}\platforms\qwindows.dll"
File /oname=styles\qwindowsvistastyle.dll "${BINARY_INPUT_PATH}\styles\qwindowsvistastyle.dll"
File /oname=imageformats\qjpeg.dll "${BINARY_INPUT_PATH}\imageformats\qjpeg.dll"
File "..\Patches.xml"
File "..\GameConfig.xml"
File "..\states.db"

Expand Down Expand Up @@ -135,7 +134,6 @@ Section "Uninstall"
Delete $INSTDIR\platforms\qwindows.dll
Delete $INSTDIR\styles\qwindowsvistastyle.dll
Delete $INSTDIR\imageformats\qjpeg.dll
Delete $INSTDIR\Patches.xml
Delete $INSTDIR\GameConfig.xml
Delete $INSTDIR\states.db
Delete $INSTDIR\arcadedefs\*
Expand Down
18 changes: 0 additions & 18 deletions patches.xml

This file was deleted.

0 comments on commit a7edad8

Please sign in to comment.