mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-04-02 10:42:14 -04:00
This is an experimental release, as such it is posted only to Google Code. Changelog: - 21fx API moved to pre-finalized form as S-MSU1; more about this on the forum - OpenGL driver now uses GL_CLAMP_TO_BORDER instead of GL_CLAMP_TO_EDGE to support screen curvature shader - rewrote file open dialog; code is greatly simplified, interface is improved - all cheat code columns are now enquoted, and empty codes at the bottom of the file are omitted (format is compatible with previous releases still) - debugger: added missing DMA variables to S-CPU properties viewer - snesfilter: added OpenMP (multi-threading) support to HQ2x filter - lots of other miscellaneous code cleanup work
57 lines
1.3 KiB
C++
57 lines
1.3 KiB
C++
#include "rar.hpp"
|
|
|
|
EncodeFileName::EncodeFileName()
|
|
{
|
|
Flags=0;
|
|
FlagBits=0;
|
|
FlagsPos=0;
|
|
DestSize=0;
|
|
}
|
|
|
|
|
|
|
|
|
|
void EncodeFileName::Decode(char *Name,byte *EncName,int EncSize,wchar *NameW,
|
|
int MaxDecSize)
|
|
{
|
|
int EncPos=0,DecPos=0;
|
|
byte HighByte=EncName[EncPos++];
|
|
while (EncPos<EncSize && DecPos<MaxDecSize)
|
|
{
|
|
if (FlagBits==0)
|
|
{
|
|
Flags=EncName[EncPos++];
|
|
FlagBits=8;
|
|
}
|
|
switch(Flags>>6)
|
|
{
|
|
case 0:
|
|
NameW[DecPos++]=EncName[EncPos++];
|
|
break;
|
|
case 1:
|
|
NameW[DecPos++]=EncName[EncPos++]+(HighByte<<8);
|
|
break;
|
|
case 2:
|
|
NameW[DecPos++]=EncName[EncPos]+(EncName[EncPos+1]<<8);
|
|
EncPos+=2;
|
|
break;
|
|
case 3:
|
|
{
|
|
int Length=EncName[EncPos++];
|
|
if (Length & 0x80)
|
|
{
|
|
byte Correction=EncName[EncPos++];
|
|
for (Length=(Length&0x7f)+2;Length>0 && DecPos<MaxDecSize;Length--,DecPos++)
|
|
NameW[DecPos]=((Name[DecPos]+Correction)&0xff)+(HighByte<<8);
|
|
}
|
|
else
|
|
for (Length+=2;Length>0 && DecPos<MaxDecSize;Length--,DecPos++)
|
|
NameW[DecPos]=Name[DecPos];
|
|
}
|
|
break;
|
|
}
|
|
Flags<<=2;
|
|
FlagBits-=2;
|
|
}
|
|
NameW[DecPos<MaxDecSize ? DecPos:MaxDecSize-1]=0;
|
|
}
|