Author Topic: ClassiCube porting thread  (Read 2056 times)

Lars

  • Hero Member
  • *****
  • Posts: 1281
  • Karma: +65/-0
    • View Profile
Re: Dive: Why does not this work
« Reply #15 on: April 22, 2024, 12:27:08 pm »
The samples seem to indicate that you are forbidden to drive screen updates in between calls WM_VRNDISABLED and WM_VRNENABLED. That is, there is a timespan where you are not allowed to blit anything to the screen, that means, the Classicube draw buffer function should do nothing during that timespan.
That in turn means, the proper point in time to call DiveSetupBlitter are WM_VRNDISABLED and WM_VRNENABLED. The "Remarks" section for DiveSetupBlitter even states that DiveSetupBlitter is "not intended to be called at high frequency".

This would be even more relevant for direct screen updates (that is, if you used DiveAcquireFrameBuffer / DiveDeacquireFrameBuffer / DiveSwitchBank / DiveCalcFrameBufferAddress and direct writes to the video aperture "ppFrameBuffer" as returned by DiveOpen) but for already mentioned reasons you should not do that anyways.

Still, it looks as if DIVE still needs to be notified via DiveSetupBlitter when WM_VRNDISABLED and WM_VRNENABLED are called for a specific window even if you do not do direct screen updates.

Jochen Schäfer

  • Sr. Member
  • ****
  • Posts: 347
  • Karma: +29/-0
    • View Profile
Re: Dive: Why does not this work
« Reply #16 on: April 22, 2024, 12:35:44 pm »
I wonder then, how SDL work then. There is not one mention of WM_VRN*. It just blits the whole SDL surface to the buffer (no direct VRAM access).

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4813
  • Karma: +101/-1
    • View Profile
Re: Dive: Why does not this work
« Reply #17 on: April 22, 2024, 05:26:38 pm »
I wonder then, how SDL work then. There is not one mention of WM_VRN*. It just blits the whole SDL surface to the buffer (no direct VRAM access).

Cairo does the same. A comment in the code,
Code: [Select]
* This function uses DIVE to write those portions of the surface identified
* by @rect directly to the screen buffer.  It only supports 32- or 24-bit
* full-color video modes.  To avoid painting overlapping or child windows,
* it must perform all of the visible-region calculations that GPI normally
* handles.  Despite this, it provides a significant improvement in speed
* compared to using GPI functions.

Jochen Schäfer

  • Sr. Member
  • ****
  • Posts: 347
  • Karma: +29/-0
    • View Profile
Re: Dive: Why does not this work
« Reply #18 on: April 25, 2024, 08:23:02 am »
Update: I got it working by setting up the RECTL in SETUP_BLITTER::pVisDstRects correctly.
Now, a picture is shown.

Lars

  • Hero Member
  • *****
  • Posts: 1281
  • Karma: +65/-0
    • View Profile
Re: Dive: Why does not this work
« Reply #19 on: April 25, 2024, 02:28:43 pm »
I suppose it should be:

 rect.xLeft = 0;
 rect.yTop = r.Height;
 rect.xRight = r.Width;
 rect.yBottom = 0;

because I assume that the coordinate system to be used is still the OS/2 PM coordinate system [bottom left is (0,0)], correct ?

By the way:
setupBlitter.lDstPosX          = 0;
setupBlitter.lDstPosY          = 0;

You would only ever set these to anything else if you blitted into a memory buffer (also allocated via DiveAllocImageBuffer) instead of to the screen. But maybe DIVE ignores this anyway if you specify DIVE_BUFFER_SCREEN as the destination blit buffer in "DiveBlitImage".
« Last Edit: April 25, 2024, 02:31:10 pm by Lars »

Jochen Schäfer

  • Sr. Member
  • ****
  • Posts: 347
  • Karma: +29/-0
    • View Profile
Re: Dive: Why does not this work
« Reply #20 on: April 25, 2024, 05:15:48 pm »
I now do a
Code: [Select]
WinGetWindowRect(hwndClient, &rect); and it works.

Jochen Schäfer

  • Sr. Member
  • ****
  • Posts: 347
  • Karma: +29/-0
    • View Profile
Re: ClassiCube porting thread
« Reply #21 on: April 25, 2024, 11:22:22 pm »
For the sound support, I open an audio device and created a Dart mixer.
As I understand it, I can only open one mixer and then have to mix different sound myself. Is this understanding correct, or is there a way to let OS/2 do the mixing.

KO Myung-Hun

  • Newbie
  • *
  • Posts: 19
  • Karma: +5/-0
    • View Profile
Re: ClassiCube porting thread
« Reply #22 on: April 27, 2024, 10:07:17 am »
Hi/2.

libkai can mixer multiple audio streams. How about consider it ?

KO Myung-Hun

Jochen Schäfer

  • Sr. Member
  • ****
  • Posts: 347
  • Karma: +29/-0
    • View Profile
Re: ClassiCube porting thread
« Reply #23 on: April 27, 2024, 09:57:10 pm »
Sure, I could use that. But I just wanted to understand DART.

KO Myung-Hun

  • Newbie
  • *
  • Posts: 19
  • Karma: +5/-0
    • View Profile
Re: ClassiCube porting thread
« Reply #24 on: April 29, 2024, 04:00:40 am »
DART itself support multiple streams with sharable mode if an audio driver supports it like SBLive!. Unfortunately, however, Uniaud does not support multiple streams. I'm not sure USB audio driver by Lars support it.

Lars

  • Hero Member
  • *****
  • Posts: 1281
  • Karma: +65/-0
    • View Profile
Re: ClassiCube porting thread
« Reply #25 on: April 29, 2024, 08:33:31 am »
USB audio does not support multiple streams in general as far as the standard goes.Effectively, it only has one isochronous streaming input pipe (and potentially an additional streaming output pipe for recording) and its capability is adjustable to the necessary bandwidth.
At least I have never seen an USB audio sound device that would provide more than one streaming input pipe.

Jochen Schäfer

  • Sr. Member
  • ****
  • Posts: 347
  • Karma: +29/-0
    • View Profile
Re: ClassiCube porting thread
« Reply #26 on: April 29, 2024, 09:46:12 am »
Thanks for explanations.

Another question: I assume, that sound buffers want its data in Little Endian layout. Am I correct?

Lars

  • Hero Member
  • *****
  • Posts: 1281
  • Karma: +65/-0
    • View Profile
Re: ClassiCube porting thread
« Reply #27 on: April 29, 2024, 11:51:24 am »
DART was IBM's half-baked effort to provide some sophsticated sound processing. What it ended up with is the ability to control streaming to an audio device largely by the application (instead of trusting the streaming manager). That's about it.

yes, you are correct, sound data always is in little endian format.

Jochen Schäfer

  • Sr. Member
  • ****
  • Posts: 347
  • Karma: +29/-0
    • View Profile
Re: ClassiCube porting thread
« Reply #28 on: May 03, 2024, 09:37:16 am »
So I'm getting along, but I noticed some behaviour, I can't explain and I haven't find any clue in the Toolkit help.
While in the Launcher window or while in Game window with the menu open, the pointer isn't captured, so ALT+F4 works.
But in Game window with the menu closed, the pointer is captured, and then ALT+F4 will not work, while other keypresses are sending WM_CHARs.
Has someone a hint, what is happpening here?

Lars

  • Hero Member
  • *****
  • Posts: 1281
  • Karma: +65/-0
    • View Profile
Re: ClassiCube porting thread
« Reply #29 on: May 03, 2024, 09:28:47 pm »
I can just guess but Alt+F4 is a special key combination (to close a window) that might not be passed on verbatim to the Window Procedure in the WM_CHAR message.

Maybe you have to catch the WM_TRANSLATEACCEL message and handle that special key combination there.

Or, reading the help for WM_CHAR, Alt-F4 might be translated into a WM_COMMAND or WM_SYSCOMMAND message (likely a WM_SYSCOMMAND message with uscmd = SC_CLOSE).
« Last Edit: May 03, 2024, 09:42:14 pm by Lars »