Skip to content

Commit a072e38

Browse files
authored
Merge pull request #1463 from nicolasnoble/nopad
Adding nopad option to ps1-packer.
2 parents a64ba39 + 0e6f33d commit a072e38

4 files changed

Lines changed: 8 additions & 1 deletion

File tree

src/supportpsx/binffi.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ struct BinaryLoaderInfo {
3737
struct PS1PackerOptions {
3838
uint32_t tload;
3939
bool shell;
40+
bool nopad;
4041
bool booty;
4142
bool raw;
4243
bool rom;
@@ -99,6 +100,7 @@ PCSX.Binary.pack = function(src, dest, addr, pc, gp, sp, options)
99100
opts.tload = options.tload and options.tload or 0
100101
opts.booty = options.booty and true or false
101102
opts.shell = options.shell and true or false
103+
opts.nopad = options.nopad and true or false
102104
opts.raw = options.raw and true or false
103105
opts.rom = options.rom and true or false
104106
opts.cpe = options.cpe and true or false

src/supportpsx/ps1-packer.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ void PCSX::PS1Packer::pack(IO<File> src, IO<File> dest, uint32_t addr, uint32_t
171171
pushBytes(dataOut, jr(Reg::T0));
172172
pushBytes(dataOut, addiu(Reg::RA, Reg::T8, 0));
173173
}
174-
while (!options.cpe && !options.booty && !options.rom && !options.raw && ((dataOut.size() & 0x7ff) != 0)) {
174+
while (!options.cpe && !options.booty && !options.rom && !options.raw && !options.nopad &&
175+
((dataOut.size() & 0x7ff) != 0)) {
175176
dataOut.push_back(0);
176177
}
177178

src/supportpsx/ps1-packer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ namespace PS1Packer {
3737
struct Options {
3838
uint32_t tload = 0;
3939
bool shell = false;
40+
bool nopad = false;
4041
bool booty = false;
4142
bool raw = false;
4243
bool rom = false;

tools/ps1-packer/ps1-packer.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ ps1-packer by Nicolas "Pixel" Noble
4444
const bool booty = args.get<bool>("booty").value_or(false);
4545
const bool rom = args.get<bool>("rom").value_or(false);
4646
const bool cpe = args.get<bool>("cpe").value_or(false);
47+
const bool nopad = args.get<bool>("nopad").value_or(false);
4748
unsigned outputTypeCount = (raw ? 1 : 0) + (booty ? 1 : 0) + (rom ? 1 : 0) + (cpe ? 1 : 0);
4849
if (asksForHelp || !oneInput || !hasOutput || (outputTypeCount > 1)) {
4950
fmt::print(R"(
@@ -53,6 +54,7 @@ Usage: {} input.ps-exe [-h] [-tload addr] [-shell] [-raw | -booty | -rom | -cpe]
5354
-h displays this help information and exit.
5455
-tload force loading at this address instead of doing in-place.
5556
-shell adds a kernel reset stub.
57+
-nopad disables padding of the output file to 2048 bytes. Only for PS-EXE output.
5658
5759
These options control the output format, and are mutually exclusive:
5860
-raw outputs a raw file.
@@ -99,6 +101,7 @@ Valid input binary files can be in the following formats:
99101
options.cpe = cpe;
100102
options.shell = shell;
101103
options.tload = tload;
104+
options.nopad = nopad;
102105
PCSX::IO<PCSX::File> out(new PCSX::PosixFile(output.value().c_str(), PCSX::FileOps::TRUNCATE));
103106
PCSX::PS1Packer::pack(new PCSX::SubFile(memory, memory->lowestAddress(), memory->actualSize()), out,
104107
memory->lowestAddress(), info.pc.value_or(0), info.gp.value_or(0), info.sp.value_or(0),

0 commit comments

Comments
 (0)