WIP - Cleanup after merge #1
This commit is contained in:
parent
a2850730e0
commit
05387498c0
25 changed files with 325 additions and 359 deletions
|
@ -104,25 +104,16 @@
|
||||||
<Image Include="..\data\file.ico">
|
<Image Include="..\data\file.ico">
|
||||||
<DeploymentContent>true</DeploymentContent>
|
<DeploymentContent>true</DeploymentContent>
|
||||||
</Image>
|
</Image>
|
||||||
<Image Include="..\data\joystick.bmp">
|
|
||||||
<DeploymentContent>true</DeploymentContent>
|
|
||||||
</Image>
|
|
||||||
<Image Include="..\data\joystick.ico">
|
<Image Include="..\data\joystick.ico">
|
||||||
<DeploymentContent>true</DeploymentContent>
|
<DeploymentContent>true</DeploymentContent>
|
||||||
</Image>
|
</Image>
|
||||||
<Image Include="..\data\misc.ico">
|
<Image Include="..\data\misc.ico">
|
||||||
<DeploymentContent>true</DeploymentContent>
|
<DeploymentContent>true</DeploymentContent>
|
||||||
</Image>
|
</Image>
|
||||||
<Image Include="..\data\mouse.bmp">
|
|
||||||
<DeploymentContent>true</DeploymentContent>
|
|
||||||
</Image>
|
|
||||||
<Image Include="..\data\paths.ico">
|
<Image Include="..\data\paths.ico">
|
||||||
<DeploymentContent>true</DeploymentContent>
|
<DeploymentContent>true</DeploymentContent>
|
||||||
</Image>
|
</Image>
|
||||||
<Image Include="..\data\quickstart.ico" />
|
<Image Include="..\data\quickstart.ico" />
|
||||||
<Image Include="..\data\remapping.bmp">
|
|
||||||
<DeploymentContent>true</DeploymentContent>
|
|
||||||
</Image>
|
|
||||||
<Image Include="..\data\savestate.png">
|
<Image Include="..\data\savestate.png">
|
||||||
<DeploymentContent>true</DeploymentContent>
|
<DeploymentContent>true</DeploymentContent>
|
||||||
</Image>
|
</Image>
|
||||||
|
@ -134,9 +125,6 @@
|
||||||
</Image>
|
</Image>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Font Include="..\data\FreeSans.ttf">
|
|
||||||
<DeploymentContent>true</DeploymentContent>
|
|
||||||
</Font>
|
|
||||||
<Font Include="..\data\Topaznew.ttf">
|
<Font Include="..\data\Topaznew.ttf">
|
||||||
<DeploymentContent>true</DeploymentContent>
|
<DeploymentContent>true</DeploymentContent>
|
||||||
</Font>
|
</Font>
|
||||||
|
@ -527,6 +515,7 @@
|
||||||
<ClInclude Include="..\src\archivers\wrp\warp.h" />
|
<ClInclude Include="..\src\archivers\wrp\warp.h" />
|
||||||
<ClInclude Include="..\src\archivers\zip\unzip.h" />
|
<ClInclude Include="..\src\archivers\zip\unzip.h" />
|
||||||
<ClInclude Include="..\src\include\akiko.h" />
|
<ClInclude Include="..\src\include\akiko.h" />
|
||||||
|
<ClInclude Include="..\src\include\ar.h" />
|
||||||
<ClInclude Include="..\src\include\audio.h" />
|
<ClInclude Include="..\src\include\audio.h" />
|
||||||
<ClInclude Include="..\src\include\autoconf.h" />
|
<ClInclude Include="..\src\include\autoconf.h" />
|
||||||
<ClInclude Include="..\src\include\blit.h" />
|
<ClInclude Include="..\src\include\blit.h" />
|
||||||
|
|
|
@ -110,24 +110,15 @@
|
||||||
<Image Include="..\data\file.ico">
|
<Image Include="..\data\file.ico">
|
||||||
<Filter>data</Filter>
|
<Filter>data</Filter>
|
||||||
</Image>
|
</Image>
|
||||||
<Image Include="..\data\joystick.bmp">
|
|
||||||
<Filter>data</Filter>
|
|
||||||
</Image>
|
|
||||||
<Image Include="..\data\joystick.ico">
|
<Image Include="..\data\joystick.ico">
|
||||||
<Filter>data</Filter>
|
<Filter>data</Filter>
|
||||||
</Image>
|
</Image>
|
||||||
<Image Include="..\data\misc.ico">
|
<Image Include="..\data\misc.ico">
|
||||||
<Filter>data</Filter>
|
<Filter>data</Filter>
|
||||||
</Image>
|
</Image>
|
||||||
<Image Include="..\data\mouse.bmp">
|
|
||||||
<Filter>data</Filter>
|
|
||||||
</Image>
|
|
||||||
<Image Include="..\data\paths.ico">
|
<Image Include="..\data\paths.ico">
|
||||||
<Filter>data</Filter>
|
<Filter>data</Filter>
|
||||||
</Image>
|
</Image>
|
||||||
<Image Include="..\data\remapping.bmp">
|
|
||||||
<Filter>data</Filter>
|
|
||||||
</Image>
|
|
||||||
<Image Include="..\data\savestate.png">
|
<Image Include="..\data\savestate.png">
|
||||||
<Filter>data</Filter>
|
<Filter>data</Filter>
|
||||||
</Image>
|
</Image>
|
||||||
|
@ -148,9 +139,6 @@
|
||||||
</Image>
|
</Image>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Font Include="..\data\FreeSans.ttf">
|
|
||||||
<Filter>data</Filter>
|
|
||||||
</Font>
|
|
||||||
<Font Include="..\data\Topaznew.ttf">
|
<Font Include="..\data\Topaznew.ttf">
|
||||||
<Filter>data</Filter>
|
<Filter>data</Filter>
|
||||||
</Font>
|
</Font>
|
||||||
|
@ -1241,6 +1229,9 @@
|
||||||
<ClInclude Include="..\src\archivers\mp2\kjmp2.h">
|
<ClInclude Include="..\src\archivers\mp2\kjmp2.h">
|
||||||
<Filter>src\archivers\mp2</Filter>
|
<Filter>src\archivers\mp2</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\src\include\ar.h">
|
||||||
|
<Filter>src\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="..\src\archivers\7z\7zVersion.rc">
|
<ResourceCompile Include="..\src\archivers\7z\7zVersion.rc">
|
||||||
|
|
|
@ -344,25 +344,16 @@
|
||||||
<Image Include="..\..\data\file.ico">
|
<Image Include="..\..\data\file.ico">
|
||||||
<DeploymentContent>true</DeploymentContent>
|
<DeploymentContent>true</DeploymentContent>
|
||||||
</Image>
|
</Image>
|
||||||
<Image Include="..\..\data\joystick.bmp">
|
|
||||||
<DeploymentContent>true</DeploymentContent>
|
|
||||||
</Image>
|
|
||||||
<Image Include="..\..\data\joystick.ico">
|
<Image Include="..\..\data\joystick.ico">
|
||||||
<DeploymentContent>true</DeploymentContent>
|
<DeploymentContent>true</DeploymentContent>
|
||||||
</Image>
|
</Image>
|
||||||
<Image Include="..\..\data\misc.ico">
|
<Image Include="..\..\data\misc.ico">
|
||||||
<DeploymentContent>true</DeploymentContent>
|
<DeploymentContent>true</DeploymentContent>
|
||||||
</Image>
|
</Image>
|
||||||
<Image Include="..\..\data\mouse.bmp">
|
|
||||||
<DeploymentContent>true</DeploymentContent>
|
|
||||||
</Image>
|
|
||||||
<Image Include="..\..\data\paths.ico">
|
<Image Include="..\..\data\paths.ico">
|
||||||
<DeploymentContent>true</DeploymentContent>
|
<DeploymentContent>true</DeploymentContent>
|
||||||
</Image>
|
</Image>
|
||||||
<Image Include="..\..\data\quickstart.ico" />
|
<Image Include="..\..\data\quickstart.ico" />
|
||||||
<Image Include="..\..\data\remapping.bmp">
|
|
||||||
<DeploymentContent>true</DeploymentContent>
|
|
||||||
</Image>
|
|
||||||
<Image Include="..\..\data\savestate.png">
|
<Image Include="..\..\data\savestate.png">
|
||||||
<DeploymentContent>true</DeploymentContent>
|
<DeploymentContent>true</DeploymentContent>
|
||||||
</Image>
|
</Image>
|
||||||
|
@ -374,9 +365,6 @@
|
||||||
</Image>
|
</Image>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Font Include="..\..\data\FreeSans.ttf">
|
|
||||||
<DeploymentContent>true</DeploymentContent>
|
|
||||||
</Font>
|
|
||||||
<Font Include="..\..\data\Topaznew.ttf">
|
<Font Include="..\..\data\Topaznew.ttf">
|
||||||
<DeploymentContent>true</DeploymentContent>
|
<DeploymentContent>true</DeploymentContent>
|
||||||
</Font>
|
</Font>
|
||||||
|
@ -499,6 +487,7 @@
|
||||||
<ClInclude Include="..\..\src\guisan\include\guisan\widgets\window.hpp" />
|
<ClInclude Include="..\..\src\guisan\include\guisan\widgets\window.hpp" />
|
||||||
<ClInclude Include="..\..\src\guisan\include\guisan\x.hpp" />
|
<ClInclude Include="..\..\src\guisan\include\guisan\x.hpp" />
|
||||||
<ClInclude Include="..\..\src\include\akiko.h" />
|
<ClInclude Include="..\..\src\include\akiko.h" />
|
||||||
|
<ClInclude Include="..\..\src\include\ar.h" />
|
||||||
<ClInclude Include="..\..\src\include\audio.h" />
|
<ClInclude Include="..\..\src\include\audio.h" />
|
||||||
<ClInclude Include="..\..\src\include\autoconf.h" />
|
<ClInclude Include="..\..\src\include\autoconf.h" />
|
||||||
<ClInclude Include="..\..\src\include\blit.h" />
|
<ClInclude Include="..\..\src\include\blit.h" />
|
||||||
|
|
|
@ -731,24 +731,15 @@
|
||||||
<Image Include="..\..\data\file.ico">
|
<Image Include="..\..\data\file.ico">
|
||||||
<Filter>Resource files\data</Filter>
|
<Filter>Resource files\data</Filter>
|
||||||
</Image>
|
</Image>
|
||||||
<Image Include="..\..\data\joystick.bmp">
|
|
||||||
<Filter>Resource files\data</Filter>
|
|
||||||
</Image>
|
|
||||||
<Image Include="..\..\data\joystick.ico">
|
<Image Include="..\..\data\joystick.ico">
|
||||||
<Filter>Resource files\data</Filter>
|
<Filter>Resource files\data</Filter>
|
||||||
</Image>
|
</Image>
|
||||||
<Image Include="..\..\data\misc.ico">
|
<Image Include="..\..\data\misc.ico">
|
||||||
<Filter>Resource files\data</Filter>
|
<Filter>Resource files\data</Filter>
|
||||||
</Image>
|
</Image>
|
||||||
<Image Include="..\..\data\mouse.bmp">
|
|
||||||
<Filter>Resource files\data</Filter>
|
|
||||||
</Image>
|
|
||||||
<Image Include="..\..\data\paths.ico">
|
<Image Include="..\..\data\paths.ico">
|
||||||
<Filter>Resource files\data</Filter>
|
<Filter>Resource files\data</Filter>
|
||||||
</Image>
|
</Image>
|
||||||
<Image Include="..\..\data\remapping.bmp">
|
|
||||||
<Filter>Resource files\data</Filter>
|
|
||||||
</Image>
|
|
||||||
<Image Include="..\..\data\savestate.png">
|
<Image Include="..\..\data\savestate.png">
|
||||||
<Filter>Resource files\data</Filter>
|
<Filter>Resource files\data</Filter>
|
||||||
</Image>
|
</Image>
|
||||||
|
@ -769,9 +760,6 @@
|
||||||
</Image>
|
</Image>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Font Include="..\..\data\FreeSans.ttf">
|
|
||||||
<Filter>Resource files\data</Filter>
|
|
||||||
</Font>
|
|
||||||
<Font Include="..\..\data\Topaznew.ttf">
|
<Font Include="..\..\data\Topaznew.ttf">
|
||||||
<Filter>Resource files\data</Filter>
|
<Filter>Resource files\data</Filter>
|
||||||
</Font>
|
</Font>
|
||||||
|
@ -1440,6 +1428,9 @@
|
||||||
<ClInclude Include="..\..\src\archivers\mp2\kjmp2.h">
|
<ClInclude Include="..\..\src\archivers\mp2\kjmp2.h">
|
||||||
<Filter>Header files\archivers\mp2</Filter>
|
<Filter>Header files\archivers\mp2</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\include\ar.h">
|
||||||
|
<Filter>Header files\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="..\..\src\archivers\7z\7zVersion.rc">
|
<ResourceCompile Include="..\..\src\archivers\7z\7zVersion.rc">
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 75 KiB |
BIN
data/mouse.bmp
BIN
data/mouse.bmp
Binary file not shown.
Before Width: | Height: | Size: 75 KiB |
Binary file not shown.
Before Width: | Height: | Size: 75 KiB |
|
@ -142,7 +142,7 @@ static SRes SzDecodeLzma(CSzCoderInfo *coder, UInt64 inSize, ILookInStream *inSt
|
||||||
size_t lookahead = (1 << 18);
|
size_t lookahead = (1 << 18);
|
||||||
if (lookahead > inSize)
|
if (lookahead > inSize)
|
||||||
lookahead = (size_t)inSize;
|
lookahead = (size_t)inSize;
|
||||||
res = inStream->Look((void *)inStream, (const void **)&inBuf, &lookahead);
|
res = inStream->Look((void *)inStream, (void **)&inBuf, &lookahead);
|
||||||
if (res != SZ_OK)
|
if (res != SZ_OK)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ static SRes SzDecodeLzma2(CSzCoderInfo *coder, UInt64 inSize, ILookInStream *inS
|
||||||
size_t lookahead = (1 << 18);
|
size_t lookahead = (1 << 18);
|
||||||
if (lookahead > inSize)
|
if (lookahead > inSize)
|
||||||
lookahead = (size_t)inSize;
|
lookahead = (size_t)inSize;
|
||||||
res = inStream->Look((void *)inStream, (const void **)&inBuf, &lookahead);
|
res = inStream->Look((void *)inStream, (void **)&inBuf, &lookahead);
|
||||||
if (res != SZ_OK)
|
if (res != SZ_OK)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ static SRes SzDecodeCopy(UInt64 inSize, ILookInStream *inStream, Byte *outBuffer
|
||||||
size_t curSize = (1 << 18);
|
size_t curSize = (1 << 18);
|
||||||
if (curSize > inSize)
|
if (curSize > inSize)
|
||||||
curSize = (size_t)inSize;
|
curSize = (size_t)inSize;
|
||||||
RINOK(inStream->Look((void *)inStream, (const void **)&inBuf, &curSize));
|
RINOK(inStream->Look((void *)inStream, (void **)&inBuf, &curSize));
|
||||||
if (curSize == 0)
|
if (curSize == 0)
|
||||||
return SZ_ERROR_INPUT_EOF;
|
return SZ_ERROR_INPUT_EOF;
|
||||||
memcpy(outBuffer, inBuf, curSize);
|
memcpy(outBuffer, inBuf, curSize);
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "../../Bcj2.h"
|
#include "Bcj2.h"
|
||||||
#include "../../Bra.h"
|
#include "Bra.h"
|
||||||
#include "../../LzmaDec.h"
|
#include "LzmaDec.h"
|
||||||
#include "7zDecode.h"
|
#include "7zDecode.h"
|
||||||
|
|
||||||
#define k_Copy 0
|
#define k_Copy 0
|
||||||
|
@ -20,235 +20,235 @@ static SRes SzDecodeLzma(CSzCoderInfo *coder, UInt64 inSize, ILookInStream *inSt
|
||||||
SRes res = SZ_OK;
|
SRes res = SZ_OK;
|
||||||
|
|
||||||
LzmaDec_Construct(&state);
|
LzmaDec_Construct(&state);
|
||||||
RINOK(LzmaDec_AllocateProbs(&state, coder->Props.data, (unsigned)coder->Props.size, allocMain));
|
RINOK(LzmaDec_AllocateProbs(&state, coder->Props.data, unsigned(coder->Props.size), allocMain));
|
||||||
state.dic = outBuffer;
|
state.dic = outBuffer;
|
||||||
state.dicBufSize = outSize;
|
state.dicBufSize = outSize;
|
||||||
LzmaDec_Init(&state);
|
LzmaDec_Init(&state);
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
Byte *inBuf = NULL;
|
Byte *inBuf = nullptr;
|
||||||
size_t lookahead = (1 << 18);
|
size_t lookahead = (1 << 18);
|
||||||
if (lookahead > inSize)
|
if (lookahead > inSize)
|
||||||
lookahead = (size_t)inSize;
|
lookahead = size_t(inSize);
|
||||||
res = inStream->Look((void *)inStream, (void **)&inBuf, &lookahead);
|
res = inStream->Look((void *)inStream, (void **)&inBuf, &lookahead);
|
||||||
if (res != SZ_OK)
|
if (res != SZ_OK)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
{
|
{
|
||||||
SizeT inProcessed = (SizeT)lookahead, dicPos = state.dicPos;
|
SizeT inProcessed = SizeT(lookahead), dicPos = state.dicPos;
|
||||||
ELzmaStatus status;
|
ELzmaStatus status;
|
||||||
res = LzmaDec_DecodeToDic(&state, outSize, inBuf, &inProcessed, LZMA_FINISH_END, &status);
|
res = LzmaDec_DecodeToDic(&state, outSize, inBuf, &inProcessed, LZMA_FINISH_END, &status);
|
||||||
lookahead -= inProcessed;
|
lookahead -= inProcessed;
|
||||||
inSize -= inProcessed;
|
inSize -= inProcessed;
|
||||||
if (res != SZ_OK)
|
if (res != SZ_OK)
|
||||||
break;
|
break;
|
||||||
if (state.dicPos == state.dicBufSize || (inProcessed == 0 && dicPos == state.dicPos))
|
if (state.dicPos == state.dicBufSize || (inProcessed == 0 && dicPos == state.dicPos))
|
||||||
{
|
{
|
||||||
if (state.dicBufSize != outSize || lookahead != 0 ||
|
if (state.dicBufSize != outSize || lookahead != 0 ||
|
||||||
(status != LZMA_STATUS_FINISHED_WITH_MARK &&
|
(status != LZMA_STATUS_FINISHED_WITH_MARK &&
|
||||||
status != LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK))
|
status != LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK))
|
||||||
res = SZ_ERROR_DATA;
|
res = SZ_ERROR_DATA;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
res = inStream->Skip((void *)inStream, inProcessed);
|
res = inStream->Skip((void *)inStream, inProcessed);
|
||||||
if (res != SZ_OK)
|
if (res != SZ_OK)
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
LzmaDec_FreeProbs(&state, allocMain);
|
LzmaDec_FreeProbs(&state, allocMain);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SRes SzDecodeCopy(UInt64 inSize, ILookInStream *inStream, Byte *outBuffer)
|
static SRes SzDecodeCopy(UInt64 inSize, ILookInStream *inStream, Byte *outBuffer)
|
||||||
{
|
{
|
||||||
while (inSize > 0)
|
while (inSize > 0)
|
||||||
{
|
{
|
||||||
void *inBuf;
|
void *inBuf;
|
||||||
size_t curSize = (1 << 18);
|
size_t curSize = (1 << 18);
|
||||||
if (curSize > inSize)
|
if (curSize > inSize)
|
||||||
curSize = (size_t)inSize;
|
curSize = size_t(inSize);
|
||||||
RINOK(inStream->Look((void *)inStream, (void **)&inBuf, &curSize));
|
RINOK(inStream->Look((void *)inStream, (void **)&inBuf, &curSize));
|
||||||
if (curSize == 0)
|
if (curSize == 0)
|
||||||
return SZ_ERROR_INPUT_EOF;
|
return SZ_ERROR_INPUT_EOF;
|
||||||
memcpy(outBuffer, inBuf, curSize);
|
memcpy(outBuffer, inBuf, curSize);
|
||||||
outBuffer += curSize;
|
outBuffer += curSize;
|
||||||
inSize -= curSize;
|
inSize -= curSize;
|
||||||
RINOK(inStream->Skip((void *)inStream, curSize));
|
RINOK(inStream->Skip((void *)inStream, curSize));
|
||||||
}
|
}
|
||||||
return SZ_OK;
|
return SZ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define IS_UNSUPPORTED_METHOD(m) ((m) != k_Copy && (m) != k_LZMA)
|
#define IS_UNSUPPORTED_METHOD(m) ((m) != k_Copy && (m) != k_LZMA)
|
||||||
#define IS_UNSUPPORTED_CODER(c) (IS_UNSUPPORTED_METHOD(c.MethodID) || c.NumInStreams != 1 || c.NumOutStreams != 1)
|
#define IS_UNSUPPORTED_CODER(c) (IS_UNSUPPORTED_METHOD(c.MethodID) || c.NumInStreams != 1 || c.NumOutStreams != 1)
|
||||||
#define IS_NO_BCJ(c) (c.MethodID != k_BCJ || c.NumInStreams != 1 || c.NumOutStreams != 1)
|
#define IS_NO_BCJ(c) (c.MethodID != k_BCJ || c.NumInStreams != 1 || c.NumOutStreams != 1)
|
||||||
#define IS_NO_BCJ2(c) (c.MethodID != k_BCJ2 || c.NumInStreams != 4 || c.NumOutStreams != 1)
|
#define IS_NO_BCJ2(c) (c.MethodID != k_BCJ2 || c.NumInStreams != 4 || c.NumOutStreams != 1)
|
||||||
|
|
||||||
SRes CheckSupportedFolder(const CSzFolder *f)
|
SRes CheckSupportedFolder(const CSzFolder *f)
|
||||||
{
|
|
||||||
if (f->NumCoders < 1 || f->NumCoders > 4)
|
|
||||||
return SZ_ERROR_UNSUPPORTED;
|
|
||||||
if (IS_UNSUPPORTED_CODER(f->Coders[0]))
|
|
||||||
return SZ_ERROR_UNSUPPORTED;
|
|
||||||
if (f->NumCoders == 1)
|
|
||||||
{
|
|
||||||
if (f->NumPackStreams != 1 || f->PackStreams[0] != 0 || f->NumBindPairs != 0)
|
|
||||||
return SZ_ERROR_UNSUPPORTED;
|
|
||||||
return SZ_OK;
|
|
||||||
}
|
|
||||||
if (f->NumCoders == 2)
|
|
||||||
{
|
|
||||||
if (IS_NO_BCJ(f->Coders[1]) ||
|
|
||||||
f->NumPackStreams != 1 || f->PackStreams[0] != 0 ||
|
|
||||||
f->NumBindPairs != 1 ||
|
|
||||||
f->BindPairs[0].InIndex != 1 || f->BindPairs[0].OutIndex != 0)
|
|
||||||
return SZ_ERROR_UNSUPPORTED;
|
|
||||||
return SZ_OK;
|
|
||||||
}
|
|
||||||
if (f->NumCoders == 4)
|
|
||||||
{
|
|
||||||
if (IS_UNSUPPORTED_CODER(f->Coders[1]) ||
|
|
||||||
IS_UNSUPPORTED_CODER(f->Coders[2]) ||
|
|
||||||
IS_NO_BCJ2(f->Coders[3]))
|
|
||||||
return SZ_ERROR_UNSUPPORTED;
|
|
||||||
if (f->NumPackStreams != 4 ||
|
|
||||||
f->PackStreams[0] != 2 ||
|
|
||||||
f->PackStreams[1] != 6 ||
|
|
||||||
f->PackStreams[2] != 1 ||
|
|
||||||
f->PackStreams[3] != 0 ||
|
|
||||||
f->NumBindPairs != 3 ||
|
|
||||||
f->BindPairs[0].InIndex != 5 || f->BindPairs[0].OutIndex != 0 ||
|
|
||||||
f->BindPairs[1].InIndex != 4 || f->BindPairs[1].OutIndex != 1 ||
|
|
||||||
f->BindPairs[2].InIndex != 3 || f->BindPairs[2].OutIndex != 2)
|
|
||||||
return SZ_ERROR_UNSUPPORTED;
|
|
||||||
return SZ_OK;
|
|
||||||
}
|
|
||||||
return SZ_ERROR_UNSUPPORTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
UInt64 GetSum(const UInt64 *values, UInt32 index)
|
|
||||||
{
|
|
||||||
UInt64 sum = 0;
|
|
||||||
UInt32 i;
|
|
||||||
for (i = 0; i < index; i++)
|
|
||||||
sum += values[i];
|
|
||||||
return sum;
|
|
||||||
}
|
|
||||||
|
|
||||||
SRes SzDecode2(const UInt64 *packSizes, const CSzFolder *folder,
|
|
||||||
ILookInStream *inStream, UInt64 startPos,
|
|
||||||
Byte *outBuffer, SizeT outSize, ISzAlloc *allocMain,
|
|
||||||
Byte *tempBuf[])
|
|
||||||
{
|
|
||||||
UInt32 ci;
|
|
||||||
SizeT tempSizes[3] = { 0, 0, 0};
|
|
||||||
SizeT tempSize3 = 0;
|
|
||||||
Byte *tempBuf3 = 0;
|
|
||||||
|
|
||||||
RINOK(CheckSupportedFolder(folder));
|
|
||||||
|
|
||||||
for (ci = 0; ci < folder->NumCoders; ci++)
|
|
||||||
{
|
|
||||||
CSzCoderInfo *coder = &folder->Coders[ci];
|
|
||||||
|
|
||||||
if (coder->MethodID == k_Copy || coder->MethodID == k_LZMA)
|
|
||||||
{
|
{
|
||||||
UInt32 si = 0;
|
if (f->NumCoders < 1 || f->NumCoders > 4)
|
||||||
UInt64 offset;
|
return SZ_ERROR_UNSUPPORTED;
|
||||||
UInt64 inSize;
|
if (IS_UNSUPPORTED_CODER(f->Coders[0]))
|
||||||
Byte *outBufCur = outBuffer;
|
return SZ_ERROR_UNSUPPORTED;
|
||||||
SizeT outSizeCur = outSize;
|
if (f->NumCoders == 1)
|
||||||
if (folder->NumCoders == 4)
|
{
|
||||||
{
|
if (f->NumPackStreams != 1 || f->PackStreams[0] != 0 || f->NumBindPairs != 0)
|
||||||
UInt32 indices[] = { 3, 2, 0 };
|
return SZ_ERROR_UNSUPPORTED;
|
||||||
UInt64 unpackSize = folder->UnpackSizes[ci];
|
return SZ_OK;
|
||||||
si = indices[ci];
|
}
|
||||||
if (ci < 2)
|
if (f->NumCoders == 2)
|
||||||
{
|
{
|
||||||
Byte *temp;
|
if (IS_NO_BCJ(f->Coders[1]) ||
|
||||||
outSizeCur = (SizeT)unpackSize;
|
f->NumPackStreams != 1 || f->PackStreams[0] != 0 ||
|
||||||
if (outSizeCur != unpackSize)
|
f->NumBindPairs != 1 ||
|
||||||
return SZ_ERROR_MEM;
|
f->BindPairs[0].InIndex != 1 || f->BindPairs[0].OutIndex != 0)
|
||||||
temp = (Byte *)IAlloc_Alloc(allocMain, outSizeCur);
|
return SZ_ERROR_UNSUPPORTED;
|
||||||
if (temp == 0 && outSizeCur != 0)
|
return SZ_OK;
|
||||||
return SZ_ERROR_MEM;
|
}
|
||||||
outBufCur = tempBuf[1 - ci] = temp;
|
if (f->NumCoders == 4)
|
||||||
tempSizes[1 - ci] = outSizeCur;
|
{
|
||||||
}
|
if (IS_UNSUPPORTED_CODER(f->Coders[1]) ||
|
||||||
else if (ci == 2)
|
IS_UNSUPPORTED_CODER(f->Coders[2]) ||
|
||||||
{
|
IS_NO_BCJ2(f->Coders[3]))
|
||||||
if (unpackSize > outSize) /* check it */
|
return SZ_ERROR_UNSUPPORTED;
|
||||||
return SZ_ERROR_PARAM;
|
if (f->NumPackStreams != 4 ||
|
||||||
tempBuf3 = outBufCur = outBuffer + (outSize - (size_t)unpackSize);
|
f->PackStreams[0] != 2 ||
|
||||||
tempSize3 = outSizeCur = (SizeT)unpackSize;
|
f->PackStreams[1] != 6 ||
|
||||||
}
|
f->PackStreams[2] != 1 ||
|
||||||
else
|
f->PackStreams[3] != 0 ||
|
||||||
return SZ_ERROR_UNSUPPORTED;
|
f->NumBindPairs != 3 ||
|
||||||
}
|
f->BindPairs[0].InIndex != 5 || f->BindPairs[0].OutIndex != 0 ||
|
||||||
offset = GetSum(packSizes, si);
|
f->BindPairs[1].InIndex != 4 || f->BindPairs[1].OutIndex != 1 ||
|
||||||
inSize = packSizes[si];
|
f->BindPairs[2].InIndex != 3 || f->BindPairs[2].OutIndex != 2)
|
||||||
RINOK(LookInStream_SeekTo(inStream, startPos + offset));
|
return SZ_ERROR_UNSUPPORTED;
|
||||||
|
return SZ_OK;
|
||||||
if (coder->MethodID == k_Copy)
|
}
|
||||||
{
|
return SZ_ERROR_UNSUPPORTED;
|
||||||
if (inSize != outSizeCur) /* check it */
|
|
||||||
return SZ_ERROR_DATA;
|
|
||||||
RINOK(SzDecodeCopy(inSize, inStream, outBufCur));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
RINOK(SzDecodeLzma(coder, inSize, inStream, outBufCur, outSizeCur, allocMain));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (coder->MethodID == k_BCJ)
|
|
||||||
|
UInt64 GetSum(const UInt64 *values, UInt32 index)
|
||||||
{
|
{
|
||||||
UInt32 state;
|
UInt64 sum = 0;
|
||||||
if (ci != 1)
|
UInt32 i;
|
||||||
return SZ_ERROR_UNSUPPORTED;
|
for (i = 0; i < index; i++)
|
||||||
x86_Convert_Init(state);
|
sum += values[i];
|
||||||
x86_Convert(outBuffer, outSize, 0, &state, 0);
|
return sum;
|
||||||
}
|
}
|
||||||
else if (coder->MethodID == k_BCJ2)
|
|
||||||
|
SRes SzDecode2(const UInt64 *packSizes, const CSzFolder *folder,
|
||||||
|
ILookInStream *inStream, UInt64 startPos,
|
||||||
|
Byte *outBuffer, SizeT outSize, ISzAlloc *allocMain,
|
||||||
|
Byte *tempBuf[])
|
||||||
{
|
{
|
||||||
UInt64 offset = GetSum(packSizes, 1);
|
UInt32 ci;
|
||||||
UInt64 s3Size = packSizes[1];
|
SizeT tempSizes[3] = { 0, 0, 0};
|
||||||
SRes res;
|
SizeT tempSize3 = 0;
|
||||||
if (ci != 3)
|
Byte *tempBuf3 = 0;
|
||||||
return SZ_ERROR_UNSUPPORTED;
|
|
||||||
RINOK(LookInStream_SeekTo(inStream, startPos + offset));
|
|
||||||
tempSizes[2] = (SizeT)s3Size;
|
|
||||||
if (tempSizes[2] != s3Size)
|
|
||||||
return SZ_ERROR_MEM;
|
|
||||||
tempBuf[2] = (Byte *)IAlloc_Alloc(allocMain, tempSizes[2]);
|
|
||||||
if (tempBuf[2] == 0 && tempSizes[2] != 0)
|
|
||||||
return SZ_ERROR_MEM;
|
|
||||||
res = SzDecodeCopy(s3Size, inStream, tempBuf[2]);
|
|
||||||
RINOK(res)
|
|
||||||
|
|
||||||
res = Bcj2_Decode(
|
RINOK(CheckSupportedFolder(folder));
|
||||||
tempBuf3, tempSize3,
|
|
||||||
tempBuf[0], tempSizes[0],
|
for (ci = 0; ci < folder->NumCoders; ci++)
|
||||||
tempBuf[1], tempSizes[1],
|
{
|
||||||
tempBuf[2], tempSizes[2],
|
CSzCoderInfo *coder = &folder->Coders[ci];
|
||||||
outBuffer, outSize);
|
|
||||||
RINOK(res)
|
if (coder->MethodID == k_Copy || coder->MethodID == k_LZMA)
|
||||||
|
{
|
||||||
|
UInt32 si = 0;
|
||||||
|
UInt64 offset;
|
||||||
|
UInt64 inSize;
|
||||||
|
Byte *outBufCur = outBuffer;
|
||||||
|
SizeT outSizeCur = outSize;
|
||||||
|
if (folder->NumCoders == 4)
|
||||||
|
{
|
||||||
|
UInt32 indices[] = { 3, 2, 0 };
|
||||||
|
UInt64 unpackSize = folder->UnpackSizes[ci];
|
||||||
|
si = indices[ci];
|
||||||
|
if (ci < 2)
|
||||||
|
{
|
||||||
|
Byte *temp;
|
||||||
|
outSizeCur = (SizeT)unpackSize;
|
||||||
|
if (outSizeCur != unpackSize)
|
||||||
|
return SZ_ERROR_MEM;
|
||||||
|
temp = (Byte *)IAlloc_Alloc(allocMain, outSizeCur);
|
||||||
|
if (temp == 0 && outSizeCur != 0)
|
||||||
|
return SZ_ERROR_MEM;
|
||||||
|
outBufCur = tempBuf[1 - ci] = temp;
|
||||||
|
tempSizes[1 - ci] = outSizeCur;
|
||||||
|
}
|
||||||
|
else if (ci == 2)
|
||||||
|
{
|
||||||
|
if (unpackSize > outSize) /* check it */
|
||||||
|
return SZ_ERROR_PARAM;
|
||||||
|
tempBuf3 = outBufCur = outBuffer + (outSize - (size_t)unpackSize);
|
||||||
|
tempSize3 = outSizeCur = (SizeT)unpackSize;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return SZ_ERROR_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
offset = GetSum(packSizes, si);
|
||||||
|
inSize = packSizes[si];
|
||||||
|
RINOK(LookInStream_SeekTo(inStream, startPos + offset));
|
||||||
|
|
||||||
|
if (coder->MethodID == k_Copy)
|
||||||
|
{
|
||||||
|
if (inSize != outSizeCur) /* check it */
|
||||||
|
return SZ_ERROR_DATA;
|
||||||
|
RINOK(SzDecodeCopy(inSize, inStream, outBufCur));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RINOK(SzDecodeLzma(coder, inSize, inStream, outBufCur, outSizeCur, allocMain));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (coder->MethodID == k_BCJ)
|
||||||
|
{
|
||||||
|
UInt32 state;
|
||||||
|
if (ci != 1)
|
||||||
|
return SZ_ERROR_UNSUPPORTED;
|
||||||
|
x86_Convert_Init(state);
|
||||||
|
x86_Convert(outBuffer, outSize, 0, &state, 0);
|
||||||
|
}
|
||||||
|
else if (coder->MethodID == k_BCJ2)
|
||||||
|
{
|
||||||
|
UInt64 offset = GetSum(packSizes, 1);
|
||||||
|
UInt64 s3Size = packSizes[1];
|
||||||
|
SRes res;
|
||||||
|
if (ci != 3)
|
||||||
|
return SZ_ERROR_UNSUPPORTED;
|
||||||
|
RINOK(LookInStream_SeekTo(inStream, startPos + offset));
|
||||||
|
tempSizes[2] = (SizeT)s3Size;
|
||||||
|
if (tempSizes[2] != s3Size)
|
||||||
|
return SZ_ERROR_MEM;
|
||||||
|
tempBuf[2] = (Byte *)IAlloc_Alloc(allocMain, tempSizes[2]);
|
||||||
|
if (tempBuf[2] == 0 && tempSizes[2] != 0)
|
||||||
|
return SZ_ERROR_MEM;
|
||||||
|
res = SzDecodeCopy(s3Size, inStream, tempBuf[2]);
|
||||||
|
RINOK(res)
|
||||||
|
|
||||||
|
res = Bcj2_Decode(
|
||||||
|
tempBuf3, tempSize3,
|
||||||
|
tempBuf[0], tempSizes[0],
|
||||||
|
tempBuf[1], tempSizes[1],
|
||||||
|
tempBuf[2], tempSizes[2],
|
||||||
|
outBuffer, outSize);
|
||||||
|
RINOK(res)
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return SZ_ERROR_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
return SZ_OK;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return SZ_ERROR_UNSUPPORTED;
|
|
||||||
}
|
|
||||||
return SZ_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
SRes SzDecode(const UInt64 *packSizes, const CSzFolder *folder,
|
SRes SzDecode(const UInt64 *packSizes, const CSzFolder *folder,
|
||||||
ILookInStream *inStream, UInt64 startPos,
|
ILookInStream *inStream, UInt64 startPos,
|
||||||
Byte *outBuffer, size_t outSize, ISzAlloc *allocMain)
|
Byte *outBuffer, size_t outSize, ISzAlloc *allocMain)
|
||||||
{
|
{
|
||||||
Byte *tempBuf[3] = { 0, 0, 0};
|
Byte *tempBuf[3] = { 0, 0, 0};
|
||||||
int i;
|
int i;
|
||||||
SRes res = SzDecode2(packSizes, folder, inStream, startPos,
|
SRes res = SzDecode2(packSizes, folder, inStream, startPos,
|
||||||
outBuffer, (SizeT)outSize, allocMain, tempBuf);
|
outBuffer, (SizeT)outSize, allocMain, tempBuf);
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
IAlloc_Free(allocMain, tempBuf[i]);
|
IAlloc_Free(allocMain, tempBuf[i]);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* 7zExtract.c -- Extracting from 7z archive
|
/* 7zExtract.c -- Extracting from 7z archive
|
||||||
2008-11-23 : Igor Pavlov : Public domain */
|
2008-11-23 : Igor Pavlov : Public domain */
|
||||||
|
|
||||||
#include "../../7zCrc.h"
|
#include "7zCrc.h"
|
||||||
#include "7zDecode.h"
|
#include "7zDecode.h"
|
||||||
#include "7zExtract.h"
|
#include "7zExtract.h"
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#ifndef __7Z_HEADER_H
|
#ifndef __7Z_HEADER_H
|
||||||
#define __7Z_HEADER_H
|
#define __7Z_HEADER_H
|
||||||
|
|
||||||
#include "../../Types.h"
|
#include "Types.h"
|
||||||
|
|
||||||
#define k7zSignatureSize 6
|
#define k7zSignatureSize 6
|
||||||
extern Byte k7zSignature[k7zSignatureSize];
|
extern Byte k7zSignature[k7zSignatureSize];
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#ifndef __7Z_ITEM_H
|
#ifndef __7Z_ITEM_H
|
||||||
#define __7Z_ITEM_H
|
#define __7Z_ITEM_H
|
||||||
|
|
||||||
#include "../../7zBuf.h"
|
#include "7zBuf.h"
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,7 +39,7 @@ SRes LookInStream_SeekTo(ILookInStream *stream, UInt64 offset)
|
||||||
|
|
||||||
SRes LookInStream_LookRead(ILookInStream *stream, void *buf, size_t *size)
|
SRes LookInStream_LookRead(ILookInStream *stream, void *buf, size_t *size)
|
||||||
{
|
{
|
||||||
const void *lookBuf;
|
void *lookBuf;
|
||||||
if (*size == 0)
|
if (*size == 0)
|
||||||
return SZ_OK;
|
return SZ_OK;
|
||||||
RINOK(stream->Look(stream, &lookBuf, size));
|
RINOK(stream->Look(stream, &lookBuf, size));
|
||||||
|
@ -66,7 +66,7 @@ SRes LookInStream_Read(ILookInStream *stream, void *buf, size_t size)
|
||||||
return LookInStream_Read2(stream, buf, size, SZ_ERROR_INPUT_EOF);
|
return LookInStream_Read2(stream, buf, size, SZ_ERROR_INPUT_EOF);
|
||||||
}
|
}
|
||||||
|
|
||||||
static SRes LookToRead_Look_Lookahead(void *pp, const void **buf, size_t *size)
|
static SRes LookToRead_Look_Lookahead(void *pp, void **buf, size_t *size)
|
||||||
{
|
{
|
||||||
SRes res = SZ_OK;
|
SRes res = SZ_OK;
|
||||||
CLookToRead *p = (CLookToRead *)pp;
|
CLookToRead *p = (CLookToRead *)pp;
|
||||||
|
@ -84,7 +84,7 @@ static SRes LookToRead_Look_Lookahead(void *pp, const void **buf, size_t *size)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SRes LookToRead_Look_Exact(void *pp, const void **buf, size_t *size)
|
static SRes LookToRead_Look_Exact(void *pp, void **buf, size_t *size)
|
||||||
{
|
{
|
||||||
SRes res = SZ_OK;
|
SRes res = SZ_OK;
|
||||||
CLookToRead *p = (CLookToRead *)pp;
|
CLookToRead *p = (CLookToRead *)pp;
|
||||||
|
|
|
@ -5,14 +5,14 @@
|
||||||
|
|
||||||
#ifdef MY_CPU_X86_OR_AMD64
|
#ifdef MY_CPU_X86_OR_AMD64
|
||||||
|
|
||||||
#if (defined(_MSC_VER) && !defined(MY_CPU_AMD64)) || defined(__GNUC__)
|
#if (defined(_MSC_VER_) && !defined(MY_CPU_AMD64)) || defined(__GNUC__)
|
||||||
#define USE_ASM
|
#define USE_ASM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(USE_ASM) && !defined(MY_CPU_AMD64)
|
#if defined(USE_ASM) && !defined(MY_CPU_AMD64)
|
||||||
static UInt32 CheckFlag(UInt32 flag)
|
static UInt32 CheckFlag(UInt32 flag)
|
||||||
{
|
{
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER_
|
||||||
__asm pushfd;
|
__asm pushfd;
|
||||||
__asm pop EAX;
|
__asm pop EAX;
|
||||||
__asm mov EDX, EAX;
|
__asm mov EDX, EAX;
|
||||||
|
@ -52,7 +52,7 @@ static void MyCPUID(UInt32 function, UInt32 *a, UInt32 *b, UInt32 *c, UInt32 *d)
|
||||||
{
|
{
|
||||||
#ifdef USE_ASM
|
#ifdef USE_ASM
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER_
|
||||||
|
|
||||||
UInt32 a2, b2, c2, d2;
|
UInt32 a2, b2, c2, d2;
|
||||||
__asm xor EBX, EBX;
|
__asm xor EBX, EBX;
|
||||||
|
|
|
@ -97,7 +97,7 @@ Stop_Compiling_Bad_Endian
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MY_CPU_LE_UNALIGN) && defined(_WIN64) && (defined(_MSC_VER) && (_MSC_VER >= 1300))
|
#if defined(MY_CPU_LE_UNALIGN) && defined(_WIN64) && (defined(_MSC_VER_) && (_MSC_VER_ >= 1300))
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#pragma intrinsic(_byteswap_ulong)
|
#pragma intrinsic(_byteswap_ulong)
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#ifndef __ROTATE_DEFS_H
|
#ifndef __ROTATE_DEFS_H
|
||||||
#define __ROTATE_DEFS_H
|
#define __ROTATE_DEFS_H
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER_
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#define rotlFixed(x, n) _rotl((x), (n))
|
#define rotlFixed(x, n) _rotl((x), (n))
|
||||||
|
|
|
@ -70,14 +70,14 @@ WRes Semaphore_Release1(CSemaphore *p) { return Semaphore_ReleaseN(p, 1); }
|
||||||
WRes CriticalSection_Init(CCriticalSection *p)
|
WRes CriticalSection_Init(CCriticalSection *p)
|
||||||
{
|
{
|
||||||
/* InitializeCriticalSection can raise only STATUS_NO_MEMORY exception */
|
/* InitializeCriticalSection can raise only STATUS_NO_MEMORY exception */
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER_
|
||||||
__try
|
__try
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
InitializeCriticalSection(p);
|
InitializeCriticalSection(p);
|
||||||
/* InitializeCriticalSectionAndSpinCount(p, 0); */
|
/* InitializeCriticalSectionAndSpinCount(p, 0); */
|
||||||
}
|
}
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER_
|
||||||
__except (EXCEPTION_EXECUTE_HANDLER) { return 1; }
|
__except (EXCEPTION_EXECUTE_HANDLER) { return 1; }
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -74,7 +74,7 @@ typedef unsigned long UInt64;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
#if defined(_MSC_VER_) || defined(__BORLANDC__)
|
||||||
typedef __int64 Int64;
|
typedef __int64 Int64;
|
||||||
typedef unsigned __int64 UInt64;
|
typedef unsigned __int64 UInt64;
|
||||||
#define UINT64_CONST(n) n
|
#define UINT64_CONST(n) n
|
||||||
|
@ -103,7 +103,7 @@ typedef int Bool;
|
||||||
#define MY_STD_CALL
|
#define MY_STD_CALL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER_
|
||||||
|
|
||||||
#if _MSC_VER >= 1300
|
#if _MSC_VER >= 1300
|
||||||
#define MY_NO_INLINE __declspec(noinline)
|
#define MY_NO_INLINE __declspec(noinline)
|
||||||
|
@ -168,7 +168,7 @@ typedef struct
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
SRes (*Look)(void *p, const void **buf, size_t *size);
|
SRes (*Look)(void *p, void **buf, size_t *size);
|
||||||
/* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
|
/* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
|
||||||
(output(*size) > input(*size)) is not allowed
|
(output(*size) > input(*size)) is not allowed
|
||||||
(output(*size) < input(*size)) is allowed */
|
(output(*size) < input(*size)) is allowed */
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
#include "kjmp2.h"
|
#include "kjmp2.h"
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER_
|
||||||
#define FASTCALL __fastcall
|
#define FASTCALL __fastcall
|
||||||
#else
|
#else
|
||||||
#define FASTCALL
|
#define FASTCALL
|
||||||
|
|
|
@ -62,8 +62,8 @@
|
||||||
#include "guisan/platform.hpp"
|
#include "guisan/platform.hpp"
|
||||||
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER_
|
||||||
#if _MSC_VER <= 1200
|
#if _MSC_VER_ <= 1200
|
||||||
#define __FUNCTION__ "?"
|
#define __FUNCTION__ "?"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -68,10 +68,10 @@
|
||||||
#define GCN_CORE_DECLSPEC __declspec(dllimport)
|
#define GCN_CORE_DECLSPEC __declspec(dllimport)
|
||||||
#define GCN_EXTENSION_DECLSPEC __declspec(dllimport)
|
#define GCN_EXTENSION_DECLSPEC __declspec(dllimport)
|
||||||
|
|
||||||
#elif defined(_MSC_VER) && defined(GUICHAN_BUILD)
|
#elif defined(_MSC_VER_) && defined(GUICHAN_BUILD)
|
||||||
#define GCN_CORE_DECLSPEC _declspec(dllexport)
|
#define GCN_CORE_DECLSPEC _declspec(dllexport)
|
||||||
|
|
||||||
#elif defined(_MSC_VER) && defined(GUICHAN_EXTENSION_BUILD)
|
#elif defined(_MSC_VER_) && defined(GUICHAN_EXTENSION_BUILD)
|
||||||
#define GCN_CORE_DECLSPEC _declspec(dllimport)
|
#define GCN_CORE_DECLSPEC _declspec(dllimport)
|
||||||
#define GCN_EXTENSION_DECLSPEC _declspec(dllexport)
|
#define GCN_EXTENSION_DECLSPEC _declspec(dllexport)
|
||||||
|
|
||||||
|
|
75
src/include/ar.h
Normal file
75
src/include/ar.h
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
#ifndef UAE_AR_H
|
||||||
|
#define UAE_AR_H
|
||||||
|
|
||||||
|
#include "uae/types.h"
|
||||||
|
|
||||||
|
/* disable HRTMon support by commenting this out */
|
||||||
|
#define ACTION_REPLAY_HRTMON
|
||||||
|
|
||||||
|
#ifdef ACTION_REPLAY
|
||||||
|
#define ACTION_REPLAY_COMMON
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ACTION_REPLAY_HRTMON
|
||||||
|
#define ACTION_REPLAY_COMMON
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ACTION_REPLAY
|
||||||
|
/* disable Action Replay ROM/RAM hide by commenting this out */
|
||||||
|
/* Better not disable this unless you do plenty of testing first. -Mark */
|
||||||
|
#define ACTION_REPLAY_HIDE_CARTRIDGE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ACTION_REPLAY_WAIT_PC -3 /* Wait for a specified Program counter */
|
||||||
|
#define ACTION_REPLAY_INACTIVE -2
|
||||||
|
#define ACTION_REPLAY_WAITRESET -1
|
||||||
|
#define ACTION_REPLAY_IDLE 1
|
||||||
|
#define ACTION_REPLAY_ACTIVATE 2
|
||||||
|
#define ACTION_REPLAY_ACTIVE 3
|
||||||
|
#define ACTION_REPLAY_DORESET 4
|
||||||
|
#define ACTION_REPLAY_HIDE 5
|
||||||
|
|
||||||
|
extern int action_replay_freeze (void);
|
||||||
|
|
||||||
|
extern uaecptr wait_for_pc;
|
||||||
|
extern int action_replay_flag;
|
||||||
|
extern int armodel;
|
||||||
|
|
||||||
|
extern int is_ar_pc_in_rom(void);
|
||||||
|
extern int is_ar_pc_in_ram(void);
|
||||||
|
extern void action_replay_enter (void);
|
||||||
|
extern void action_replay_cia_access (bool write);
|
||||||
|
extern void action_replay_hide (void);
|
||||||
|
extern void action_replay_reset (bool hardreset, bool keyboardreset);
|
||||||
|
extern int action_replay_load (void);
|
||||||
|
extern int action_replay_unload (int in_memory_reset);
|
||||||
|
|
||||||
|
extern void action_replay_memory_reset (void);
|
||||||
|
extern void action_replay_init (int);
|
||||||
|
extern void action_replay_cleanup (void);
|
||||||
|
extern void REGPARAM3 chipmem_lput_actionreplay23 (uaecptr addr, uae_u32 l) REGPARAM;
|
||||||
|
extern void REGPARAM3 chipmem_wput_actionreplay23 (uaecptr addr, uae_u32 w) REGPARAM;
|
||||||
|
extern void REGPARAM3 chipmem_bput_actionreplay1 (uaecptr addr, uae_u32 b) REGPARAM;
|
||||||
|
extern void REGPARAM3 chipmem_wput_actionreplay1 (uaecptr addr, uae_u32 w) REGPARAM;
|
||||||
|
extern void REGPARAM3 chipmem_lput_actionreplay1 (uaecptr addr, uae_u32 l) REGPARAM;
|
||||||
|
|
||||||
|
extern void action_replay_version (void);
|
||||||
|
|
||||||
|
extern int hrtmon_flag;
|
||||||
|
|
||||||
|
extern void hrtmon_enter (void);
|
||||||
|
extern void hrtmon_breakenter (void);
|
||||||
|
extern void hrtmon_ciaread (void);
|
||||||
|
extern void hrtmon_hide (void);
|
||||||
|
extern void hrtmon_reset (void);
|
||||||
|
extern int hrtmon_load (void);
|
||||||
|
extern void hrtmon_map_banks (void);
|
||||||
|
|
||||||
|
/*extern uae_u8 *hrtmemory;*/
|
||||||
|
extern uae_u32 hrtmem_start, hrtmem_size, hrtmem2_start, hrtmem3_start;
|
||||||
|
|
||||||
|
extern uae_u8 ar_custom[2*256], ar_ciaa[16], ar_ciab[16];
|
||||||
|
|
||||||
|
extern int hrtmon_lang;
|
||||||
|
|
||||||
|
#endif /* UAE_AR_H */
|
|
@ -54,7 +54,7 @@ using namespace std;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __STDC__
|
#ifndef __STDC__
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER_
|
||||||
#error "Your compiler is not ANSI. Get a real one."
|
#error "Your compiler is not ANSI. Get a real one."
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -369,7 +369,7 @@ extern void gui_message(const TCHAR *, ...);
|
||||||
#endif
|
#endif
|
||||||
#define NOINLINE __attribute__ ((noinline))
|
#define NOINLINE __attribute__ ((noinline))
|
||||||
#define NORETURN __attribute__ ((noreturn))
|
#define NORETURN __attribute__ ((noreturn))
|
||||||
#elif _MSC_VER
|
#elif _MSC_VER_
|
||||||
#define STATIC_INLINE static __forceinline
|
#define STATIC_INLINE static __forceinline
|
||||||
#define NOINLINE __declspec(noinline)
|
#define NOINLINE __declspec(noinline)
|
||||||
#define NORETURN __declspec(noreturn)
|
#define NORETURN __declspec(noreturn)
|
||||||
|
|
78
src/main.cpp
78
src/main.cpp
|
@ -158,10 +158,8 @@ void fixup_cpu(struct uae_prefs *p)
|
||||||
switch (p->cpu_model)
|
switch (p->cpu_model)
|
||||||
{
|
{
|
||||||
case 68000:
|
case 68000:
|
||||||
p->address_space_24 = true;
|
|
||||||
break;
|
break;
|
||||||
case 68010:
|
case 68010:
|
||||||
p->address_space_24 = true;
|
|
||||||
break;
|
break;
|
||||||
case 68020:
|
case 68020:
|
||||||
break;
|
break;
|
||||||
|
@ -171,52 +169,20 @@ void fixup_cpu(struct uae_prefs *p)
|
||||||
if (p->fpu_model)
|
if (p->fpu_model)
|
||||||
p->fpu_model = 68040;
|
p->fpu_model = 68040;
|
||||||
break;
|
break;
|
||||||
case 68060:
|
|
||||||
if (p->fpu_model)
|
|
||||||
p->fpu_model = 68060;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->cpu_model < 68020 && p->cachesize) {
|
if (p->cpu_model >= 68020 && p->cachesize && p->cpu_compatible)
|
||||||
p->cachesize = 0;
|
|
||||||
error_log(_T("JIT requires 68020 or better CPU."));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p->cpu_model >= 68040 && p->cachesize && p->cpu_compatible)
|
|
||||||
p->cpu_compatible = false;
|
p->cpu_compatible = false;
|
||||||
|
|
||||||
if (p->cpu_model >= 68040 && p->cpu_cycle_exact) {
|
if (p->cachesize && (p->fpu_no_unimplemented)) {
|
||||||
p->cpu_cycle_exact = false;
|
error_log(_T("JIT is not compatible with unimplemented FPU instruction emulation."));
|
||||||
error_log(_T("68040/060 cycle-exact is not supported."));
|
p->fpu_no_unimplemented = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((p->cpu_model < 68030 || p->cachesize) && p->mmu_model) {
|
|
||||||
error_log(_T("MMU emulation requires 68030/040/060 and it is not JIT compatible."));
|
|
||||||
p->mmu_model = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p->cachesize && p->cpu_cycle_exact) {
|
|
||||||
error_log(_T("JIT and cycle-exact can't be enabled simultaneously."));
|
|
||||||
p->cachesize = 0;
|
|
||||||
}
|
|
||||||
if (p->cachesize && (p->fpu_no_unimplemented || p->int_no_unimplemented)) {
|
|
||||||
error_log(_T("JIT is not compatible with unimplemented CPU/FPU instruction emulation."));
|
|
||||||
p->fpu_no_unimplemented = p->int_no_unimplemented = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p->cpu_cycle_exact && p->m68k_speed < 0)
|
|
||||||
p->m68k_speed = 0;
|
|
||||||
|
|
||||||
if (p->immediate_blits && p->blitter_cycle_exact) {
|
|
||||||
error_log(_T("Cycle-exact and immediate blitter can't be enabled simultaneously.\n"));
|
|
||||||
p->immediate_blits = false;
|
|
||||||
}
|
|
||||||
if (p->immediate_blits && p->waiting_blits) {
|
if (p->immediate_blits && p->waiting_blits) {
|
||||||
error_log(_T("Immediate blitter and waiting blits can't be enabled simultaneously.\n"));
|
error_log(_T("Immediate blitter and waiting blits can't be enabled simultaneously.\n"));
|
||||||
p->waiting_blits = 0;
|
p->waiting_blits = 0;
|
||||||
}
|
}
|
||||||
if (p->cpu_cycle_exact)
|
|
||||||
p->cpu_compatible = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -485,41 +451,6 @@ static void parse_cmdline_2(int argc, TCHAR **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int diskswapper_cb(struct zfile *f, void *vrsd)
|
|
||||||
{
|
|
||||||
int *num = static_cast<int*>(vrsd);
|
|
||||||
if (*num >= MAX_SPARE_DRIVES)
|
|
||||||
return 1;
|
|
||||||
if (zfile_gettype(f) == ZFILE_DISKIMAGE) {
|
|
||||||
_tcsncpy(currprefs.dfxlist[*num], zfile_getname(f), 255);
|
|
||||||
(*num)++;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void parse_diskswapper(const TCHAR *s)
|
|
||||||
{
|
|
||||||
TCHAR *tmp = my_strdup(s);
|
|
||||||
TCHAR *delim = _T(",");
|
|
||||||
TCHAR *p1, *p2;
|
|
||||||
int num = 0;
|
|
||||||
|
|
||||||
p1 = tmp;
|
|
||||||
for (;;) {
|
|
||||||
p2 = strtok(p1, delim);
|
|
||||||
if (!p2)
|
|
||||||
break;
|
|
||||||
p1 = nullptr;
|
|
||||||
if (num >= MAX_SPARE_DRIVES)
|
|
||||||
break;
|
|
||||||
if (!zfile_zopen(p2, diskswapper_cb, &num)) {
|
|
||||||
_tcsncpy(currprefs.dfxlist[num], p2, 255);
|
|
||||||
num++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
free(tmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static TCHAR *parsetext(const TCHAR *s)
|
static TCHAR *parsetext(const TCHAR *s)
|
||||||
{
|
{
|
||||||
if (*s == '"' || *s == '\'') {
|
if (*s == '"' || *s == '\'') {
|
||||||
|
@ -793,7 +724,6 @@ static int real_main2 (int argc, TCHAR **argv)
|
||||||
memset(&gui_data, 0, sizeof gui_data);
|
memset(&gui_data, 0, sizeof gui_data);
|
||||||
gui_data.cd = -1;
|
gui_data.cd = -1;
|
||||||
gui_data.hd = -1;
|
gui_data.hd = -1;
|
||||||
gui_data.md = -1;
|
|
||||||
|
|
||||||
if (!init_shm()) {
|
if (!init_shm()) {
|
||||||
if (currprefs.start_gui)
|
if (currprefs.start_gui)
|
||||||
|
|
|
@ -6,8 +6,9 @@
|
||||||
* Copyright 1997, 2001 Bernd Schmidt
|
* Copyright 1997, 2001 Bernd Schmidt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "SDL.h"
|
#pragma once
|
||||||
#include "SDL_thread.h"
|
#include <SDL.h>
|
||||||
|
#include <SDL_thread.h>
|
||||||
|
|
||||||
/* Sempahores. We use POSIX semaphores; if you are porting this to a machine
|
/* Sempahores. We use POSIX semaphores; if you are porting this to a machine
|
||||||
* with different ones, make them look like POSIX semaphores. */
|
* with different ones, make them look like POSIX semaphores. */
|
||||||
|
@ -16,7 +17,7 @@ typedef SDL_sem *uae_sem_t;
|
||||||
STATIC_INLINE int uae_sem_init(uae_sem_t *sem, int dummy, int init)
|
STATIC_INLINE int uae_sem_init(uae_sem_t *sem, int dummy, int init)
|
||||||
{
|
{
|
||||||
*sem = SDL_CreateSemaphore (init);
|
*sem = SDL_CreateSemaphore (init);
|
||||||
return (*sem == 0);
|
return (*sem == nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define uae_sem_destroy(PSEM) SDL_DestroySemaphore (*PSEM)
|
#define uae_sem_destroy(PSEM) SDL_DestroySemaphore (*PSEM)
|
||||||
|
@ -40,7 +41,7 @@ STATIC_INLINE void uae_end_thread (uae_thread_id *tid)
|
||||||
|
|
||||||
STATIC_INLINE int uae_start_thread (const TCHAR *name, void *(*f) (void *), void *arg, uae_thread_id *foo)
|
STATIC_INLINE int uae_start_thread (const TCHAR *name, void *(*f) (void *), void *arg, uae_thread_id *foo)
|
||||||
{
|
{
|
||||||
uae_thread_id id = SDL_CreateThread ((int (*)(void *))f, arg);
|
uae_thread_id id = SDL_CreateThread ((int (*)(void *))f, "StartThread", arg);
|
||||||
if(foo != NULL)
|
if(foo != NULL)
|
||||||
*foo = id;
|
*foo = id;
|
||||||
return (int)id;
|
return (int)id;
|
||||||
|
@ -48,7 +49,7 @@ STATIC_INLINE int uae_start_thread (const TCHAR *name, void *(*f) (void *), void
|
||||||
|
|
||||||
STATIC_INLINE int uae_start_thread_fast (void *(*f) (void *), void *arg, uae_thread_id *foo)
|
STATIC_INLINE int uae_start_thread_fast (void *(*f) (void *), void *arg, uae_thread_id *foo)
|
||||||
{
|
{
|
||||||
uae_thread_id id = SDL_CreateThread ((int (*)(void *))f, arg);
|
uae_thread_id id = SDL_CreateThread ((int (*)(void *))f, "StartThreadFast", arg);
|
||||||
if(foo != NULL)
|
if(foo != NULL)
|
||||||
*foo = id;
|
*foo = id;
|
||||||
return (int)id;
|
return (int)id;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue