Skip to content

Conversation

phcoder
Copy link
Contributor

@phcoder phcoder commented May 30, 2022

Unlike my previous attempt with big-endian this one minimizes code changes and instead fixes structs. Only chunk size and sound register needed special handling beyond structure change

@phcoder phcoder force-pushed the osx-ppc-rb-main branch 3 times, most recently from 396cef5 to 62f3ce3 Compare May 30, 2022 10:06
rotate &= 0b11;
flip &= 0b11;
rotate &= 3;
flip &= 3;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are changes like this necessary at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OSX PPC default compiler is gcc 4.2 which doesn't support binary notation. Other than normal int a solution could be to have defines for BINARY_11 and similar

bool b:1;
bool x:1;
bool y:1;
#if RETRO_IS_BIG_ENDIAN
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is there so much of this, as long as all the code is on the same endianness, can't the compiler just sort this out itself? Is the problem use code inside the VMs or?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problems arise from 2 sources:

  • Loading little-endian cartridge (few places)
  • Union between bit-field and plain types like u*. E.g. you can write through gamepads.first.x and read through gamepads.data. Then the result will depend on endianness unless we do those changes

@phcoder phcoder changed the title Support OSX PPC as libretro core Support OSX PPC, GameCube, Wii and WiiU as libretro core May 30, 2022
@phcoder
Copy link
Contributor Author

phcoder commented May 30, 2022

Added ngc/wii/wiiu as they are only a small patch on top of osx-ppc

@nesbox
Copy link
Owner

nesbox commented May 31, 2022

To be honest, I'm a little afraid of such changes, a lot of overhead for defining structures, isn't it?
Maybe we should add some unit testing for big endian support, to not break it accidentally in the future.
Also, Is it still in progress? if yes, pls convert it to draft.

phcoder and others added 15 commits May 31, 2022 18:10
Unlike my previous attempt this minimizes the changes to actual code.

Now solitaire.tic runs correctly. Only 2 fields were actually crossing
byte boundary and needed byte-swap handling or field-splitting. Others
were just a straight reorder of bitfields
Comment indicates that it's about SDL but this header is used
outside of SDL as well. Instead put it in SDL-specific files
@phcoder phcoder force-pushed the osx-ppc-rb-main branch from aa8eeb5 to 396b23d Compare May 31, 2022 16:14
@joshgoebel
Copy link
Collaborator

I'm also afraid of such huge patches for endianess. Are they no better solutions?

@phcoder
Copy link
Contributor Author

phcoder commented May 31, 2022

I'm also afraid of such huge patches for endianess. Are they no better solutions?

Unfortunately no. There are only 2 solutions here:

  1. ifdef to have 2 separate version of bitfields
  2. Eliminate bit-fields and use bitmasks

First one results in a smaller patch. But I can do second as well. I don't care which approach

@phcoder
Copy link
Contributor Author

phcoder commented May 31, 2022

To be honest, I'm a little afraid of such changes, a lot of overhead for defining structures, isn't it? Maybe we should add some unit testing for big endian support, to not break it accidentally in the future.

Where are the existing unit tests? Unit tests usually would catch big-endian issues as long as they are executed in big-endian environment.

Also, Is it still in progress? if yes, pls convert it to draft.

Not in progress. Pretty much finished.

@nesbox nesbox merged commit 681f18c into nesbox:main Jun 3, 2022
@nesbox
Copy link
Owner

nesbox commented Jun 3, 2022

THan you for your help, pls add yourself to the credits list.

@joshgoebel
Copy link
Collaborator

joshgoebel commented Dec 17, 2022

@phcoder Several bugs have been reported that seem likely to have originated here... would you be willing to triage and work on fixes for them perhaps? If so I can do a quick sweep and drop a short list here.

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

Successfully merging this pull request may close these issues.

3 participants