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
182 lines
4.3 KiB
C
182 lines
4.3 KiB
C
/* Ppmd7.h -- Ppmd7 (PPMdH) compression codec
|
|
2023-04-02 : Igor Pavlov : Public domain
|
|
This code is based on:
|
|
PPMd var.H (2001): Dmitry Shkarin : Public domain */
|
|
|
|
|
|
#ifndef ZIP7_INC_PPMD7_H
|
|
#define ZIP7_INC_PPMD7_H
|
|
|
|
#include "Ppmd.h"
|
|
|
|
EXTERN_C_BEGIN
|
|
|
|
#define PPMD7_MIN_ORDER 2
|
|
#define PPMD7_MAX_ORDER 64
|
|
|
|
#define PPMD7_MIN_MEM_SIZE (1 << 11)
|
|
#define PPMD7_MAX_MEM_SIZE (0xFFFFFFFF - 12 * 3)
|
|
|
|
struct CPpmd7_Context_;
|
|
|
|
typedef Ppmd_Ref_Type(struct CPpmd7_Context_) CPpmd7_Context_Ref;
|
|
|
|
// MY_CPU_pragma_pack_push_1
|
|
|
|
typedef struct CPpmd7_Context_
|
|
{
|
|
UInt16 NumStats;
|
|
|
|
|
|
union
|
|
{
|
|
UInt16 SummFreq;
|
|
CPpmd_State2 State2;
|
|
} Union2;
|
|
|
|
union
|
|
{
|
|
CPpmd_State_Ref Stats;
|
|
CPpmd_State4 State4;
|
|
} Union4;
|
|
|
|
CPpmd7_Context_Ref Suffix;
|
|
} CPpmd7_Context;
|
|
|
|
// MY_CPU_pragma_pop
|
|
|
|
#define Ppmd7Context_OneState(p) ((CPpmd_State *)&(p)->Union2)
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
{
|
|
UInt32 Range;
|
|
UInt32 Code;
|
|
UInt32 Low;
|
|
IByteInPtr Stream;
|
|
} CPpmd7_RangeDec;
|
|
|
|
|
|
typedef struct
|
|
{
|
|
UInt32 Range;
|
|
Byte Cache;
|
|
// Byte _dummy_[3];
|
|
UInt64 Low;
|
|
UInt64 CacheSize;
|
|
IByteOutPtr Stream;
|
|
} CPpmd7z_RangeEnc;
|
|
|
|
|
|
typedef struct
|
|
{
|
|
CPpmd7_Context *MinContext, *MaxContext;
|
|
CPpmd_State *FoundState;
|
|
unsigned OrderFall, InitEsc, PrevSuccess, MaxOrder, HiBitsFlag;
|
|
Int32 RunLength, InitRL; /* must be 32-bit at least */
|
|
|
|
UInt32 Size;
|
|
UInt32 GlueCount;
|
|
UInt32 AlignOffset;
|
|
Byte *Base, *LoUnit, *HiUnit, *Text, *UnitsStart;
|
|
|
|
|
|
|
|
|
|
union
|
|
{
|
|
CPpmd7_RangeDec dec;
|
|
CPpmd7z_RangeEnc enc;
|
|
} rc;
|
|
|
|
Byte Indx2Units[PPMD_NUM_INDEXES + 2]; // +2 for alignment
|
|
Byte Units2Indx[128];
|
|
CPpmd_Void_Ref FreeList[PPMD_NUM_INDEXES];
|
|
|
|
Byte NS2BSIndx[256], NS2Indx[256];
|
|
Byte ExpEscape[16];
|
|
CPpmd_See DummySee, See[25][16];
|
|
UInt16 BinSumm[128][64];
|
|
// int LastSymbol;
|
|
} CPpmd7;
|
|
|
|
|
|
void Ppmd7_Construct(CPpmd7 *p);
|
|
BoolInt Ppmd7_Alloc(CPpmd7 *p, UInt32 size, ISzAllocPtr alloc);
|
|
void Ppmd7_Free(CPpmd7 *p, ISzAllocPtr alloc);
|
|
void Ppmd7_Init(CPpmd7 *p, unsigned maxOrder);
|
|
#define Ppmd7_WasAllocated(p) ((p)->Base != NULL)
|
|
|
|
|
|
/* ---------- Internal Functions ---------- */
|
|
|
|
#define Ppmd7_GetPtr(p, ptr) Ppmd_GetPtr(p, ptr)
|
|
#define Ppmd7_GetContext(p, ptr) Ppmd_GetPtr_Type(p, ptr, CPpmd7_Context)
|
|
#define Ppmd7_GetStats(p, ctx) Ppmd_GetPtr_Type(p, (ctx)->Union4.Stats, CPpmd_State)
|
|
|
|
void Ppmd7_Update1(CPpmd7 *p);
|
|
void Ppmd7_Update1_0(CPpmd7 *p);
|
|
void Ppmd7_Update2(CPpmd7 *p);
|
|
|
|
#define PPMD7_HiBitsFlag_3(sym) ((((unsigned)sym + 0xC0) >> (8 - 3)) & (1 << 3))
|
|
#define PPMD7_HiBitsFlag_4(sym) ((((unsigned)sym + 0xC0) >> (8 - 4)) & (1 << 4))
|
|
// #define PPMD7_HiBitsFlag_3(sym) ((sym) < 0x40 ? 0 : (1 << 3))
|
|
// #define PPMD7_HiBitsFlag_4(sym) ((sym) < 0x40 ? 0 : (1 << 4))
|
|
|
|
#define Ppmd7_GetBinSumm(p) \
|
|
&p->BinSumm[(size_t)(unsigned)Ppmd7Context_OneState(p->MinContext)->Freq - 1] \
|
|
[ p->PrevSuccess + ((p->RunLength >> 26) & 0x20) \
|
|
+ p->NS2BSIndx[(size_t)Ppmd7_GetContext(p, p->MinContext->Suffix)->NumStats - 1] \
|
|
+ PPMD7_HiBitsFlag_4(Ppmd7Context_OneState(p->MinContext)->Symbol) \
|
|
+ (p->HiBitsFlag = PPMD7_HiBitsFlag_3(p->FoundState->Symbol)) ]
|
|
|
|
CPpmd_See *Ppmd7_MakeEscFreq(CPpmd7 *p, unsigned numMasked, UInt32 *scale);
|
|
|
|
|
|
/*
|
|
We support two versions of Ppmd7 (PPMdH) methods that use same CPpmd7 structure:
|
|
1) Ppmd7a_*: original PPMdH
|
|
2) Ppmd7z_*: modified PPMdH with 7z Range Coder
|
|
Ppmd7_*: the structures and functions that are common for both versions of PPMd7 (PPMdH)
|
|
*/
|
|
|
|
/* ---------- Decode ---------- */
|
|
|
|
#define PPMD7_SYM_END (-1)
|
|
#define PPMD7_SYM_ERROR (-2)
|
|
|
|
/*
|
|
You must set (CPpmd7::rc.dec.Stream) before Ppmd7*_RangeDec_Init()
|
|
|
|
Ppmd7*_DecodeSymbol()
|
|
out:
|
|
>= 0 : decoded byte
|
|
-1 : PPMD7_SYM_END : End of payload marker
|
|
-2 : PPMD7_SYM_ERROR : Data error
|
|
*/
|
|
|
|
/* Ppmd7a_* : original PPMdH */
|
|
BoolInt Ppmd7a_RangeDec_Init(CPpmd7_RangeDec *p);
|
|
#define Ppmd7a_RangeDec_IsFinishedOK(p) ((p)->Code == 0)
|
|
int Ppmd7a_DecodeSymbol(CPpmd7 *p);
|
|
|
|
/* Ppmd7z_* : modified PPMdH with 7z Range Coder */
|
|
BoolInt Ppmd7z_RangeDec_Init(CPpmd7_RangeDec *p);
|
|
#define Ppmd7z_RangeDec_IsFinishedOK(p) ((p)->Code == 0)
|
|
int Ppmd7z_DecodeSymbol(CPpmd7 *p);
|
|
// Byte *Ppmd7z_DecodeSymbols(CPpmd7 *p, Byte *buf, const Byte *lim);
|
|
|
|
|
|
/* ---------- Encode ---------- */
|
|
|
|
void Ppmd7z_Init_RangeEnc(CPpmd7 *p);
|
|
void Ppmd7z_Flush_RangeEnc(CPpmd7 *p);
|
|
// void Ppmd7z_EncodeSymbol(CPpmd7 *p, int symbol);
|
|
void Ppmd7z_EncodeSymbols(CPpmd7 *p, const Byte *buf, const Byte *lim);
|
|
|
|
EXTERN_C_END
|
|
|
|
#endif
|