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

Enable SDL2 for Linux and Mac OS X #202

Merged
merged 8 commits into from
Jun 30, 2020

Conversation

rickyzhang82
Copy link
Contributor

I tested it the following configuration:

  • Fedora Linux 64 bit Core 32 with SDL1 (SDL-devel-1.2.15-43.fc32.x86_64)
  • Fedora Linux 64 bit Core 32 with SDL2 (SDL2-devel-2.0.12-1.fc32.x86_64)
  • Mac OS X 10.15.5 with SDL2
  • Mac OS X 10.13.6 with SDL1

All build without error and boot up fine with Mac OS 7.5

By default, without providing `with-sdl2` in configure it uses SDL1.
Users need to explicitly request SDL2.

Signed-off-by: Ricky Zhang <rickyzhang@gmail.com>
- video_sdl2 for Mac OS X requires MacOSX update.

Signed-off-by: Ricky Zhang <rickyzhang@gmail.com>
- In 8 bit color game, the hack crashed the app.
- After backing out the hack, I can play 256 color game with displaycolordepth 8.
- By default, the displaycolordepth is 0.

Signed-off-by: Ricky Zhang <rickyzhang@gmail.com>
Signed-off-by: Ricky Zhang <rickyzhang@gmail.com>
@rickyzhang82
Copy link
Contributor Author

rickyzhang82 commented Jun 27, 2020

Added CI to test both SDL1 and SDL2 in Linux

I haven't added Mac OS X CI because I'm not familiar with homebrew. I used macport in Mac OS X. Travis CI support homebrew out-of-the-box.

If anyone knows the BII dependencies of hombrew, please let me know. I'd like to add Mac OS X to CI, as well.

@rickyzhang82
Copy link
Contributor Author

@asvitkine Any reasons why it is not accepted? I'm working on a PR that make System 6 run again.

@asvitkine
Copy link
Collaborator

asvitkine commented Jun 27, 2020 via email

Remove the unused header.

Signed-off-by: Ricky Zhang <rickyzhang@gmail.com>
@rickyzhang82
Copy link
Contributor Author

The PR only address the build method from Linux and Mac OS X. It doesn't address XCode build or Windows build.

I compiled in Mac OS X through autoconf like the way I did in Linux.

To compile SDL1, use the configure:

./configure --enable-sdl-video --enable-sdl-audio --disable-vosf --disable-jit-compiler --with-x --with-gtk --with-mon

To compile SDL2, use the configure:

./configure --enable-sdl-video --enable-sdl-audio --disable-vosf --disable-jit-compiler --with-x --with-gtk --with-mon --with-sdl2

The build status is passed from Travis. See this link

Signed-off-by: Ricky Zhang <rickyzhang@gmail.com>
@rickyzhang82
Copy link
Contributor Author

Since you don't have permission to point Travis CI to this repo -- https://github.com/cebix/macemu/, I have to redirect the Travis build status to my upstream-master branch in my forked repo. I have to keep https://github.com/cebix/macemu/ branch in sync with upstream-master branch in my repo. This is a workaround.

Once you accept the PR, it will show the build status properly from my upstream-master branch.

BasiliskII/src/Unix/main_unix.cpp Outdated Show resolved Hide resolved
BasiliskII/src/Unix/main_unix.cpp Show resolved Hide resolved
BasiliskII/src/MacOSX/runtool.c Outdated Show resolved Hide resolved
BasiliskII/src/MacOSX/runtool.c Outdated Show resolved Hide resolved
BasiliskII/src/MacOSX/runtool.c Outdated Show resolved Hide resolved
BasiliskII/src/MacOSX/Info.plist Outdated Show resolved Hide resolved
BasiliskII/src/user_strings.cpp Outdated Show resolved Hide resolved
BasiliskII/src/user_strings.cpp Outdated Show resolved Hide resolved
BasiliskII/src/SDL/video_sdl.cpp Outdated Show resolved Hide resolved
BasiliskII/src/MacOSX/utils_macosx.mm Show resolved Hide resolved
Signed-off-by: Ricky Zhang <rickyzhang@gmail.com>
@rickyzhang82
Copy link
Contributor Author

SDL2 autoconf build in Mac OS X uses Apple metal backend, while in Linux SDL2 uses OpengGL.

I don't see any problem in my Linux SDl2. But in my iMac, I have random issue: 8 of 10 times, BII hangs during start up.

I opened an issue in kanijtalk755 repo: kanjitalk755#43

It seems that there is a bug in SDL2 in video control ROM patch. I'm still looking into it.

But the most important thing is that we should bring back people to the upstream repo rather than scatter the new feature everywhere. Given enough time and eyeballs, we can fix it.

The new SDL2 is parallel to the original SDL1 back end. Therefore, it didn't break any old platform or old configuration.

@rickyzhang82
Copy link
Contributor Author

I figured out what caused the hang. But this is a bug from long long time ago. It is not from me. I opened an issue in #203 to address it.

Using memory banks addressing can workaround it.

@rickyzhang82
Copy link
Contributor Author

@asvitkine Any road block from my side to accept the PR?

Signed-off-by: Ricky Zhang <rickyzhang@gmail.com>
@asvitkine asvitkine merged commit 16081b2 into cebix:master Jun 30, 2020
@rickyzhang82 rickyzhang82 deleted the pr-enable-sdl2 branch June 30, 2020 02:25
@asvitkine
Copy link
Collaborator

I was looking at the state of the BasiliskII Xcode project and looks it no longer builds due to changes in this PR. For example, a bunch of missing files are referenced.

But also, it's now set to use SDL2 which I believe doesn't work on 10.6. But it's an Xcode 3.2 project (i.e. for 10.6)!

I'm thinking of just reverting the changes to the Xcode project to how it was before (SDL1) to get it back to a working state. Unless you have different suggestions?

@rickyzhang82
Copy link
Contributor Author

@asvitkine

I don't recommend revert the support of SDL2. Since macOS Mojave 10.14 discontinue support of OpenGL, I can't run Basilisk II with SDL 1.2 after 10.14. SDL2 is my only way to get hardware acceleration with Metal works in Mac. If you revert SDL2 PR, it would break MacOS X build after 10.14.

For older Mac OS like 10.4 PPC, I stil could build BII with Makefile. So if you could not build with XCode, try Makefile approach. You may have to get build stack from MacPort first.

It is hard to keep XCode build up-to-date with the change of different version of XCode and Mac O.S X. I'd recommend keeping it up with Makefile build approach. Try Makefile approach in 10.6.

BTW, could you enable Travis build and add build status in README. We could have some basic build coverage test for different platform and arch (see https://travis-ci.org/github/rickyzhang82/macemu)

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