mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2025-12-09 03:33:29 +08:00
missing files
This commit is contained in:
11
CompressSave/NoneWrapC/CMakeLists.txt
Normal file
11
CompressSave/NoneWrapC/CMakeLists.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
|
||||
project(nonewrap)
|
||||
|
||||
add_library(nonewrap SHARED
|
||||
dllmain.c nonewrap.c nonewrap.h)
|
||||
|
||||
target_compile_definitions(nonewrap PRIVATE NONEWRAP_EXPORTS)
|
||||
if(WIN32)
|
||||
set_target_properties(nonewrap PROPERTIES PREFIX "")
|
||||
endif()
|
||||
20
CompressSave/NoneWrapC/dllmain.c
Normal file
20
CompressSave/NoneWrapC/dllmain.c
Normal file
@@ -0,0 +1,20 @@
|
||||
// dllmain.cpp : Defines the entry point for the DLL application.
|
||||
#include <windows.h>
|
||||
|
||||
BOOL APIENTRY DllMain( HMODULE hModule,
|
||||
DWORD ul_reason_for_call,
|
||||
LPVOID lpReserved
|
||||
)
|
||||
{
|
||||
switch (ul_reason_for_call)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
DisableThreadLibraryCalls(hModule);
|
||||
break;
|
||||
case DLL_THREAD_ATTACH:
|
||||
case DLL_THREAD_DETACH:
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
62
CompressSave/NoneWrapC/nonewrap.c
Normal file
62
CompressSave/NoneWrapC/nonewrap.c
Normal file
@@ -0,0 +1,62 @@
|
||||
#include "nonewrap.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <limits.h>
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
size_t __stdcall CompressBufferBound(size_t inBufferSize)
|
||||
{
|
||||
return inBufferSize * 4;
|
||||
}
|
||||
|
||||
size_t __stdcall CompressBegin(Context** pctx, int compressionLevel, void* outBuff, size_t outCapacity, void* dict, size_t dictSize)
|
||||
{
|
||||
Context *ctx = (Context *)malloc(sizeof(Context));
|
||||
if (ctx == NULL) return -1;
|
||||
*pctx = ctx;
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t __stdcall CompressUpdate(Context* ctx,void* dstBuffer, size_t dstCapacity,const void* srcBuffer, size_t srcSize)
|
||||
{
|
||||
memcpy(dstBuffer, srcBuffer, srcSize);
|
||||
return srcSize;
|
||||
}
|
||||
|
||||
size_t __stdcall CompressEnd(Context* ctx, void* dstBuffer, size_t dstCapacity)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void __stdcall CompressContextFree(Context* ctx)
|
||||
{
|
||||
free(ctx);
|
||||
}
|
||||
|
||||
size_t __stdcall DecompressBegin(Context **pdctx,void *inBuffer,size_t *inBufferSize, size_t *blockSize, void* dict, size_t dictSize)
|
||||
{
|
||||
Context *ctx = (Context *)malloc(sizeof(Context));
|
||||
if (ctx == NULL) return -1;
|
||||
*pdctx = ctx;
|
||||
*inBufferSize = 0;
|
||||
*blockSize = 4 * 512 * 1024;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void __stdcall DecompressContextReset(Context* dctx)
|
||||
{
|
||||
}
|
||||
|
||||
size_t __stdcall DecompressUpdate(Context* dctx, void* outBuffer, size_t * outBufferSize, void* inBuffer, size_t * inBufferSize)
|
||||
{
|
||||
memcpy(outBuffer, inBuffer, *inBufferSize);
|
||||
*outBufferSize = *inBufferSize;
|
||||
return 1;
|
||||
}
|
||||
|
||||
size_t __stdcall DecompressEnd(Context* ctx)
|
||||
{
|
||||
free(ctx);
|
||||
return 0;
|
||||
}
|
||||
36
CompressSave/NoneWrapC/nonewrap.h
Normal file
36
CompressSave/NoneWrapC/nonewrap.h
Normal file
@@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
#define API_EXTERN_C extern "C"
|
||||
#else
|
||||
#define API_EXTERN_C
|
||||
#endif
|
||||
#ifdef NONEWRAP_EXPORTS
|
||||
#define NONEAPI API_EXTERN_C __declspec(dllexport)
|
||||
#else
|
||||
#define NONEAPI API_EXTERN_C __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
int n;
|
||||
} Context;
|
||||
|
||||
NONEAPI void __stdcall CompressContextFree(Context* ctx);
|
||||
|
||||
NONEAPI size_t __stdcall CompressBufferBound(size_t inBufferSize);
|
||||
|
||||
NONEAPI size_t __stdcall CompressBegin(Context** ctx, int compressionLevel, void* outBuff, size_t outCapacity, void* dict, size_t dictSize);
|
||||
|
||||
NONEAPI size_t __stdcall CompressUpdate(Context* ctx, void* dstBuffer, size_t dstCapacity, const void* srcBuffer, size_t srcSize);
|
||||
|
||||
NONEAPI size_t __stdcall CompressEnd(Context* ctx, void* dstBuffer, size_t dstCapacity);
|
||||
|
||||
NONEAPI size_t __stdcall DecompressBegin(Context** pdctx, void* inBuffer, size_t* inBufferSize, size_t* blockSize, void* dict, size_t dictSize);
|
||||
|
||||
NONEAPI void __stdcall DecompressContextReset(Context* dctx);
|
||||
|
||||
NONEAPI size_t __stdcall DecompressUpdate(Context* dctx, void* outBuffer, size_t* outBufferSize, void* inBuffer, size_t* inBufferSize);
|
||||
|
||||
NONEAPI size_t __stdcall DecompressEnd(Context* dctx);
|
||||
Reference in New Issue
Block a user