Skip to content

Commit 85eea1e

Browse files
committed
The bal to the decompression code is now variable.
1 parent 0a4c06f commit 85eea1e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/supportpsx/ps1-packer.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ void PCSX::PS1Packer::pack(IO<File> src, IO<File> dest, uint32_t addr, uint32_t
141141

142142
// Now we start writing our decompressor stub.
143143
// First, dump the decompressor code.
144+
size_t n2estart = dataOut.size();
144145
pushBytes(dataOut, n2e_d::code);
145146

146147
// At this point in the dataOut buffer, we have the following:
@@ -171,7 +172,7 @@ void PCSX::PS1Packer::pack(IO<File> src, IO<File> dest, uint32_t addr, uint32_t
171172
pushBytes(dataOut, lui(Reg::A0, getHI(compLoad)));
172173
pushBytes(dataOut, addiu(Reg::A0, Reg::A0, getLO(compLoad)));
173174
pushBytes(dataOut, lui(Reg::A1, getHI(addr)));
174-
pushBytes(dataOut, bgezal(Reg::R0, -((int16_t)(sizeof(n2e_d::code) + 7 * 4))));
175+
pushBytes(dataOut, bgezal(Reg::R0, -((int16_t)(dataOut.size() + 4 - n2estart))));
175176
pushBytes(dataOut, addiu(Reg::A1, Reg::A1, getLO(addr)));
176177

177178
// Then, bootstrap our newly-decompressed binary.

0 commit comments

Comments
 (0)