MacOSX/OSX/macOS 64-bit build for testing
Moderators: Cat_7, Ronald P. Regensburg, ClockWise
Re: MacOSX/OSX/macOS 64-bit build for testing
This is really amazing! Having a 64-bit Sheepshaver with SDL2 and all the other features is great.
SDL2 still has a few bugs, particularly with memory handling. I've been testing a number of games, and on my machine (MacBook Pro running 10.13.5), the screen fails to update in most games until I move the mouse around a lot. In certain cases, like Warcraft II, everything plays fine at first but always crashes after a few minutes with a malloc free error.
It probably will take some time and familiarity with SDL2 to debug, but my preliminary tests have found that it is always a double free or freeing a non-existent pointer error. The two places where it can happen are calls to SDL functions: SDL_BlitSurface on line 878 of video_sdl2.cpp and SDL_SetSurfacePalette on line 1083 of video_sdl2.cpp.
Maybe it's just me encountering this problem, but I'll try to debug further anyways.
Thanks to all the contributors and maintainers for keeping SheepShaver alive
SDL2 still has a few bugs, particularly with memory handling. I've been testing a number of games, and on my machine (MacBook Pro running 10.13.5), the screen fails to update in most games until I move the mouse around a lot. In certain cases, like Warcraft II, everything plays fine at first but always crashes after a few minutes with a malloc free error.
It probably will take some time and familiarity with SDL2 to debug, but my preliminary tests have found that it is always a double free or freeing a non-existent pointer error. The two places where it can happen are calls to SDL functions: SDL_BlitSurface on line 878 of video_sdl2.cpp and SDL_SetSurfacePalette on line 1083 of video_sdl2.cpp.
Maybe it's just me encountering this problem, but I'll try to debug further anyways.
Thanks to all the contributors and maintainers for keeping SheepShaver alive
-
- Forum All-Star
- Posts: 1726
- Joined: Tue Oct 14, 2008 12:12 am
Re: MacOSX/OSX/macOS 64-bit build for testing
It might be good to add this option to the Preferences pane someday, with a full explanation of the numbers. You've done more than enough work already, but I hope you might consider this also.kanjitalk755 wrote:I have appended "hotkey" keyword to preference item.
Conventionally hotkey is control key, you can now change it by adding "hotkey" keyword to pref file.Code: Select all
1: control(default) 2: option 3: control+option 4: command 5: control+command 6: option+command 7: control+option+command
And has anyone tried to build a Windows executable from kanjitalk755's excellent code?
-
- Apple Corer
- Posts: 239
- Joined: Thu Nov 09, 2017 12:06 pm
Re: MacOSX/OSX/macOS 64-bit build for testing
Specifically, what kind of problem is it?Ronald P. Regensburg wrote:The key between between Z key and the shift key does not register.
It turned out to be lack of mutex lock in video_sdl2.cpp. Fixed.Elyus wrote:It probably will take some time and familiarity with SDL2 to debug, but my preliminary tests have found that it is always a double free or freeing a non-existent pointer error. The two places where it can happen are calls to SDL functions: SDL_BlitSurface on line 878 of video_sdl2.cpp and SDL_SetSurfacePalette on line 1083 of video_sdl2.cpp.
Unfortunately, I don't interest in GUI improvements.emendelson wrote:It might be good to add this option to the Preferences pane someday, with a full explanation of the numbers. You've done more than enough work already, but I hope you might consider this also.
I hope someone else interests it.
My repo can be built not only macOS but also Linux(x86) and MinGW32/MSYS (not MSYS2).emendelson wrote:And has anyone tried to build a Windows executable from kanjitalk755's excellent code?
But Windows build crashes with JIT.
Also, BasiliskII can be built in same platforms. 64-bit JIT of BasiliskII is not implemented.
- Ronald P. Regensburg
- Expert User
- Posts: 7835
- Joined: Thu Feb 09, 2006 10:24 pm
- Location: Amsterdam, Netherlands
Re: MacOSX/OSX/macOS 64-bit build for testing
kanjitalk755 wrote:Specifically, what kind of problem is it?Ronald P. Regensburg wrote:The key between between Z key and the shift key does not register.
This key does not do anything. Nothing happens when I press it. In Dutch and in most English keyboard layouts this key produces ` (grave accent, UTF-8 0x60) and with shift key ~ (tilde, UTF-8 0x7E). With option pressed, it is a 'dead' key that gives the grave accent to the next typed letter, like this: è.
In builds from cebix-macemu this all works as expected. In builds from your source the key does nothing. This key is not much used, but without the grave accent it is difficult to write for instance French text on a regular QWERTY keyboard.
-
- Apple Corer
- Posts: 239
- Joined: Thu Nov 09, 2017 12:06 pm
Re: MacOSX/OSX/macOS 64-bit build for testing
I don't have that type of keyboard.
Can you cooperate with debugging?
1) Set "Build Configuration" to Debug.
2) Set breakpoint at video_sdl2.cpp#L18943) Run.
4) Press the key.
5) Tell me value of ks.sym.
Can you cooperate with debugging?
1) Set "Build Configuration" to Debug.
2) Set breakpoint at video_sdl2.cpp#L1894
Code: Select all
switch (ks.sym) {
4) Press the key.
5) Tell me value of ks.sym.
Re: MacOSX/OSX/macOS 64-bit build for testing
Thanks, kanjitalk755! I was messing around with SDL mutexes a bit last night after tumbling to a similar conclusion -- the mutex lock present was not protecting surface->map->table from being freed multiple times. The mutex locks you've added seem to fix the memory problems, and it runs smoothly now. You are very familiar with the code and a fast bug-patcherkanjitalk755 wrote: It turned out to be lack of mutex lock in video_sdl2.cpp. Fixed.
When you have a chance, would you be willing to look at the "update_display_static_bbox" function? There's some error in calculating if a box is dirty, which is why most games are loading to a black screen until the mouse is moved. The quick fix is to initialize dirty = true, and force every box to update every time. It's a small hack that has a minimal impact on energy usage (on average, one or two more cpu wakes/second according to Xcode), but I'm wondering if there's a better solution.
- Ronald P. Regensburg
- Expert User
- Posts: 7835
- Joined: Thu Feb 09, 2006 10:24 pm
- Location: Amsterdam, Netherlands
Re: MacOSX/OSX/macOS 64-bit build for testing
Where? How? In the Debug menu I see four different Breakpoint items.kanjitalk755 wrote:1) Set "Build Configuration" to Debug.
2) Set breakpoint at video_sdl2.cpp#L1894
Where do I enter that?Code: Select all
switch (ks.sym) {
Re: MacOSX/OSX/macOS 64-bit build for testing
If you're using Xcode, you should be able to open video_sdl2.cpp in the file browser and just click in the margin by the switch command to set a breakpoint. If you're building for debug/testing, when you press the play button, it should stop and open the visual debugger whenever you hit a key. At least, that's what worked for me. This is what I see when I press the "z" key.
- Ronald P. Regensburg
- Expert User
- Posts: 7835
- Joined: Thu Feb 09, 2006 10:24 pm
- Location: Amsterdam, Netherlands
Re: MacOSX/OSX/macOS 64-bit build for testing
Well, I finally got it. I had to struggle through issues that probably should be obvious, but are not obvious to someone who does this for the first time.
The prefs file needed to use full paths, otherwise SheepShaver would not run.
The key needed to be pressed while SheepShaver was in front, not while Xcode was in front.
Anyway, the image shows the result when the problem key (not the "z" key, but the key to the left of the "z" key) was pressed:
The prefs file needed to use full paths, otherwise SheepShaver would not run.
The key needed to be pressed while SheepShaver was in front, not while Xcode was in front.
Anyway, the image shows the result when the problem key (not the "z" key, but the key to the left of the "z" key) was pressed:
Re: MacOSX/OSX/macOS 64-bit build for testing
Ah, good point, the prefs file caused me trouble too since I typically use sheepvms. Actually, it should be possible to debug against sheepvms if you add an argument to the build scheme, but it doesn't seem beneficial for simple tests.Ronald P. Regensburg wrote:Well, I finally got it. I had to struggle through issues that probably should be obvious, but are not obvious to someone who does this for the first time.
The prefs file needed to use full paths, otherwise SheepShaver would not run.
The key needed to be pressed while SheepShaver was in front, not while Xcode was in front.
Anyway, the image shows the result when the problem key (not the "z" key, but the key to the left of the "z" key) was pressed:
That's an interesting key code. From your earlier image, the key looks like a US backquote, but the SDL type is non-US backslash. I wonder if the desired behavior is backquote or backslash, respectively 0x0a or 0x2a? That might be something to test as well. If you want to try it firsthand, you could add the following case and check "0a" or "2a" in place of the ##:
Code: Select all
case 167: return 0x##; // non-us backslash
-
- Forum All-Star
- Posts: 1726
- Joined: Tue Oct 14, 2008 12:12 am
Re: MacOSX/OSX/macOS 64-bit build for testing
That keystroke is listed in SDL_scancode.h in the SDL2 source:
SDL_SCANCODE_NONUSBACKSLASH = 100, /**< This is the additional key that ISO
* keyboards have over ANSI ones,
* located between left shift and Y.
* Produces GRAVE ACCENT and TILDE in a
* US or UK Mac layout, REVERSE SOLIDUS
* (backslash) and VERTICAL LINE in a
* US or UK Windows layout, and
* LESS-THAN SIGN and GREATER-THAN SIGN
* in a Swiss German, German, or French
* layout. */
I don't know how to make any use of this, unfortunately. But it seems that you could enable that key by adding the SDL2 source to the project (as kanjitalk755 explained in another post) and then modifying SDL_keycode.h, perhaps like this:
SDLK_NONUSBACKSLASH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_NONUSBACKSLASH),
But I can't guess where you would go from there...
SDL_SCANCODE_NONUSBACKSLASH = 100, /**< This is the additional key that ISO
* keyboards have over ANSI ones,
* located between left shift and Y.
* Produces GRAVE ACCENT and TILDE in a
* US or UK Mac layout, REVERSE SOLIDUS
* (backslash) and VERTICAL LINE in a
* US or UK Windows layout, and
* LESS-THAN SIGN and GREATER-THAN SIGN
* in a Swiss German, German, or French
* layout. */
I don't know how to make any use of this, unfortunately. But it seems that you could enable that key by adding the SDL2 source to the project (as kanjitalk755 explained in another post) and then modifying SDL_keycode.h, perhaps like this:
SDLK_NONUSBACKSLASH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_NONUSBACKSLASH),
But I can't guess where you would go from there...
Last edited by emendelson on Fri Jun 29, 2018 1:22 am, edited 1 time in total.
-
- Forum All-Star
- Posts: 1726
- Joined: Tue Oct 14, 2008 12:12 am
Re: MacOSX/OSX/macOS 64-bit build for testing
Ronald,
Could you test whether kanjitalk755's build based on SDL1.2 (from earlier this month) supports that key? If you don't still have one of those builds, let me know and I'll send a link via PM.
Could you test whether kanjitalk755's build based on SDL1.2 (from earlier this month) supports that key? If you don't still have one of those builds, let me know and I'll send a link via PM.
- Ronald P. Regensburg
- Expert User
- Posts: 7835
- Joined: Thu Feb 09, 2006 10:24 pm
- Location: Amsterdam, Netherlands
Re: MacOSX/OSX/macOS 64-bit build for testing
Well, it depends on the languages and the keyboard you use, I suppose. I use that key regularly, though not often, for the grave accent and I cannot do without it. The key has been on any Apple keyboard I used since 1995. Always keyboards with Dutch layout.emendelson wrote:I don't know how to make any use of this, unfortunately. But it seems that you could enable that key by adding the SDL2 source to the project (as kanjitalk755 explained in another post)
* Let's wait for kanjitalk755 to respond. He is the one who asked me to help debugging this issue as his keyboard does not have that key. *
I do not have that one anymore. I could dig into my Time Machine, but sending me a link is easier.emendelson wrote:Ronald,
Could you test whether kanjitalk755's build based on SDL1.2 (from earlier this month) supports that key? If you don't still have one of those builds, let me know and I'll send a link via PM.
-
- Forum All-Star
- Posts: 1726
- Joined: Tue Oct 14, 2008 12:12 am
- Ronald P. Regensburg
- Expert User
- Posts: 7835
- Joined: Thu Feb 09, 2006 10:24 pm
- Location: Amsterdam, Netherlands
Re: MacOSX/OSX/macOS 64-bit build for testing
In the earlier SDL1.2 build from kanjitalk755/macemu source the key works as expected.
-
- Apple Corer
- Posts: 239
- Joined: Thu Nov 09, 2017 12:06 pm
Re: MacOSX/OSX/macOS 64-bit build for testing
I couldn't reproduce the issue.Elyus wrote:When you have a chance, would you be willing to look at the "update_display_static_bbox" function? There's some error in calculating if a box is dirty, which is why most games are loading to a black screen until the mouse is moved. The quick fix is to initialize dirty = true, and force every box to update every time. It's a small hack that has a minimal impact on energy usage (on average, one or two more cpu wakes/second according to Xcode), but I'm wondering if there's a better solution.
But I noticed display must be redrawn when palette is changed.
Is your problem resolved with new code?
@Ronald
I have appended "167" key.
BTW, you can use "keycodes" file in SDL2 version, too.
A sample is macemu/BasiliskII/src/SDL/keycodes.
I duplicated "sdl Quartz"(SDL1) to "sdl cocoa"(SDL2).
But it's unusable because keymaps differ from SDL1.
I hope someone edits it correctly.
- Ronald P. Regensburg
- Expert User
- Posts: 7835
- Joined: Thu Feb 09, 2006 10:24 pm
- Location: Amsterdam, Netherlands
Re: MacOSX/OSX/macOS 64-bit build for testing
The key works works fine now. Thankskanjitalk755 wrote:@Ronald
I have appended "167" key.
I have always used the original keycodes file, also in the SDL2 version.BTW, you can use "keycodes" file in SDL2 version, too.
A sample is macemu/BasiliskII/src/SDL/keycodes.
Re: MacOSX/OSX/macOS 64-bit build for testing
Yes! That seems to have fixed it. It's strange no one else was experiencing it, but I'm happy it's fixed. Thank you! :Dkanjitalk755 wrote: I couldn't reproduce the issue.
But I noticed display must be redrawn when palette is changed.
Is your problem resolved with new code?
-
- Forum All-Star
- Posts: 1726
- Joined: Tue Oct 14, 2008 12:12 am
Re: MacOSX/OSX/macOS 64-bit build for testing
Hello again,kanjitalk755 wrote:Also, BasiliskII can be built in same platforms. 64-bit JIT of BasiliskII is not implemented.
Probably this should be in the BasiliskII forum, but I knew that you visit here.
Your BasiliskII build is stable and fast. Thank you! Here is one request: the unix executable does not seem to work with the -config command-line parameter. I use an application that creates preference file, then launches the unix executable with the parameter --config prefsfilename
The --config option seems to be in the code (in main_unix.cpp) but the program doesn't use it - or at least I can't make this work.
This doesn't work with your build. It always opens the setup specified in ~/.basilisk_ii_prefs. Is it possible to fix this? Thank you again!
-
- Apple Corer
- Posts: 239
- Joined: Thu Nov 09, 2017 12:06 pm
Re: MacOSX/OSX/macOS 64-bit build for testing
Fixed.emendelson wrote:The --config option seems to be in the code (in main_unix.cpp) but the program doesn't use it - or at least I can't make this work.
-
- Forum All-Star
- Posts: 1726
- Joined: Tue Oct 14, 2008 12:12 am
Re: MacOSX/OSX/macOS 64-bit build for testing
Perfect! Thank you!kanjitalk755 wrote:Fixed.emendelson wrote:The --config option seems to be in the code (in main_unix.cpp) but the program doesn't use it - or at least I can't make this work.
- Ronald P. Regensburg
- Expert User
- Posts: 7835
- Joined: Thu Feb 09, 2006 10:24 pm
- Location: Amsterdam, Netherlands
Re: MacOSX/OSX/macOS 64-bit build for testing
@ kanjitalk755
It appears that another key is not working properly in SheepShaver 2.5:
The Caps Lock key behaves as the shift key, you need to keep it pressed to type capital letters.
Shall I perform the same debug procedure as with the previous failing key?
Edit: The sdl2 port of BasiliskII has the same issue.
It appears that another key is not working properly in SheepShaver 2.5:
The Caps Lock key behaves as the shift key, you need to keep it pressed to type capital letters.
Shall I perform the same debug procedure as with the previous failing key?
Edit: The sdl2 port of BasiliskII has the same issue.
Last edited by Ronald P. Regensburg on Tue Jul 10, 2018 2:25 pm, edited 1 time in total.
Reason:
Reason:
-
- Apple Corer
- Posts: 239
- Joined: Thu Nov 09, 2017 12:06 pm
Re: MacOSX/OSX/macOS 64-bit build for testing
I have fixed the issue, but it is incomplete.Ronald P. Regensburg wrote:It appears that another key is not working properly in SheepShaver 2.5:
The Caps Lock key behaves as the shift key, you need to keep it pressed to type capital letters
The LED status of caps lock key may reflect to uppercase/lowercase incorrectly.
- Ronald P. Regensburg
- Expert User
- Posts: 7835
- Joined: Thu Feb 09, 2006 10:24 pm
- Location: Amsterdam, Netherlands
Re: MacOSX/OSX/macOS 64-bit build for testing
Thanks again.kanjitalk755 wrote:I have fixed the issueRonald P. Regensburg wrote:It appears that another key is not working properly in SheepShaver 2.5:
The Caps Lock key behaves as the shift key, you need to keep it pressed to type capital letters
This only happens when SheepShaver (and BasiliskII) is started with the LED on (uppercase status). One press on the caps lock key suffices to make it work as expected and uppercase/lowercase typing then continues to reflect the LED status indication correctly.but it is incomplete.
The LED status of caps lock key may reflect to uppercase/lowercase incorrectly.
Do you know if the SDL 1.2 versions somehow read the caps lock status when the apps are launched?
Last edited by Ronald P. Regensburg on Wed Jul 11, 2018 12:41 pm, edited 1 time in total.
Reason:
Reason:
-
- Apple Corer
- Posts: 239
- Joined: Thu Nov 09, 2017 12:06 pm
Re: MacOSX/OSX/macOS 64-bit build for testing
On launching, the SDL1.2 generates a keydown event of caps lock if necessary.Ronald P. Regensburg wrote:Do you know if the SDL 1.2 versions somehow read the caps lock status when the apps are launched?
But the SDL2.0 doesn't.
I tried similar action as SDL1.2, but failed.