mirror of https://github.com/AxioDL/metaforce.git
Another bitstream fix
This commit is contained in:
parent
4b21ded1e3
commit
356788fb9e
|
@ -34,8 +34,8 @@ s32 CBitStreamReader::ReadEncoded(u32 bitCount)
|
||||||
if (shiftAmt < 0)
|
if (shiftAmt < 0)
|
||||||
{
|
{
|
||||||
/* OR in remaining bits of cached value */
|
/* OR in remaining bits of cached value */
|
||||||
u32 mask = (1 << bitCount) - 1;
|
u32 mask = bitCount == 32 ? 0xffffffff : ((1 << bitCount) - 1);
|
||||||
ret |= (x1c_val << -shiftAmt) & mask;
|
ret |= (x1c_val << u32(-shiftAmt)) & mask;
|
||||||
|
|
||||||
/* Load in exact number of bytes remaining */
|
/* Load in exact number of bytes remaining */
|
||||||
auto loadDiv = std::div(-shiftAmt, 8);
|
auto loadDiv = std::div(-shiftAmt, 8);
|
||||||
|
@ -47,14 +47,14 @@ s32 CBitStreamReader::ReadEncoded(u32 bitCount)
|
||||||
x20_bitOffset = loadDiv.quot * 8 + shiftAmt;
|
x20_bitOffset = loadDiv.quot * 8 + shiftAmt;
|
||||||
|
|
||||||
/* OR in next bits */
|
/* OR in next bits */
|
||||||
mask = (1 << -shiftAmt) - 1;
|
mask = (1 << u32(-shiftAmt)) - 1;
|
||||||
ret |= (x1c_val >> x20_bitOffset) & mask;
|
ret |= (x1c_val >> x20_bitOffset) & mask;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* OR in bits of cached value */
|
/* OR in bits of cached value */
|
||||||
u32 mask = (1 << bitCount) - 1;
|
u32 mask = bitCount == 32 ? 0xffffffff : ((1 << bitCount) - 1);
|
||||||
ret |= (x1c_val >> shiftAmt) & mask;
|
ret |= (x1c_val >> u32(shiftAmt)) & mask;
|
||||||
|
|
||||||
/* New bit offset */
|
/* New bit offset */
|
||||||
x20_bitOffset -= bitCount;
|
x20_bitOffset -= bitCount;
|
||||||
|
@ -83,7 +83,7 @@ void CBitStreamWriter::WriteEncoded(u32 val, u32 bitCount)
|
||||||
{
|
{
|
||||||
/* OR remaining bits to cached value */
|
/* OR remaining bits to cached value */
|
||||||
u32 mask = (1 << x18_bitOffset) - 1;
|
u32 mask = (1 << x18_bitOffset) - 1;
|
||||||
x14_val |= (val >> -shiftAmt) & mask;
|
x14_val |= (val >> u32(-shiftAmt)) & mask;
|
||||||
|
|
||||||
/* Write out 32-bits */
|
/* Write out 32-bits */
|
||||||
x14_val = hecl::SBig(x14_val);
|
x14_val = hecl::SBig(x14_val);
|
||||||
|
@ -96,8 +96,8 @@ void CBitStreamWriter::WriteEncoded(u32 val, u32 bitCount)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* OR bits to cached value */
|
/* OR bits to cached value */
|
||||||
u32 mask = (1 << bitCount) - 1;
|
u32 mask = bitCount == 32 ? 0xffffffff : ((1 << bitCount) - 1);
|
||||||
x14_val |= (val & mask) << shiftAmt;
|
x14_val |= (val & mask) << u32(shiftAmt);
|
||||||
|
|
||||||
/* New bit offset */
|
/* New bit offset */
|
||||||
x18_bitOffset -= bitCount;
|
x18_bitOffset -= bitCount;
|
||||||
|
|
|
@ -625,7 +625,7 @@ void CSaveUI::StartGame(int idx)
|
||||||
const CGameState::GameFileStateInfo* info = x6c_cardDriver->GetGameFileStateInfo(idx);
|
const CGameState::GameFileStateInfo* info = x6c_cardDriver->GetGameFileStateInfo(idx);
|
||||||
x6c_cardDriver->ExportPersistentOptions();
|
x6c_cardDriver->ExportPersistentOptions();
|
||||||
x6c_cardDriver->BuildNewFileSlot(idx);
|
x6c_cardDriver->BuildNewFileSlot(idx);
|
||||||
if (info)
|
if (!info)
|
||||||
x6c_cardDriver->StartFileCreateTransactional();
|
x6c_cardDriver->StartFileCreateTransactional();
|
||||||
else
|
else
|
||||||
x80_iowRet = CIOWin::EMessageReturn::Exit;
|
x80_iowRet = CIOWin::EMessageReturn::Exit;
|
||||||
|
|
2
kabufuda
2
kabufuda
|
@ -1 +1 @@
|
||||||
Subproject commit bb972f8f36cfd6b8b65b3e53352880b039a78393
|
Subproject commit 03f16f7f48d1f9316eefcb8118496def40da47db
|
Loading…
Reference in New Issue