libretro / vice-libretro

Versatile Commodore 8-bit Emulator
GNU General Public License v2.0
40 stars 70 forks source link

PS3/PSL1GHT build fix #446

Closed crystalct closed 2 years ago

sonninnos commented 2 years ago

Thanks, but is there any chance that this could be done without polluting and changing the VICE codebase, deps and libretro-common, and if not possible, keep them as minimal and shared as possible?

Such as instead of 2 different sid.cc edits could it work with only adding it to types.h, which is included in sid.h, which is included in both of those .cc..?

vice.h is also included in every file, which includes our include/sysconfig.h.

Since the operation of updating the VICE codebase when the time comes gets more and more annoying with each separate edit not clearly defined with __LIBRETRO__..

crystalct commented 2 years ago

Sure! About sid.cc the problem is the use of functions log() and sin() that cause a compile error on old GCC. what do you prefer? ::std::log () ? or a define to to transform log() to ::std::log () ? or adding using namespace std;? All compatibles with all GCC versions. I dont see types.h inside sid.h ....

sonninnos commented 2 years ago

I have no other preferences, so do what you think is best, easiest and simplest.

I'm seeing types.h at line 34, but sid.h is also fine I guess since it already has __LIBRETRO__ stuff.

crystalct commented 2 years ago

using namespace std; is canonical and standard and, of course, works using all types of GCC. It can be used without #ifdef block then it's elegant, too.

sonninnos commented 2 years ago

Oh right I was looking at a wrong sid.h (under sid/ and not resid/)..

So looks like a better place for those additions would rather be in resid/resid-config.h and resid-dtv/residdtv-config.h, and inside __LIBRETRO__.

And please if those ioutil.c and cmdhd.h additions can't go elsewhere, at least put them inside __LIBRETRO__. ioutil.c includes archdep.h, which would be much much better, and does not need __LIBRETRO__.

crystalct commented 2 years ago

resid-dtv/residdtv-config.h done. ioutil.c done.

inside cmdhd.h there is a problem:

typedef struct cmdhd_context_s {
    char *myname;
    struct diskunit_context_s *mycontext;
    struct via_context_s *via9;
    struct via_context_s *via10;
    struct scsi_context_s *scsi;
    rtc_72421_t *rtc;
    uint8_t LEDs;
    uint32_t imagesize;
    uint32_t baselba;
    alarm_t *reset_alarm;
    struct disk_image_s *image;
    i8255a_state *i8255a;
    uint8_t i8255a_i[3];
    uint8_t i8255a_o[3];
    uint8_t scsi_dir;
    uint8_t preadyff;
} cmdhd_context_t;

typedef struct cmdhd_context_s cmdhd_context_t;

On GCC 4.x causes error:

./vice/src/drive/iec/cmdhd.h:66: error: redefinition of typedef 'cmdhd_context_t'
./vice/src/drive/iec/cmdhd.h:63: error: previous declaration of 'cmdhd_context_t' was here

Why double definition of cmdhd_context_t ?

sonninnos commented 2 years ago

Aye, it builds fine here without it, so maybe just put the redefinition inside #ifndef __LIBRETRO__.

sonninnos commented 2 years ago

Perfect, thanks!