mirror of
https://github.com/open-goal/jak-project
synced 2026-08-16 21:28:00 -04:00
Automatically watch PCSX2 savestate directory and analyze the EE Memory (#507)
* add elzip library (doesn't require zlib) * Can analyze directly from a PCSX2 save-state now * Add scaffolding to auto-watch for new save-states * .gitattributes fix
This commit is contained in:
Vendored
+48
@@ -0,0 +1,48 @@
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
#include <elzip.hpp>
|
||||
#include <fswrapper.hpp>
|
||||
#include <unzipper.hpp>
|
||||
|
||||
namespace elz
|
||||
{
|
||||
void extractZip(std::string zipname, std::string target)
|
||||
{
|
||||
ziputils::unzipper zipFile;
|
||||
zipFile.open(zipname.c_str());
|
||||
for (std::string filename : zipFile.getFilenames())
|
||||
{
|
||||
std::filesystem::path cDir(target + ((std::filesystem::path(filename).parent_path().string() == "") ? "" : "/") + std::filesystem::path(filename).parent_path().string());
|
||||
std::filesystem::path cFile(target + "/" + filename);
|
||||
std::filesystem::path fillPath;
|
||||
for (std::filesystem::path pathPart : cDir)
|
||||
{
|
||||
fillPath /= pathPart;
|
||||
if (!exists(fillPath))
|
||||
{
|
||||
create_directory(fillPath);
|
||||
}
|
||||
}
|
||||
std::cout << "Opening file : " << filename << std::endl;
|
||||
zipFile.openEntry(filename.c_str());
|
||||
std::ofstream wFile;
|
||||
wFile.open(cFile.string(), std::ios_base::binary | std::ios_base::out);
|
||||
std::string dumped = zipFile.dump();
|
||||
wFile.write(dumped.c_str(), dumped.size());
|
||||
wFile.close();
|
||||
}
|
||||
}
|
||||
|
||||
void extractFile(std::string zipname, std::string filename, std::string target)
|
||||
{
|
||||
ziputils::unzipper zipFile;
|
||||
zipFile.open(zipname.c_str());
|
||||
zipFile.openEntry(filename.c_str());
|
||||
std::ofstream wFile;
|
||||
wFile.open(target, std::ios_base::binary | std::ios_base::out);
|
||||
std::string dumped = zipFile.dump();
|
||||
wFile.write(dumped.c_str(), dumped.size());
|
||||
wFile.close();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user