Skip to content

Commit a740ef1

Browse files
authored
Feature: CHD support (#1006)
1 parent a50a78c commit a740ef1

40 files changed

+882
-67
lines changed

.gitattributes

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Stop `core.autocrlf true`
2-
*.lnx binary
3-
*.nes binary
4-
*.rom binary
2+
test/fixtures/roms/** binary
3+
*.cue text eol=lf
4+
*.gdi text eol=crlf

.github/workflows/codecov.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ jobs:
3535
- uses: actions/checkout@v4
3636
- uses: volta-cli/action@v4
3737
- run: npm ci
38+
- run: |
39+
sudo apt-get update
40+
sudo apt-get install -y libsdl2-2.0-0 libsdl2-ttf-2.0-0
3841
3942
# Run test coverage
4043
- run: npm run test:coverage

.github/workflows/node-test.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,13 @@ jobs:
8282
with:
8383
node-version: ${{ matrix.node-version }}
8484
- run: npm ci
85+
- if: ${{ matrix.os == 'macos' }}
86+
run: brew install --overwrite sdl2
87+
- if: ${{ matrix.os == 'ubuntu' }}
88+
run: |
89+
sudo apt-get update
90+
sudo apt-get install -y libsdl2-2.0-0 libsdl2-ttf-2.0-0
91+
8592
# Test the source files
8693
- run: npm run test:unit
8794

@@ -102,6 +109,9 @@ jobs:
102109
with:
103110
node-version: ${{ matrix.node-version }}
104111
- run: npm ci
112+
- run: |
113+
sudo apt-get update
114+
sudo apt-get install -y libsdl2-2.0-0 libsdl2-ttf-2.0-0
105115
# Test the built files
106116
- run: npm run build
107117
- run: ./test/endToEndTest.sh

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ site/
122122
*.bin
123123
*.cd1
124124
*.cd2
125+
*.chd
125126
*.col
126127
*.cue
127128
*.dvd
@@ -144,6 +145,7 @@ site/
144145
*.pce
145146
*.pk3
146147
*.pup
148+
*.raw
147149
*.rom
148150
*.rvz
149151
*.sfc

docs/alternatives.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ There are a few different popular ROM managers that have similar features:
1818
| DATs: fixdat creation |[Fixdat docs](dats/fixdats.md) ||||
1919
| DATs: combine multiple |||||
2020
| Archives: extraction formats | ✅ many formats ([reading archives docs](input/reading-archives.md)) |`.zip`, `.7z`, `.rar` | ⚠️ `.zip`, `.7z` | ⚠️ `.zip`, `.7z` |
21-
| Archives: `.chd` support | | ⚠️ via chdman | ✅ v1-5 natively | ⚠️ v1-4 natively |
21+
| Archives: `.chd` support | ⚠️ via chdman (bundled) | ⚠️ via chdman | ✅ v1-5 natively | ⚠️ v1-4 natively |
2222
| Archives: `.nkit.iso` support | ⚠️ matching but no extraction [GameCube docs](usage/console/gamecube.md#nkit) ||||
2323
| Archives: creation formats |`.zip` only by design ([writing archives docs](output/writing-archives.md)) |`.zip`, `.7z`, `.rar` | ⚠️ `.zip` (TorrentZip), `.7z` | ⚠️ `.zip`, `.7z` |
2424
| Archives: automatic extension correction |||||

docs/input/reading-archives.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,19 @@
66

77
`igir` supports most common archive formats:
88

9-
| Extension | Contains file CRC32s | `igir` can extract without a third-party binary | `igir` can checksum without temporary files |
10-
|--------------------------------------------------------------|----------------------|-------------------------------------------------|---------------------------------------------|
11-
| `.7z` ||||
12-
| `.gz`, `.gzip` | ❌ CRC16 |||
13-
| `.nkit` ([GameCube docs](../usage/console/gamecube.md#nkit)) || ❌ no extraction support ||
14-
| `.rar` ||||
15-
| `.tar` ||| ✅ ≤64MiB |
16-
| `.tar.gz`, `.tgz` ||| ✅ ≤64MiB |
17-
| `.z01` ||||
18-
| `.zip` (including zip64) ||| ✅ ≤64MiB |
19-
| `.zip.001` ||||
20-
| `.zipx` ||||
9+
| Extension | Contains file CRC32s | `igir` can extract without a third-party binary | `igir` can checksum without temporary files |
10+
|------------------------------------------------------------------|----------------------|-------------------------------------------------|---------------------------------------------|
11+
| `.7z` ||`7za` ||
12+
| `.chd` | ❌ SHA1 |`chdman` ||
13+
| `.gz`, `.gzip` | ❌ CRC16 |`7za` ||
14+
| `.nkit.iso` ([GameCube docs](../usage/console/gamecube.md#nkit)) || ❌ no extraction support ||
15+
| `.rar` ||||
16+
| `.tar` ||| ✅ ≤64MiB |
17+
| `.tar.gz`, `.tgz` ||| ✅ ≤64MiB |
18+
| `.z01` ||`7za` ||
19+
| `.zip` (including zip64) ||| ✅ ≤64MiB |
20+
| `.zip.001` ||`7za` ||
21+
| `.zipx` ||`7za` ||
2122

2223
**You should prefer archive formats that have CRC32 checksum information for each file.**
2324

jest.config.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,26 @@
1+
import fs from 'node:fs';
2+
import path from 'node:path';
3+
14
import { JestConfigWithTsJest } from 'ts-jest';
25

6+
// Fix some bad package.json files that don't play well with ts-jest
7+
[
8+
// https://github.com/g-plane/cue/issues/1
9+
'@gplane/cue',
10+
].forEach((moduleName) => {
11+
const modulePath = path.join('node_modules', moduleName);
12+
const packagePath = path.join(modulePath, 'package.json');
13+
const packageJson = JSON.parse(fs.readFileSync(packagePath).toString());
14+
15+
packageJson.main = packageJson.main
16+
?? packageJson.exports['.'].import;
17+
delete packageJson.exports;
18+
19+
fs.writeFileSync(packagePath, JSON.stringify(packageJson, undefined, 2));
20+
});
21+
322
const jestConfig: JestConfigWithTsJest = {
23+
preset: 'ts-jest',
424
testEnvironment: 'node',
525

626
setupFilesAfterEnv: ['jest-extended/all'],

package-lock.json

Lines changed: 24 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,14 @@
7070
"dependencies": {
7171
"@fast-csv/format": "5.0.0",
7272
"@fast-csv/parse": "5.0.0",
73+
"@gplane/cue": "0.2.0",
7374
"@node-rs/crc32": "1.10.3",
7475
"7zip-min": "1.4.4",
7576
"archiver": "7.0.1",
7677
"async": "3.2.5",
7778
"async-mutex": "0.5.0",
7879
"chalk": "5.3.0",
80+
"chdman": "0.267.2",
7981
"class-transformer": "0.5.1",
8082
"cli-progress": "3.12.0",
8183
"fast-glob": "3.3.2",

package.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ const fileFilter = (filters: FileFilter[]): string[] => {
8686
// Only include the exact 7zip-bin we need
8787
{ exclude: 'node_modules/{**/,}7zip-bin/**/7z*' },
8888
{ include: path7za },
89+
// Only include the exact chdman bin we need
90+
{ exclude: 'node_modules/{**/,}chdman/bin/*/*/chdman*' },
91+
{ include: `node_modules/{**/,}chdman/bin/${process.platform}/${process.arch}/chdman*` },
8992
]));
9093
const includeSize = (await Promise.all([...include].map(async (file) => {
9194
if (await FsPoly.isDirectory(file)) {

0 commit comments

Comments
 (0)