Create help menu under SDL2?

About SheepShaver, a PPC Mac emulator for Windows, MacOS X, and Linux that can run System 7.5.3 to MacOS 9.0.4.

Moderators: Cat_7, Ronald P. Regensburg, ClockWise

Post Reply
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Create help menu under SDL2?

Post by emendelson »

For my SheepShaver projects, I've managed to build a custom top-line Help menu under SDL 1.2, using the syntax in the version of SDLMain.m linked below (my additions have "emendelson" in the comments). In order to use the Help menu, there also needs to be a Help folder in SheepShaver's resources, and references to it in SheepShaver's info.plist. It's a kludge, but it works.

http://www.columbia.edu/~em36/SDLMain.m

SheepShaver for SDL2 doesn't use SDLMain.m and I haven't been able to find out whether this kind of thing is possible at all under SDL2. I'm not sure anyone ever used the Help menus that I put together, but it was an interesting challenge to make them work, and I'd like to figure out to do it under SDL2. Is there any expert here who might be able to point to sample code that gets the job done? Many thanks for any help.

EDIT: Somehow, autocorrect changed "out" to "outlaw"...
Last edited by emendelson on Mon Jun 18, 2018 9:04 pm, edited 1 time in total.
User avatar
adespoton
Forum All-Star
Posts: 4226
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Create help menu under SDL2?

Post by adespoton »

I used the help menus... I stuck some stuff in the help folder detailing the history of the OS emulated. It's nice to have that cleanly exposed :)

Unfortunately, I haven't really dug into SDL2 to that level, so I'm unsure of how to duplicate this.
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Create help menu under SDL2?

Post by emendelson »

adespoton wrote:I used the help menus... I stuck some stuff in the help folder detailing the history of the OS emulated. It's nice to have that cleanly exposed :)
Thank you!! It's very good to know that someone actually uses these things. This makes me want to look further into SDL2, but I've had no luck so far.

And could you spell out exactly what you did to add stuff to the help menu, and whether you were working in the SheepShaver Wrapper or Mac OS 9?? Thanks - this could be useful to other people too...
User avatar
adespoton
Forum All-Star
Posts: 4226
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Create help menu under SDL2?

Post by adespoton »

I can't remember the details offhand other than sticking or updating an RTF file in the help folder; it was in the Wrapper builds.
kanjitalk755
Apple Corer
Posts: 239
Joined: Thu Nov 09, 2017 12:06 pm

Re: Create help menu under SDL2?

Post by kanjitalk755 »

A sample code is here.

https://github.com/kanjitalk755/macemu/ ... _macosx.mm

See prefs_init() function.
In case SDL1, appending preferences menu.
In case SDL2, modifying preferences menu appended by SDL_Init().
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Create help menu under SDL2?

Post by emendelson »

Thank you! I will certainly try it.
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Create help menu under SDL2?

Post by emendelson »

I'm still working on adding a Help dropdown to the top-line menu. I think it requires working with main_menu.nib, but am not sure. If anyone has any experience with this kind of thing, I'll be glad to know about it.
kanjitalk755
Apple Corer
Posts: 239
Joined: Thu Nov 09, 2017 12:06 pm

Re: Create help menu under SDL2?

Post by kanjitalk755 »

SheepShaver project doesn't use NIB file of main menu.
Using SDL2, main menu all is built by code.
The function is CreateApplicationMenus() in following source.

https://github.com/SDL-mirror/SDL/blob/ ... oaevents.m
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Create help menu under SDL2?

Post by emendelson »

Thank you! That was exactly what I was looking for. I'll report results when I have any...
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Create help menu under SDL2?

Post by emendelson »

David Ludwig includes SDL2 as an external resource in his code, and I'm able to build his version by adding SDL source to the External folder in his code. (I can even launch it from the terminal by putting a ROM file in the same folder with the unix executable.)

David Ludwig's build has a menu with the View items (including a tab bar!), and I'm guessing that it might be possible to modify this menu in your build by adding SDL code in the same way that David Ludwig does, and then modifying SDL_cocoaevents.m. But if this is completely wrong, I hope someone will warn me.
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Create help menu under SDL2?

Post by emendelson »

Thanks to kanjitalk755 pointing me in the right direction, I've had some success building a Help menu for SheepShaver, modifying kanjitalk755's code. Here's a screen shot:

Image

When you click on Setup Guide, the guide in this forum opens in the browser.

It isn't a complete success, because when I click on SheepShaver Help, I get a window saying the content is not available, though the content is exactly the same (and with the same reference in the info.plist) as in one of my old builds where the Help displays correctly. I hope adespoton can help sort this out, as he's succeeded in putting new content in the help menu earlier.

Also, here's how I modified kanjitalk755's code. I removed the reference to SDL Framework, and added a reference to the SDL Xcode project, as in David Ludwig's code. I still haven't figured out how to make Xcode move the SDL framework (after building it) into the Contents/Frameworks folder in the SheepShaver app, so I did that by hand. Presumably an Xcode expert would know how to do this in seconds.

EDIT: I got the help working, and will post a build soon for anyone who might be interested.
Last edited by emendelson on Thu Jun 28, 2018 2:09 am, edited 1 time in total.
kanjitalk755
Apple Corer
Posts: 239
Joined: Thu Nov 09, 2017 12:06 pm

Re: Create help menu under SDL2?

Post by kanjitalk755 »

emendelson wrote:Also, here's how I modified kanjitalk755's code. I removed the reference to SDL Framework, and added a reference to the SDL Xcode project, as in David Ludwig's code. I still haven't figured out how to make Xcode move the SDL framework (after building it) into the Contents/Frameworks folder in the SheepShaver app, so I did that by hand. Presumably an Xcode expert would know how to do this in seconds.
In "Build Phases" of SheepShaver target:
1) Click "+" button at "Target Dependencies".
2) Specify SheepShaver_Xcode8/SDL/Framework.
3) Click "+" button at "Embed Frameworks".
4) Specify SheepShaver_Xcode8/external/SDL.xcode/Products/SDL2.framework.

How is it?
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Create help menu under SDL2?

Post by emendelson »

kanjitalk755 wrote:
emendelson wrote:Also, here's how I modified kanjitalk755's code. I removed the reference to SDL Framework, and added a reference to the SDL Xcode project, as in David Ludwig's code. I still haven't figured out how to make Xcode move the SDL framework (after building it) into the Contents/Frameworks folder in the SheepShaver app, so I did that by hand. Presumably an Xcode expert would know how to do this in seconds.
In "Build Phases" of SheepShaver target:
1) Click "+" button at "Target Dependencies".
2) Specify SheepShaver_Xcode8/SDL/Framework.
3) Click "+" button at "Embed Frameworks".
4) Specify SheepShaver_Xcode8/external/SDL.xcode/Products/SDL2.framework.

How is it?
Works perfectly! Thank you!
Post Reply