Patch SDL2 in upstream to support System6

About BasiliskII, a 68k Mac emulator for Windows, MacOSX, and Linux that can run System 7.x through MacOS 8.1.

Moderators: Cat_7, Ronald P. Regensburg

Post Reply
User avatar
rickyzhang
Mac Mechanic
Posts: 193
Joined: Mon Sep 15, 2014 7:59 pm

Patch SDL2 in upstream to support System6

Post by rickyzhang »

24 bit ROM in System 6 only supports small tiny windows 512x342.

I patched SDL2 to support System 6. Now you can scale up the guest OS by SDL2 acceleration. A PR was sent to upstream.

Please check out my screen case here: https://youtu.be/br5Hjt9F6X4
There is an App for that!
https://github.com/rickyzhang82
User avatar
adespoton
Forum All-Star
Posts: 3075
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Patch SDL2 in upstream to support System6

Post by adespoton »

Thanks, Ricky!

I don't think that's actually correct that System 6 only supports 512x342 though -- using a Mac II ROM you should be able to get 800x600 under System 6 -- although I've had issues with specific point releases not behaving with 800x600. Then again, the Mac II isn't a "true" 24-bit system; it's a 24-bit system with some optional 32-bit extensions.

But yeah; a "clean" 24-bit ROM requires a 512x342 screen resolution unless you do what Mini vMac did and patch the display traps.
User avatar
rickyzhang
Mac Mechanic
Posts: 193
Joined: Mon Sep 15, 2014 7:59 pm

Re: Patch SDL2 in upstream to support System6

Post by rickyzhang »

512x342 is the guest OS resolution. Scaling up means for how the guest screen presents in the host OS.

Mini vmac is also 512x342 in guest os. But it can scale up 2x in the host.

My patch can scale up at any fractional factor by SDL2.

I am working on patching Macintosh SE 24 Bit ROM, where the memory is limited to 4 MiB.
There is an App for that!
https://github.com/rickyzhang82
User avatar
adespoton
Forum All-Star
Posts: 3075
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Patch SDL2 in upstream to support System6

Post by adespoton »

Ah; I think you misunderstood me. Mini vMac does the guest screen draw outside regular emulation memory, which means while the default size is 512x342, you can set the resolution to anything you want it to be, as long as Mini vMac has enough memory available. I have a bunch of mine set to 1280x720 for easy video capture/display; there's only a few OS versions from 0.97 to 6.0.8L that this doesn't work on.

But fractional scale factors in BII would be a wonderful addition nonetheless!
User avatar
rickyzhang
Mac Mechanic
Posts: 193
Joined: Mon Sep 15, 2014 7:59 pm

Re: Patch SDL2 in upstream to support System6

Post by rickyzhang »

That would be a hidden feature in mini VMac that I don't know.

I hit ctrl-h + m. I got 2x zoom on the guest OS. Can you explain what you do in mini VMAC?
There is an App for that!
https://github.com/rickyzhang82
emendelson
Forum All-Star
Posts: 1230
Joined: Tue Oct 14, 2008 12:12 am

Re: Patch SDL2 in upstream to support System6

Post by emendelson »

User avatar
rickyzhang
Mac Mechanic
Posts: 193
Joined: Mon Sep 15, 2014 7:59 pm

Re: Patch SDL2 in upstream to support System6

Post by rickyzhang »

I realized that's a compile flag rather than command options. This is new to me.
There is an App for that!
https://github.com/rickyzhang82
User avatar
adespoton
Forum All-Star
Posts: 3075
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Patch SDL2 in upstream to support System6

Post by adespoton »

Mini vMac was designed under the assumption that most people want mostly the same configuration every time they run their emulator... so vMac was refactored such that most options are set at compile time, with only a minimal set done at runtime. Pretty much everything to do with PRAM values is set at compile. This does, of course, mean that setting these values via control panels isn't going to do much, and nothing will survive a reboot. But it works, and keeps the emulator much more lightweight. One of the perks of this was being able to move the video memory outside the main guest heap, allowing for any screen resolution you want.
User avatar
rickyzhang
Mac Mechanic
Posts: 193
Joined: Mon Sep 15, 2014 7:59 pm

Re: Patch SDL2 in upstream to support System6

Post by rickyzhang »

I gave a try with different configuration like Mac SE and higher resolution. But it asked for donation, otherwise you can a demo.

I passed...

It is not that I don't respect his intellectual work. But I personally don't like the configuration in mini VMAC way's.

If you have 32bit ROM and 24bit ROM plus different resolution configuration, then you got a tons of binary files. It doesn't sound right to me.
There is an App for that!
https://github.com/rickyzhang82
User avatar
adespoton
Forum All-Star
Posts: 3075
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Patch SDL2 in upstream to support System6

Post by adespoton »

Ah; the trick is that the donation is for getting HIM to compile you a custom version. Compile it yourself, and there's no issue.

That said, the iOS version has reversed some of that, and lets you change some of the settings just by changing the config file instead of having to compile it in. It'd probably be pretty simple to take Mini vMac and roll a regular vMac from it again, if someone was so inclined.
User avatar
rickyzhang
Mac Mechanic
Posts: 193
Joined: Mon Sep 15, 2014 7:59 pm

Re: Patch SDL2 in upstream to support System6

Post by rickyzhang »

Mini vmac build system is quite unique. It is not autoconf or cmake.

The source code doesn’t include MacSE.
There is an App for that!
https://github.com/rickyzhang82
User avatar
rickyzhang
Mac Mechanic
Posts: 193
Joined: Mon Sep 15, 2014 7:59 pm

Re: Patch SDL2 in upstream to support System6

Post by rickyzhang »

I was wrong. The source code indeed includes MacSE emulator.

The building process is pretty smooth.
There is an App for that!
https://github.com/rickyzhang82
User avatar
rickyzhang
Mac Mechanic
Posts: 193
Joined: Mon Sep 15, 2014 7:59 pm

Re: Patch SDL2 in upstream to support System6

Post by rickyzhang »

adespoton wrote:Ah; I think you misunderstood me. Mini vMac does the guest screen draw outside regular emulation memory, which means while the default size is 512x342, you can set the resolution to anything you want it to be, as long as Mini vMac has enough memory available. I have a bunch of mine set to 1280x720 for easy video capture/display; there's only a few OS versions from 0.97 to 6.0.8L that this doesn't work on.

But fractional scale factors in BII would be a wonderful addition nonetheless!
Mini vmac indeed supports resolution other than 512x342 features in System 6 for my MacSE ROM. I'm going to port this screen hack to BII.

Thanks for pointing this hidden feature. I'd have never known this.
There is an App for that!
https://github.com/rickyzhang82
User avatar
adespoton
Forum All-Star
Posts: 3075
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Patch SDL2 in upstream to support System6

Post by adespoton »

Sounds great!

If you're porting hidden features, the next one on my list is LocalTalk support :)

I've always thought it should be possible to use Mini vMac's LocalTalk implementation to output over a virtual serial pipe, and then have MacIP or some other software-based LocalTalk bridge listening on a local pipe to bridge the result to Ethernet, thereby enabling BII and Mini vMac to talk to other virtual and real Macs.

Lots of moving parts to make this work fully, but some of the heavy lifting has already been done.

I believe pce/MacPlus already has a workable implementation too, as well as proper serial emulation, if you wanted another code base to port features from :)
User avatar
rickyzhang
Mac Mechanic
Posts: 193
Joined: Mon Sep 15, 2014 7:59 pm

Re: Patch SDL2 in upstream to support System6

Post by rickyzhang »

A PR was sent. Now SDL1, SDL2 and XWindows can set arbitrary resolution in System 6 guest OS.

See my screen cast demo:
https://youtu.be/aXzM8t_u3zI

I want to emulate the printer in Basilisk II. I need learn to write a printer driver in guest OS and output the bitmap format to the host.

This will make MacWrite and MacPaint great again.
There is an App for that!
https://github.com/rickyzhang82
User avatar
adespoton
Forum All-Star
Posts: 3075
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Patch SDL2 in upstream to support System6

Post by adespoton »

Sounds good; you might want to look at the Print2Pict chooser extension hosted by Gryphel; it sets up a virtual printer and outputs the 32-bit QuickDraw it receives to a PICT bitmap.
User avatar
rickyzhang
Mac Mechanic
Posts: 193
Joined: Mon Sep 15, 2014 7:59 pm

Re: Patch SDL2 in upstream to support System6

Post by rickyzhang »

Sweet. :cool:

The more I talk to you, the more I find the gems I missed.
There is an App for that!
https://github.com/rickyzhang82
User avatar
adespoton
Forum All-Star
Posts: 3075
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Patch SDL2 in upstream to support System6

Post by adespoton »

I also recall that someone (somehow) took the work done in print2pict and created print2pdf back in the day. But this methhod was a lot more convoluted; I think they may have used one of the LaserWriter extensions that was in the DDK at the time to generate postscriipt and then wrapped it in a basic PDF 1.2 wrapper, using the ideas from Print2Pict to handle the virtual printer and QuickDraw bits. Unfortunately, I can't find any of the sample source code I remember playing with back around 1996-1999 that managed these things.
User avatar
rickyzhang
Mac Mechanic
Posts: 193
Joined: Mon Sep 15, 2014 7:59 pm

Re: Patch SDL2 in upstream to support System6

Post by rickyzhang »

My goal is not that ambitious. I want to print2bitmap and print2text.

I'm looking for a sample printer driver source code. I got inside macintosh volume ready. It should be a fun project.
There is an App for that!
https://github.com/rickyzhang82
Post Reply