Skip to content

Commit 8cc3aa2

Browse files
authored
Merge pull request #1906 from nicolasnoble/authoring
Adding CD authoring tool.
2 parents 3b8f0a0 + 928e64b commit 8cc3aa2

36 files changed

+935
-213
lines changed

.github/filter-support/Makefile-filtered

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ SRCS += $(wildcard third_party/cueparser/*.c)
8585
SRCS += $(wildcard third_party/iec-60908b/*.c)
8686
SRCS += third_party/ucl/src/n2e_99.c third_party/ucl/src/alloc.c
8787

88-
TOOLS = exe2elf exe2iso ps1-packer psyq-obj-parser
88+
TOOLS = authoring exe2elf exe2iso modconv ps1-packer psyq-obj-parser
8989

9090
##############################################################################
9191

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ deps/
3939
objs/
4040
bins/
4141
/pcsx-redux
42+
/authoring
4243
/exe2elf
4344
/exe2iso
4445
/modconv

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,14 @@ ifeq ($(CROSS),arm64)
165165
CPPFLAGS += -DVIXL_INCLUDE_TARGET_AARCH64 -DVIXL_CODE_BUFFER_MMAP
166166
CPPFLAGS += -Ithird_party/vixl/src -Ithird_party/vixl/src/aarch64
167167
endif
168-
SUPPORT_SRCS := src/support/file.cc src/support/mem4g.cc src/support/zfile.cc
169-
SUPPORT_SRCS += src/supportpsx/adpcm.cc src/supportpsx/binloader.cc src/supportpsx/ps1-packer.cc
168+
SUPPORT_SRCS := src/support/container-file.cc src/support/file.cc src/support/mem4g.cc src/support/zfile.cc
169+
SUPPORT_SRCS += src/supportpsx/adpcm.cc src/supportpsx/binloader.cc src/supportpsx/iec-60908b.cc src/supportpsx/iso9660-builder.cc src/supportpsx/ps1-packer.cc
170170
SUPPORT_SRCS += third_party/fmt/src/os.cc third_party/fmt/src/format.cc
171171
SUPPORT_SRCS += third_party/ucl/src/n2e_99.c third_party/ucl/src/alloc.c
172172
SUPPORT_SRCS += $(wildcard third_party/iec-60908b/*.c)
173173
LIBS := third_party/luajit/src/libluajit.a
174174

175-
TOOLS = exe2elf exe2iso modconv ps1-packer psyq-obj-parser
175+
TOOLS = authoring exe2elf exe2iso modconv ps1-packer psyq-obj-parser
176176

177177
##############################################################################
178178

azure-pipelines-cli.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ steps:
6262
Contents: |
6363
vsprojects/x64/ReleaseCLI/pcsx-redux.exe
6464
vsprojects/x64/ReleaseCLI/crashpad_handler.exe
65+
vsprojects/x64/ReleaseCLI/authoring.exe
6566
vsprojects/x64/ReleaseCLI/exe2elf.exe
6667
vsprojects/x64/ReleaseCLI/exe2iso.exe
6768
vsprojects/x64/ReleaseCLI/modconv.exe
@@ -82,6 +83,7 @@ steps:
8283
testAssemblyVer2: |
8384
**\*.exe
8485
!**\crashpad_handler.exe
86+
!**\authoring.exe
8587
!**\exe2elf.exe
8688
!**\exe2iso.exe
8789
!**\modconv.exe

azure-pipelines.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ steps:
7070
vsprojects/x64/ReleaseWithClangCL/pcsx-redux.main
7171
vsprojects/x64/ReleaseWithClangCL/pcsx-redux.exe
7272
vsprojects/x64/ReleaseWithClangCL/crashpad_handler.exe
73+
vsprojects/x64/ReleaseWithClangCL/authoring.exe
7374
vsprojects/x64/ReleaseWithClangCL/exe2elf.exe
7475
vsprojects/x64/ReleaseWithClangCL/exe2iso.exe
7576
vsprojects/x64/ReleaseWithClangCL/modconv.exe
@@ -90,6 +91,7 @@ steps:
9091
testAssemblyVer2: |
9192
**\*.exe
9293
!**\crashpad_handler.exe
94+
!**\authoring.exe
9395
!**\exe2elf.exe
9496
!**\exe2iso.exe
9597
!**\modconv.exe

src/cdrom/common.h

Lines changed: 0 additions & 33 deletions
This file was deleted.

src/cdrom/file.cc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@
2424
#include "cdrom/cdriso.h"
2525
#include "iec-60908b/edcecc.h"
2626

27-
PCSX::CDRIsoFile::CDRIsoFile(std::shared_ptr<CDRIso> iso, uint32_t lba, int32_t size, SectorMode mode)
27+
PCSX::CDRIsoFile::CDRIsoFile(std::shared_ptr<CDRIso> iso, uint32_t lba, int32_t size, IEC60908b::SectorMode mode)
2828
: File(RW_SEEKABLE), m_iso(iso), m_lba(lba) {
2929
uint8_t* sector = m_cachedSector;
3030
if (iso->failed()) {
3131
m_failed = true;
3232
return;
3333
}
34-
if (mode == SectorMode::GUESS) {
35-
mode = SectorMode::RAW;
34+
if (mode == IEC60908b::SectorMode::GUESS) {
35+
mode = IEC60908b::SectorMode::RAW;
3636
do {
3737
m_cachedLBA = lba;
3838
iso->readSectors(lba, sector, 1);
@@ -48,7 +48,7 @@ PCSX::CDRIsoFile::CDRIsoFile(std::shared_ptr<CDRIso> iso, uint32_t lba, int32_t
4848
}
4949
switch (sector[15]) {
5050
case 1:
51-
mode = SectorMode::M1;
51+
mode = IEC60908b::SectorMode::M1;
5252
break;
5353
case 2: {
5454
uint8_t* subheaders = sector + 16;
@@ -57,9 +57,9 @@ PCSX::CDRIsoFile::CDRIsoFile(std::shared_ptr<CDRIso> iso, uint32_t lba, int32_t
5757
break;
5858
}
5959
if (subheaders[2] & 32) {
60-
mode = SectorMode::M2_FORM2;
60+
mode = IEC60908b::SectorMode::M2_FORM2;
6161
} else {
62-
mode = SectorMode::M2_FORM1;
62+
mode = IEC60908b::SectorMode::M2_FORM1;
6363
}
6464
break;
6565
}
@@ -74,7 +74,7 @@ PCSX::CDRIsoFile::CDRIsoFile(std::shared_ptr<CDRIso> iso, uint32_t lba, int32_t
7474
return;
7575
}
7676

77-
if ((mode != SectorMode::M2_FORM1) && (mode != SectorMode::M2_FORM2)) {
77+
if ((mode != IEC60908b::SectorMode::M2_FORM1) && (mode != IEC60908b::SectorMode::M2_FORM2)) {
7878
// can't detect file size on non-mode2 sectors
7979
m_failed = true;
8080
return;
@@ -200,8 +200,8 @@ ssize_t PCSX::CDRIsoFile::write(const void* buffer_, size_t size) {
200200
size_t blocSize = std::min(toCopy, c_sectorSizes[modeIndex] - sectorOffset);
201201
memcpy(patched + c_sectorOffsets[modeIndex] + sectorOffset, buffer + actualSize, blocSize);
202202
switch (m_mode) {
203-
case SectorMode::M2_FORM1:
204-
case SectorMode::M2_FORM2:
203+
case IEC60908b::SectorMode::M2_FORM1:
204+
case IEC60908b::SectorMode::M2_FORM2:
205205
compute_edcecc(patched);
206206
break;
207207
}

src/cdrom/file.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
#include <memory>
2525
#include <string_view>
2626

27-
#include "cdrom/common.h"
2827
#include "support/file.h"
28+
#include "supportpsx/iec-60908b.h"
2929

3030
namespace PCSX {
3131

@@ -37,7 +37,8 @@ class CDRIsoFile : public File {
3737

3838
static constexpr uint32_t c_sectorSizes[] = {2352, 2352, 2048, 2336, 2048, 2324};
3939
static constexpr size_t c_sectorOffsets[] = {0, 0, 16, 16, 24, 24};
40-
CDRIsoFile(std::shared_ptr<CDRIso> iso, uint32_t lba, int32_t size = -1, SectorMode = SectorMode::GUESS);
40+
CDRIsoFile(std::shared_ptr<CDRIso> iso, uint32_t lba, int32_t size = -1,
41+
IEC60908b::SectorMode = IEC60908b::SectorMode::GUESS);
4142
virtual bool failed() final override { return m_failed; }
4243
virtual ssize_t rSeek(ssize_t pos, int wheel) override;
4344
virtual ssize_t rTell() override { return m_ptrR; }
@@ -54,7 +55,7 @@ class CDRIsoFile : public File {
5455
int32_t m_cachedLBA = -1;
5556
uint32_t m_lba;
5657
uint32_t m_size;
57-
SectorMode m_mode;
58+
IEC60908b::SectorMode m_mode;
5859
size_t m_ptrR = 0;
5960
size_t m_ptrW = 0;
6061

src/cdrom/iso9660-builder.h

Lines changed: 0 additions & 48 deletions
This file was deleted.

src/cdrom/iso9660-reader.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
#include "cdrom/iso9660-reader.h"
2121

2222
#include "cdrom/file.h"
23-
#include "cdrom/iso9660-lowlevel.h"
2423
#include "support/strings-helpers.h"
24+
#include "supportpsx/iso9660-lowlevel.h"
2525

2626
PCSX::ISO9660Reader::ISO9660Reader(std::shared_ptr<CDRIso> iso) : m_iso(iso) {
2727
unsigned pvdSector = 16;

0 commit comments

Comments
 (0)