ps2homebrew / pfsshell

Browse and edit PFS filesystems on APA-formatted hard drive
GNU General Public License v2.0
95 stars 22 forks source link

Get compiler warnings/errors on Fedora 29 beta, GCC 8.2.1. #3

Closed TheMuso closed 4 years ago

TheMuso commented 5 years ago

I get the following error when attempting to compile on Fedora 29, GCC 8.2.1. Clang 7.0.0 also fails with the same error.

[themuso@balta pfsshell]$ make CC startup.c CC hl.c CC util.c CC shell.c make -C fake_sdk make[1]: Entering directory '/home/themuso/git/ps2/pfsshell/fake_sdk' CC atad.c ar rcs libfakeps2sdk.a atad.o make[1]: Leaving directory '/home/themuso/git/ps2/pfsshell/fake_sdk' make -C iomanX make[1]: Entering directory '/home/themuso/git/ps2/pfsshell/iomanX' CC iomanX.c iomanX.c: In function ‘AddDrv’: iomanX.c:77:9: warning: unused variable ‘oldIntr’ [-Wunused-variable] int oldIntr; ^~~ iomanX.c: In function ‘get_new_file’: iomanX.c:181:9: warning: unused variable ‘oldIntr’ [-Wunused-variable] int oldIntr; ^~~ In file included from iomanX.c:20: iomanX.c: At top level: ../fake_sdk/include/iomanX.h:113:17: error: conflicting types for ‘iomanx_lseek64’

define lseek64 iomanx_lseek64

             ^~~~~~~~~~~~~~

iomanX.c:570:11: note: in expansion of macro ‘lseek64’ long long lseek64(int fd, long long offset, int whence) ^~~ ../fake_sdk/include/iomanX.h:113:17: note: previous declaration of ‘iomanx_lseek64’ was here

define lseek64 iomanx_lseek64

             ^~~~~~~~~~~~~~

../fake_sdk/include/iomanX.h:184:5: note: in expansion of macro ‘lseek64’ s64 lseek64(int fd, s64 offset, int whence); ^~~ make[1]: [../Defs.mak:16: iomanX.o] Error 1 make[1]: Leaving directory '/home/themuso/git/ps2/pfsshell/iomanX' make: [Makefile:40: iomanX/libiomanX.a] Error 2

asommer70 commented 5 years ago

I'm getting the exact same error on Ubuntu 18.04.2 LTS. I'm not good enough with the C programming to fix the error right off the bat, but I'm looking into it.

TheMuso commented 5 years ago

I actually found that I could solve the errors at least, by making the changes in the following diff. I have access to macOS, I should test on there as well, and if it works there, submit a pull request.

diff --git a/apa/irx/apa-opt.h b/apa/irx/apa-opt.h index 6446517..dbceea9 100644 --- a/apa/irx/apa-opt.h +++ b/apa/irx/apa-opt.h @@ -11,6 +11,6 @@

define APA_MODVER_MAJOR 2

define APA_MODVER_MINOR 5

-#define _start apa_start +#define __start apa_start

endif

diff --git a/apa/irx/hdd.c b/apa/irx/hdd.c index b4d79bc..d1758be 100644 --- a/apa/irx/hdd.c +++ b/apa/irx/hdd.c @@ -178,7 +178,7 @@ static int unlockDrive(s32 device) return rv; }

-int _start(int argc, char argv) +int __start(int argc, char argv) { int i, ret; char *input; diff --git a/hdlfs/hdlfs.h b/hdlfs/hdlfs.h index 0812ce0..322a2f3 100644 --- a/hdlfs/hdlfs.h +++ b/hdlfs/hdlfs.h @@ -1,6 +1,6 @@

pragma once

-#define _start hdlfs_start +#define __start hdlfs_start

define HDL_FS_MAGIC 0x1337

define APA_FLAG_SUB 0x0001

diff --git a/hdlfs/main.c b/hdlfs/main.c index a40f2e0..5925f72 100644 --- a/hdlfs/main.c +++ b/hdlfs/main.c @@ -549,7 +549,7 @@ static iop_device_t hdlfs_dev = { };

/ Entry point / -int _start(int argc, char argv) +int __start(int argc, char argv) { DelDrv(hdlfs_dev_name); AddDrv(&hdlfs_dev); diff --git a/iomanX/iomanX.c b/iomanX/iomanX.c index 4a159bb..cdea510 100644 --- a/iomanX/iomanX.c +++ b/iomanX/iomanX.c @@ -48,7 +48,7 @@ iop_device_t **GetDeviceList(void) return (dev_list); }

-int _start(int argc, char argv) +int __start(int argc, char argv) { if (RegisterLibraryEntries(&_exp_iomanx) != 0) { return MODULE_NO_RESIDENT_END; @@ -567,7 +567,7 @@ int umount(const char *fsname) return file.device->ops->umount(&file, filename); }

-long long lseek64(int fd, long long offset, int whence) +s64 lseek64(int fd, s64 offset, int whence) { iop_file_t *f = get_file(fd);

diff --git a/pfs/irx/pfs-opt.h b/pfs/irx/pfs-opt.h index 3c96a93..d2e07bc 100644 --- a/pfs/irx/pfs-opt.h +++ b/pfs/irx/pfs-opt.h @@ -10,6 +10,6 @@

define PFS_IOCTL2_INC_CHECKSUM 1

define PFS_STAT_RETURN_INODE_LBA 1

-#define _start pfs_start +#define __start pfs_start

endif

diff --git a/pfs/irx/pfs.c b/pfs/irx/pfs.c index d3914c7..546f188 100644 --- a/pfs/irx/pfs.c +++ b/pfs/irx/pfs.c @@ -126,7 +126,7 @@ pfs_mount_t *pfsGetMountedUnit(s32 unit) return &pfsMountBuf[unit]; }

-int _start(int argc, char argv[]) +int __start(int argc, char argv[]) { char *filename; int number;

asommer70 commented 5 years ago

Thanks @TheMuso the patch worked on Ubuntu 18.04.2, I was able to compile pfsshell and it executed. I was then able to copy a file to the PS2 HD I'm using.

I'm following this guide trying to get PS1 VCD file onto the __.POPS partition I created with the Free MCBoot HDDManager app.

In the browser it says the files are there, but it won't execute. One thing I noticed was that when I created the partition it added a "+" to the beginning of the new partition. So the files are actually in "+.POPS" and the ELF files for POPStarter are in common/POPS. Do you think that's why the games won't load?

I know this might be off topic for the compile issue, but any help is greatly appreciated.

Thanks again for again for the patch.

uyjulian commented 5 years ago

Probably. Try creating the partition using pfsshell again.

I will take a look at the patch once I've got other things finished.

TheMuso commented 5 years ago

On Thu, Mar 07, 2019 at 08:40:38AM AEDT, Adam Sommer wrote:

In the browser it says the files are there, but it won't execute. One thing I noticed was that when I created the partition it added a "+" to the beginning of the new partition. So the files are actually in "+.POPS" and the ELF files for POPStarter are in common/POPS. Do you think that's why the games won't load?

I know this might be off topic for the compile issue, but any help is greatly appreciated.

Thanks again for again for the patch.

You're welcome.

How big is the partition? One thing you could also try is to put the needed files onto a USB drive, load uLaunchELF and copy them to the partition that way.

TheMuso commented 5 years ago

On Thu, Mar 07, 2019 at 08:54:17AM AEDT, Julian Uy wrote:

Probably. Try creating the partition using pfsshell again.

I will take a look at the patch once I've got other things finished.

I'll be happy to submit a proper pull request once I've tested on macOS.

asommer70 commented 5 years ago

Maybe I'm doing something wrong, but when I try to make a partition I get:

# mkpart __.POPS 8192
(!) __.POPS: Invalid argument.
(!) Exit code is -22.

Trying to make an 8G .POPS partition. Also, when I try to mount common I get:

# mount __common
pfs: Error: Invalid magic/version
(!) hdd0:__common: Input/output error.
(!) Exit code is -5.

Not sure if that's a bug with Ubuntu, or with the patch. I noticed that do_mkpart uses iomanx_open and maybe that was tweaked with the patch...

Also, I started clean with a initialize yes to create the base partitions which seemed to work:

# ls
0x0001   128MB __mbr
0x0100   128MB __net
0x0100   256MB __system
0x0100   512MB __sysconf
0x0100  1024MB __common
asommer70 commented 5 years ago

Also, @uyjulian and @TheMuso thanks for your replies and help :1st_place_medal:

uyjulian commented 5 years ago

You might have invalid partitions, so initialized yes will wipe and format everything

asommer70 commented 5 years ago

@uyjulian still getting the errors after doing the initialize yes:

# initialize yes
# mount __common
pfs: Error: Invalid magic/version
(!) hdd0:__common: Input/output error.
(!) Exit code is -5.

Also, I can't create a new partition, or folder, if I put the drive into the PS2 and use the HDDManager app.

ParzivalWolfram commented 5 years ago

@uyjulian still getting the errors after doing the initialize yes:

# initialize yes
# mount __common
pfs: Error: Invalid magic/version
(!) hdd0:__common: Input/output error.
(!) Exit code is -5.

Also, I can't create a new partition, or folder, if I put the drive into the PS2 and use the HDDManager app.

Low-level test the drive with the appropriate manufacturer's tool (example: Seagate and some others that are rebranded Seagate drives: use Seatools (Windows, DOS, Bootable (direct download).) You can easily find the right tester for your drive with a quick Google search, but if there isn't one, Seatools will still work for it.

Check if S.M.A.R.T. is tripped, then perform a Short DST (if applicable), then a Short Generic, then a Long Generic. (If the first passes, it's always good to do another Long Generic, but it's not necessary.) If any of them fail, raw copy the entire drive to some file with something like dd or dd4win, then replace it.

asommer70 commented 5 years ago

@ParzivalWolfram thanks, I'll definitely do those checks on the drive. I did try the pfsshell initialize yes on a 2nd drive and am getting the same errors when trying to create a partition, mount a partition, etc.

If I create the partitions using the HDDManager app in uLaunchELF psshell can mount the drive just fine.

I'll do some more testing and open another ticket if necessary since the original compile bug seems to be working fixed.

TheMuso commented 5 years ago

How are you connecting your drives to your PC?

asommer70 commented 5 years ago

Using a SATA to USB adapter. One drive is 120G and the other is 160G.

On Mon, Mar 11, 2019, 5:06 PM TheMuso notifications@github.com wrote:

How are you connecting your drives to your PC?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/uyjulian/pfsshell/issues/3#issuecomment-471729753, or mute the thread https://github.com/notifications/unsubscribe-auth/ADOjIOz90icpSirG3MMRFt7iX_ttsPyAks5vVsU8gaJpZM4YDP_B .

asommer70 commented 5 years ago

Ok, I feel like a dummy.

After digging into the code, I realized that you need to do mkfs after the initialize yes command to create the partitions. Once I did mkfs __common I could successfully mount __common and copy files.

After some more digging I realized that mkpart __.POPS 8192 won't work because the max partition size is 4096. So doing mkpart __.POPS 4096 works absolutely fine. Also, sizes of 2048 and 1024 work fine too.

What I'm experiencing now is that when using pfsshell to create a partition it doesn't show up in the uLaunchELF file browser and I'm not sure why? I can see the partition in the uLaunchELF HDDManager app, but it doesn't show up in the partition list and I can't copy files into it on the PS2 (copying files using pfsshell works fine).

Is there another command I'm missing?

Thanks again everyone for you help, I really appreciate it!

asommer70 commented 5 years ago

I experimented some more and creating a test partition works and I am able to view it in uLaunchELF. I also tried a __POPS partition instead of the documented "__.POPS" partition thinking maybe the period character is causing a problem, but neither appears in uLauchELF.

So pfsshell seems to be working fine and the problem is that uLauchELF doesn't recognize partitions starting with '_' (or maybe '').

Anyone have any ideas why that may be? Just curious I know this issue has gotten pretty off topic from the original compile problem.

I really appreciate the help though, thanks again!

uyjulian commented 5 years ago

Not sure. This is the code for listing the partitions in uLaunchELF: https://github.com/AKuHAK/uLaunchELF/blob/8b4d00e47279a9eecb8d66888ba3bc247b41c6f0/filer.c#L653

Are you sure you have latest version of uLaunchELF from http://akuhak.github.io/test_build ?

asommer70 commented 5 years ago

@uyjulian thanks so much for the links. My uLaunchELF is 4.43a which looks newer than the one in the test_build...

Either way I copied the BOOT.ELF to the PS2 and after booting I can now see the __.POPS directory in uLaunchELF!!! Woo!

Not exactly sure why changing the boot.elf fixed viewing the __.POPS directory, but things seem to be coming along. Still not able to run PS1 games from HD, but that's another issue.

Thanks again!

asommer70 commented 5 years ago

Last question (I think). Does the latest pfsshell run, or compile, on Windows? If so is there steps for doing that?

Super thanks again everyone for all your help and patience. I'm a PS2 modding noob as you can probably tell :+1:

TheMuso commented 5 years ago

On Thu, Mar 14, 2019 at 01:37:48PM AEDT, Adam Sommer wrote:

Last question (I think). Does the latest pfsshell run, or compile, on Windows? If so is there steps for doing that?

It may run under the Windows 10 Linux environment, or cygwin, but from what I've seen in the code, it is only written for UNIX-like operating systems, the focus being Linux and macOS.

uyjulian commented 5 years ago

It cross compiles for Windows using mingw, but currently it can not access real disks, only disk images.

uyjulian commented 4 years ago

Solution from #11 merged. Closing.