Add bps-in-memory creator, also update version

This commit is contained in:
Alcaro
2018-04-25 18:45:30 +02:00
parent 16e7219456
commit b653aa9bbb
2 changed files with 29 additions and 5 deletions

View File

@@ -7,8 +7,8 @@
1 24 "flips.Manifest"
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,3,2,0
PRODUCTVERSION 1,3,2,0
FILEVERSION 1,4,0,0
PRODUCTVERSION 1,4,0,0
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS 0
//VS_FF_DEBUG VS_FF_PATCHED VS_FF_PRERELEASE VS_FF_PRIVATEBUILD VS_FF_SPECIALBUILD VS_FFI_FILEFLAGSMASK
@@ -22,12 +22,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Alcaro"
VALUE "FileDescription", "Flips Patch Utility"
VALUE "FileVersion", "1.3.2.0"
VALUE "FileVersion", "1.4.0.0"
VALUE "InternalName", "Floating IPS"
VALUE "LegalCopyright", "<22>2013-2015 Alcaro"
VALUE "LegalCopyright", "<22>2013-2018 Alcaro"
VALUE "OriginalFilename", "flips.exe"
VALUE "ProductName", "Floating IPS"
VALUE "ProductVersion", "1.3.2.0"
VALUE "ProductVersion", "1.4.0.0"
END
END
END

View File

@@ -5,6 +5,7 @@
#include "global.h"
#include <stdint.h>
#include <string.h>
#ifndef __cplusplus
#include <stdbool.h>//bool; if this file does not exist (hi msvc), remove it and uncomment the following three lines.
@@ -59,6 +60,29 @@ enum bpserror bps_create_delta(file* source, file* target, struct mem metadata,
bool (*progress)(void* userdata, size_t done, size_t total), void* userdata,
bool moremem);
//Like the above, but takes struct mem rather than file*. Better use the above if possible, the
// creator takes 5*(source+target) in addition to whatever the source/target arguments need.
inline enum bpserror bps_create_delta_inmem(struct mem source, struct mem target, struct mem metadata, struct mem * patch,
bool (*progress)(void* userdata, size_t done, size_t total), void* userdata,
bool moremem)
{
class memfile : public file {
public:
const uint8_t * m_ptr;
size_t m_len;
size_t len() { return m_len; }
bool read(uint8_t* target, size_t start, size_t len) { memcpy(target, m_ptr+start, len); return true; }
memfile(const uint8_t * ptr, size_t len) : m_ptr(ptr), m_len(len) {}
};
memfile sourcef(source.ptr, source.len);
memfile targetf(target.ptr, target.len);
return bps_create_delta(&sourcef, &targetf, metadata, patch, progress, userdata, moremem);
}
//Frees the memory returned in the output parameters of the above. Do not call it twice on the same
// input, nor on anything you got from anywhere else. bps_free is guaranteed to be equivalent to
// calling stdlib.h's free() on mem.ptr.