Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option for 4GB chunks #10

Open
retrosapien opened this issue Nov 17, 2024 · 2 comments
Open

Add option for 4GB chunks #10

retrosapien opened this issue Nov 17, 2024 · 2 comments

Comments

@retrosapien
Copy link

Hey,

First off, thanks for making this!
I have been using Debian for a few years, now, and recently decided to dust off my PS2. I've got used to using Linux and have been trying to replace the windows tools that i used to use and after a LOT of searching came across your project.
This is also the very first project that i have compiled from source, myself!
Though I say that loosely as you have indeed made this very easy to compile. Especially after realizing that i don't need git to do that. Just extract the zip and run make!

Anyway, my issue, or request, rather.

Is there any possibility of making an option to use 4GB chunks instead of 1GB?
Does OPL only support 1GB chunks? I can't remember off hand, myself.
4GB chunks means less files and will still fit on FAT32, which is the main reason I came looking for this project.

using grep i found this;
$ grep 1073741824 ./iso2opl-master/iso*
./iso2opl-master/iso2opl.c: if (nbytes > 1073741824)
./iso2opl-master/iso2opl.c: nbytes = 1073741824;
./iso2opl-master/iso2opl.c: if (nbytes > 1073741824)
./iso2opl-master/iso2opl.c: nbytes = 1073741824;
./iso2opl-master/iso2opl.c: num_parts = filesize / 1073741824;

If i changed all instances of 1073741824 to 4294967296, and compiled it again, would it do what i want?
Or maybe make an option like -2, -3 -4, that changes that value to 2GB, 3GB, 4GB...?
I only have scripting experience, so I'm just spitballing, here. I don't even know what language you coded this in. C something maybe? Just going by the extension.
Wait... is 'nbytes' a variable? I actually just noticed this is all in the same file, too. lol
Typing this has given me some things to experiment with, anyway. lol.

Thanks,

RS

@retrosapien
Copy link
Author

retrosapien commented Nov 17, 2024

After noticing that it only mentions 1073741824 in one file; iso2opl.c, I decided to change my grep;

$ grep 1073741824 iso2opl.c -nC3
228-		}
229-
230-		nbytes = filesize;
231:		if (nbytes > 1073741824)
232:			nbytes = 1073741824;
233-
234-		rpos = 0;
235-		if (nbytes) {
--
274-        }
275-
276-        nbytes = filesize;
277:        if (nbytes > 1073741824)
278:            nbytes = 1073741824;
279-
280-        rpos = 0;
281-        if (nbytes) {
--
550-    }
551-
552-    // get needed number of parts
553:    num_parts = filesize / 1073741824;
554-    if (filesize & 0x3fffffff)
555-        num_parts++;
556-

If i understand this;
then 'nbytes' = the iso's file size, and is only changed if that size is bigger than 1GB.

sed -n 's/1073741824/4294967296/pg' iso2opl.c
		if (nbytes > 4294967296)
			nbytes = 4294967296;
        if (nbytes > 4294967296)
            nbytes = 4294967296;
    num_parts = filesize / 4294967296;

sed -i 's/1073741824/4294967296/g' iso2opl.c

Compiled and ran fine, but i made the mistake of not renaming the binary, so my first test must have used the original binary that i made. Second test seems to be going fine, though. The first chunk is over 1GB, anyway. Will report back when I have a chance to test on my PS2.

Nevermind, after the first chunk, I got this error;

Error: failed to write datas to part file!

Trying one more time with 2gb chunks.

sed -i 's/1073741824/2147483648/g' iso2opl.c

Looked like it worked!
I think i figured out why it didn't work with 4gb chunks, i forgot to minus one byte. Doh!

Time for one more test before bed;

sed -i 's/1073741824/4294967295/g' iso2opl.c

Bully is installed!
Success!

@retrosapien
Copy link
Author

Maybe someone could add this to the README.md file?

Optional:
If 4GB(minus 1 byte) chunks are desired, use the following before running 'make';
sed -i 's/1073741824/4294967295/g' iso2opl.c

This is the largest file size supported on FAT32.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant