00cc9309cb
de6e324bdseparate emu thread10d3daf86Roms List improvements95d202f37Let's make the rom list process on a separate thread so the emulator doesnt take ages to load.fc306967fWow the ROM Header was just completely busted. Game list view works nowbad1691eefuck this shit2b59e5f46game list in progressd26417b83remappable inputs in progressac4af8106inpute72abc240update readme430139dc9Qt6 frontend3080d4d45Fix this small bug too08cd13b85Cop0 unused functions do not actually pose a threat (as per manual). They don't do anything, so shall we.61bb4fb44make idle loop detection a little more specific with where the load goesb037de4c3SAZDFsdff12e81e73eneed to figure out why n64-systemtest loops indefinitely at some address that appears to be valid (i think it's me not invalidating the cache properly)204f0e13bidle skipping seems to work!cb8bb634asdkfjlasdf58e5c89c1Fix compilation issue on my machine (no idea)24fb2898eattempting more serious idle skipping214719577Place rsp.Step inside cached interpreter. Gains about 3 more fpsbb97dcc23mmmmm920b77d38wjkhasdfjhkasdf430ccdab4it's a start...4f42a673aCached interpreter plays Mario 64. Start looking into RSP as wellc9a030787idle skipping works!5fbda03cenew idea366637abaIdle skipping... maybe?609fa2fb0Cache instructions implemented but broken lmao. Commented out for nowe140a6d12- Stop using inheritance for CPU, instead use composition. - Introduce KAIZEN_JIT_ENABLED optional define instead of relying on __aarch64__ and the like. - More cache work68e613057prep cache impl811b4d809fix clang formatfda755f7didkd5024ebbfsmall MI refactor in preparation of (eventually) implementing the RDRAM interface properly694b45341Merge commit '206dcdedf195fb320913584180edb12c7731e396' as 'external/SDL'206dcdedfSquashed 'external/SDL/' content from commit 4d17b99d0a4d16e1cb4need to update sdl848b19920Fix compilation errordb61b5299Merge commit 'e94a94559f28e49678fbcf72199a5258137b0fe9' as 'external/imgui'e94a94559Squashed 'external/imgui/' content from commit 02e9b8cac52edb3757need to update imguic1a705e86Emulate weird JALR behaviour4b4c32f4bFix exception for "unusable COP1" in 4 instructions i missed accidentally (again)df5828142Bug putting 0s in the log everywheref8b580048Make isviewer a sink to file8241e9735Fix exception for "unusable COP1" in 4 instructions i missed accidentallyb29715f20small changesd9a620bc1make use of my new small utility library0d1aa938eAdd 'external/ircolib/' from commit 'ce3cd726c8df8388d554abf8bb55d55020eb4450'e64eb40b3Fuck git git-subtree-dir: external/ircolib git-subtree-split:de6e324bde
238 lines
7.0 KiB
C
238 lines
7.0 KiB
C
/* LzmaDec.h -- LZMA Decoder
|
|
2023-04-02 : Igor Pavlov : Public domain */
|
|
|
|
#ifndef ZIP7_INC_LZMA_DEC_H
|
|
#define ZIP7_INC_LZMA_DEC_H
|
|
|
|
#include "7zTypes.h"
|
|
|
|
EXTERN_C_BEGIN
|
|
|
|
/* #define Z7_LZMA_PROB32 */
|
|
/* Z7_LZMA_PROB32 can increase the speed on some CPUs,
|
|
but memory usage for CLzmaDec::probs will be doubled in that case */
|
|
|
|
typedef
|
|
#ifdef Z7_LZMA_PROB32
|
|
UInt32
|
|
#else
|
|
UInt16
|
|
#endif
|
|
CLzmaProb;
|
|
|
|
|
|
/* ---------- LZMA Properties ---------- */
|
|
|
|
#define LZMA_PROPS_SIZE 5
|
|
|
|
typedef struct
|
|
{
|
|
Byte lc;
|
|
Byte lp;
|
|
Byte pb;
|
|
Byte _pad_;
|
|
UInt32 dicSize;
|
|
} CLzmaProps;
|
|
|
|
/* LzmaProps_Decode - decodes properties
|
|
Returns:
|
|
SZ_OK
|
|
SZ_ERROR_UNSUPPORTED - Unsupported properties
|
|
*/
|
|
|
|
SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size);
|
|
|
|
|
|
/* ---------- LZMA Decoder state ---------- */
|
|
|
|
/* LZMA_REQUIRED_INPUT_MAX = number of required input bytes for worst case.
|
|
Num bits = log2((2^11 / 31) ^ 22) + 26 < 134 + 26 = 160; */
|
|
|
|
#define LZMA_REQUIRED_INPUT_MAX 20
|
|
|
|
typedef struct
|
|
{
|
|
/* Don't change this structure. ASM code can use it. */
|
|
CLzmaProps prop;
|
|
CLzmaProb *probs;
|
|
CLzmaProb *probs_1664;
|
|
Byte *dic;
|
|
SizeT dicBufSize;
|
|
SizeT dicPos;
|
|
const Byte *buf;
|
|
UInt32 range;
|
|
UInt32 code;
|
|
UInt32 processedPos;
|
|
UInt32 checkDicSize;
|
|
UInt32 reps[4];
|
|
UInt32 state;
|
|
UInt32 remainLen;
|
|
|
|
UInt32 numProbs;
|
|
unsigned tempBufSize;
|
|
Byte tempBuf[LZMA_REQUIRED_INPUT_MAX];
|
|
} CLzmaDec;
|
|
|
|
#define LzmaDec_CONSTRUCT(p) { (p)->dic = NULL; (p)->probs = NULL; }
|
|
#define LzmaDec_Construct(p) LzmaDec_CONSTRUCT(p)
|
|
|
|
void LzmaDec_Init(CLzmaDec *p);
|
|
|
|
/* There are two types of LZMA streams:
|
|
- Stream with end mark. That end mark adds about 6 bytes to compressed size.
|
|
- Stream without end mark. You must know exact uncompressed size to decompress such stream. */
|
|
|
|
typedef enum
|
|
{
|
|
LZMA_FINISH_ANY, /* finish at any point */
|
|
LZMA_FINISH_END /* block must be finished at the end */
|
|
} ELzmaFinishMode;
|
|
|
|
/* ELzmaFinishMode has meaning only if the decoding reaches output limit !!!
|
|
|
|
You must use LZMA_FINISH_END, when you know that current output buffer
|
|
covers last bytes of block. In other cases you must use LZMA_FINISH_ANY.
|
|
|
|
If LZMA decoder sees end marker before reaching output limit, it returns SZ_OK,
|
|
and output value of destLen will be less than output buffer size limit.
|
|
You can check status result also.
|
|
|
|
You can use multiple checks to test data integrity after full decompression:
|
|
1) Check Result and "status" variable.
|
|
2) Check that output(destLen) = uncompressedSize, if you know real uncompressedSize.
|
|
3) Check that output(srcLen) = compressedSize, if you know real compressedSize.
|
|
You must use correct finish mode in that case. */
|
|
|
|
typedef enum
|
|
{
|
|
LZMA_STATUS_NOT_SPECIFIED, /* use main error code instead */
|
|
LZMA_STATUS_FINISHED_WITH_MARK, /* stream was finished with end mark. */
|
|
LZMA_STATUS_NOT_FINISHED, /* stream was not finished */
|
|
LZMA_STATUS_NEEDS_MORE_INPUT, /* you must provide more input bytes */
|
|
LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK /* there is probability that stream was finished without end mark */
|
|
} ELzmaStatus;
|
|
|
|
/* ELzmaStatus is used only as output value for function call */
|
|
|
|
|
|
/* ---------- Interfaces ---------- */
|
|
|
|
/* There are 3 levels of interfaces:
|
|
1) Dictionary Interface
|
|
2) Buffer Interface
|
|
3) One Call Interface
|
|
You can select any of these interfaces, but don't mix functions from different
|
|
groups for same object. */
|
|
|
|
|
|
/* There are two variants to allocate state for Dictionary Interface:
|
|
1) LzmaDec_Allocate / LzmaDec_Free
|
|
2) LzmaDec_AllocateProbs / LzmaDec_FreeProbs
|
|
You can use variant 2, if you set dictionary buffer manually.
|
|
For Buffer Interface you must always use variant 1.
|
|
|
|
LzmaDec_Allocate* can return:
|
|
SZ_OK
|
|
SZ_ERROR_MEM - Memory allocation error
|
|
SZ_ERROR_UNSUPPORTED - Unsupported properties
|
|
*/
|
|
|
|
SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAllocPtr alloc);
|
|
void LzmaDec_FreeProbs(CLzmaDec *p, ISzAllocPtr alloc);
|
|
|
|
SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAllocPtr alloc);
|
|
void LzmaDec_Free(CLzmaDec *p, ISzAllocPtr alloc);
|
|
|
|
/* ---------- Dictionary Interface ---------- */
|
|
|
|
/* You can use it, if you want to eliminate the overhead for data copying from
|
|
dictionary to some other external buffer.
|
|
You must work with CLzmaDec variables directly in this interface.
|
|
|
|
STEPS:
|
|
LzmaDec_Construct()
|
|
LzmaDec_Allocate()
|
|
for (each new stream)
|
|
{
|
|
LzmaDec_Init()
|
|
while (it needs more decompression)
|
|
{
|
|
LzmaDec_DecodeToDic()
|
|
use data from CLzmaDec::dic and update CLzmaDec::dicPos
|
|
}
|
|
}
|
|
LzmaDec_Free()
|
|
*/
|
|
|
|
/* LzmaDec_DecodeToDic
|
|
|
|
The decoding to internal dictionary buffer (CLzmaDec::dic).
|
|
You must manually update CLzmaDec::dicPos, if it reaches CLzmaDec::dicBufSize !!!
|
|
|
|
finishMode:
|
|
It has meaning only if the decoding reaches output limit (dicLimit).
|
|
LZMA_FINISH_ANY - Decode just dicLimit bytes.
|
|
LZMA_FINISH_END - Stream must be finished after dicLimit.
|
|
|
|
Returns:
|
|
SZ_OK
|
|
status:
|
|
LZMA_STATUS_FINISHED_WITH_MARK
|
|
LZMA_STATUS_NOT_FINISHED
|
|
LZMA_STATUS_NEEDS_MORE_INPUT
|
|
LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK
|
|
SZ_ERROR_DATA - Data error
|
|
SZ_ERROR_FAIL - Some unexpected error: internal error of code, memory corruption or hardware failure
|
|
*/
|
|
|
|
SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit,
|
|
const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
|
|
|
|
|
|
/* ---------- Buffer Interface ---------- */
|
|
|
|
/* It's zlib-like interface.
|
|
See LzmaDec_DecodeToDic description for information about STEPS and return results,
|
|
but you must use LzmaDec_DecodeToBuf instead of LzmaDec_DecodeToDic and you don't need
|
|
to work with CLzmaDec variables manually.
|
|
|
|
finishMode:
|
|
It has meaning only if the decoding reaches output limit (*destLen).
|
|
LZMA_FINISH_ANY - Decode just destLen bytes.
|
|
LZMA_FINISH_END - Stream must be finished after (*destLen).
|
|
*/
|
|
|
|
SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen,
|
|
const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
|
|
|
|
|
|
/* ---------- One Call Interface ---------- */
|
|
|
|
/* LzmaDecode
|
|
|
|
finishMode:
|
|
It has meaning only if the decoding reaches output limit (*destLen).
|
|
LZMA_FINISH_ANY - Decode just destLen bytes.
|
|
LZMA_FINISH_END - Stream must be finished after (*destLen).
|
|
|
|
Returns:
|
|
SZ_OK
|
|
status:
|
|
LZMA_STATUS_FINISHED_WITH_MARK
|
|
LZMA_STATUS_NOT_FINISHED
|
|
LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK
|
|
SZ_ERROR_DATA - Data error
|
|
SZ_ERROR_MEM - Memory allocation error
|
|
SZ_ERROR_UNSUPPORTED - Unsupported properties
|
|
SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src).
|
|
SZ_ERROR_FAIL - Some unexpected error: internal error of code, memory corruption or hardware failure
|
|
*/
|
|
|
|
SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
|
|
const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode,
|
|
ELzmaStatus *status, ISzAllocPtr alloc);
|
|
|
|
EXTERN_C_END
|
|
|
|
#endif
|