Skip to content

Commit

Permalink
x64 runtime fixes; main menu now functional with some errors
Browse files Browse the repository at this point in the history
  • Loading branch information
beholdnec committed Jun 21, 2022
1 parent 626d8e0 commit fb141c6
Show file tree
Hide file tree
Showing 17 changed files with 88 additions and 81 deletions.
2 changes: 1 addition & 1 deletion inc/srec.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class SREC : public SREC_PAR

bool _FOpenRecord();
bool _FCloseRecord();
static void _WaveInProc(HWAVEIN hwi, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2);
static void CALLBACK _WaveInProc(HWAVEIN hwi, UINT uMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2);

protected:
bool _FInit(long csampSec, long cchan, long cbSample, ulong dtsMax);
Expand Down
4 changes: 2 additions & 2 deletions kauai/src/appb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ bool APPB::FEnableAppCmd(PCMD pcmd, ulong *pgrfeds)
break;

case cidChooseWnd:
if ((HWND)pcmd->rglw[0] == GOB::HwndMdiActive())
if ((HWND)pcmd->rglp[0] == GOB::HwndMdiActive())
*pgrfeds |= fedsCheck;
else
*pgrfeds |= fedsUncheck;
Expand All @@ -536,7 +536,7 @@ bool APPB::FCmdChooseWnd(PCMD pcmd)
AssertThis(0);
AssertVarMem(pcmd);

GOB::MakeHwndActive((HWND)pcmd->rglw[0]);
GOB::MakeHwndActive((HWND)pcmd->rglp[0]);
return fTrue;
}

Expand Down
4 changes: 2 additions & 2 deletions kauai/src/appbwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ bool APPB::_FFrameWndProc(HWND hwnd, uint wm, WPARAM wParam, LPARAM lw, long *pl

pmmi = (MINMAXINFO *)lw;

*plwRet = DefFrameProc(hwnd, vwig.hwndClient, wm, wParam, (long)pmmi);
*plwRet = DefFrameProc(hwnd, vwig.hwndClient, wm, wParam, (LPARAM)pmmi);
dypFrame = GetSystemMetrics(SM_CYFRAME);
dypScreen = GetSystemMetrics(SM_CYSCREEN);
dypExtra = 0;
Expand All @@ -447,7 +447,7 @@ bool APPB::_FFrameWndProc(HWND hwnd, uint wm, WPARAM wParam, LPARAM lw, long *pl
dypExtra = GetSystemMetrics(SM_CYCAPTION);
pmmi->ptMaxPosition.y = -dypFrame - dypExtra;
pmmi->ptMaxSize.y = pmmi->ptMaxTrackSize.y = dypScreen + 2 * dypFrame + dypExtra;
_FCommonWndProc(hwnd, wm, wParam, (long)pmmi, &fullscreen);
_FCommonWndProc(hwnd, wm, wParam, (LPARAM)pmmi, &fullscreen);
}
return fTrue;

Expand Down
6 changes: 5 additions & 1 deletion kauai/src/cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ struct CMD
PCMH pcmh; // the target of the command - may be nil
long cid; // the command id
PGG pgg; // additional parameters for the command
long rglw[kclwCmd]; // standard parameters
union
{
long rglw[kclwCmd]; // standard parameters
LONG_PTR rglp[kclwCmd]; // standard parameters (pointer sized)
};
};
typedef CMD *PCMD;

Expand Down
6 changes: 3 additions & 3 deletions kauai/src/gobwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ HWND GOB::_HwndNewMdi(PSTN pstnTitle)
hwnd = CreateMDIWindow(PszLit("MDI"), pstnTitle->Psz(), lwStyle, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, vwig.hwndClient, vwig.hinst, 0L);
if (hNil != hwnd && pvNil != vpmubCur)
vpmubCur->FAddListCid(cidChooseWnd, (long)hwnd, pstnTitle);
vpmubCur->FAddListCid(cidChooseWnd, (LONG_PTR)hwnd, pstnTitle);
return hwnd;
}

Expand All @@ -148,7 +148,7 @@ void GOB::_DestroyHwnd(HWND hwnd)
if (GetParent(hwnd) == vwig.hwndClient && vwig.hwndClient != hNil)
{
if (pvNil != vpmubCur)
vpmubCur->FRemoveListCid(cidChooseWnd, (long)hwnd);
vpmubCur->FRemoveListCid(cidChooseWnd, (LONG_PTR)hwnd);
SendMessage(vwig.hwndClient, WM_MDIDESTROY, (WPARAM)hwnd, 0);
}
else
Expand Down Expand Up @@ -218,7 +218,7 @@ void GOB::SetHwndName(PSTN pstn)
}
if (pvNil != vpmubCur)
{
vpmubCur->FChangeListCid(cidChooseWnd, (long)_hwnd, pvNil, (long)_hwnd, pstn);
vpmubCur->FChangeListCid(cidChooseWnd, (LONG_PTR)_hwnd, pvNil, (LONG_PTR)_hwnd, pstn);
}
SetWindowText(_hwnd, pstn->Psz());
}
Expand Down
34 changes: 17 additions & 17 deletions kauai/src/mdev2pri.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ struct MH
byte *lpData;
DWORD dwBufferLength;
DWORD dwBytesRecorded;
DWORD dwUser;
DWORD_PTR dwUser;
DWORD dwFlags;
MH *lpNext;
DWORD reserved;
DWORD_PTR reserved;
DWORD dwOffset;
DWORD dwReserved[8];
DWORD_PTR dwReserved[4];
};
typedef MH *PMH;

Expand Down Expand Up @@ -171,7 +171,7 @@ class MSMIX : public MSMIX_PAR
void _WaitForBuffers(void);
void _SubmitBuffers(ulong tsCur);

static void _MidiProc(ulong luUser, void *pvData, ulong luData);
static void _MidiProc(ULONG_PTR luUser, void *pvData, ULONG_PTR luData);
void _Notify(void *pvData, PMDWS pmdws);

static ulong __stdcall _ThreadProc(void *pv);
Expand Down Expand Up @@ -202,7 +202,7 @@ class MSMIX : public MSMIX_PAR
/***************************************************************************
The midi stream interface.
***************************************************************************/
typedef void (*PFNMIDI)(ulong luUser, void *pvData, ulong luData);
typedef void (*PFNMIDI)(ULONG_PTR luUser, void *pvData, ULONG_PTR luData);

typedef class MISI *PMISI;
#define MISI_PAR BASE
Expand All @@ -214,15 +214,15 @@ class MISI : public MISI_PAR
protected:
HMS _hms; // the midi stream handle
PFNMIDI _pfnCall; // call back function
ulong _luUser; // user data to send back
ULONG_PTR _luUser; // user data to send back

// system volume level - to be saved and restored. The volume we set
// is always relative to this
tribool _tBogusDriver; // to indicate whether midiOutGetVolume really works
ulong _luVolSys;
long _vlmBase; // our current volume relative to _luVolSys.

MISI(PFNMIDI pfn, ulong luUser);
MISI(PFNMIDI pfn, ULONG_PTR luUser);

virtual bool _FOpen(void) = 0;
virtual bool _FClose(void) = 0;
Expand All @@ -239,7 +239,7 @@ class MISI : public MISI_PAR
virtual bool FActive(void);
virtual bool FActivate(bool fActivate);

virtual bool FQueueBuffer(void *pvData, long cb, long ibStart, long cactPlay, ulong luData) = 0;
virtual bool FQueueBuffer(void *pvData, long cb, long ibStart, long cactPlay, ULONG_PTR luData) = 0;
virtual void StopPlaying(void) = 0;
};

Expand Down Expand Up @@ -296,7 +296,7 @@ class WMS : public WMS_PAR
bool _fDone : 1; // tells the aux thread to terminate

MMRESULT(WINAPI *_pfnOpen)
(HMS *phms, LPUINT puDeviceID, DWORD cMidi, DWORD dwCallback, DWORD dwInstance, DWORD fdwOpen);
(HMS *phms, LPUINT puDeviceID, DWORD cMidi, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen);
MMRESULT(WINAPI *_pfnClose)(HMS hms);
MMRESULT(WINAPI *_pfnProperty)(HMS hms, LPBYTE lpb, DWORD dwProperty);
MMRESULT(WINAPI *_pfnPosition)(HMS hms, LPMMTIME lpmmt, UINT cbmmt);
Expand All @@ -305,7 +305,7 @@ class WMS : public WMS_PAR
MMRESULT(WINAPI *_pfnRestart)(HMS hms);
MMRESULT(WINAPI *_pfnStop)(HMS hms);

WMS(PFNMIDI pfn, ulong luUser);
WMS(PFNMIDI pfn, ULONG_PTR luUser);
bool _FInit(void);

virtual bool _FOpen(void);
Expand All @@ -316,22 +316,22 @@ class WMS : public WMS_PAR
long _CmhSubmitBuffers(void);
void _ResetStream(void);

static void __stdcall _MidiProc(HMS hms, ulong msg, ulong luUser, ulong lu1, ulong lu2);
static void CALLBACK _MidiProc(HMS hms, UINT msg, DWORD_PTR luUser, DWORD_PTR lu1, DWORD_PTR lu2);
void _Notify(HMS hms, PMH pmh);

static ulong __stdcall _ThreadProc(void *pv);
ulong _LuThread(void);

public:
static PWMS PwmsNew(PFNMIDI pfn, ulong luUser);
static PWMS PwmsNew(PFNMIDI pfn, ULONG_PTR luUser);
~WMS(void);

#ifdef STREAM_BUG
virtual bool FActive(void);
virtual bool FActivate(bool fActivate);
#endif // STREAM_BUG

virtual bool FQueueBuffer(void *pvData, long cb, long ibStart, long cactPlay, ulong luData);
virtual bool FQueueBuffer(void *pvData, long cb, long ibStart, long cactPlay, ULONG_PTR luData);
virtual void StopPlaying(void);
};

Expand All @@ -355,7 +355,7 @@ class OMS : public OMS_PAR
long ibStart;
long cactPlay;

ulong luData;
ULONG_PTR luData;
};

MUTX _mutx;
Expand All @@ -372,7 +372,7 @@ class OMS : public OMS_PAR
PMEV _pmevLim;
ulong _tsCur;

OMS(PFNMIDI pfn, ulong luUser);
OMS(PFNMIDI pfn, ULONG_PTR luUser);
bool _FInit(void);

virtual bool _FOpen(void);
Expand All @@ -383,10 +383,10 @@ class OMS : public OMS_PAR
void _ReleaseBuffers(void);

public:
static POMS PomsNew(PFNMIDI pfn, ulong luUser);
static POMS PomsNew(PFNMIDI pfn, ULONG_PTR luUser);
~OMS(void);

virtual bool FQueueBuffer(void *pvData, long cb, long ibStart, long cactPlay, ulong luData);
virtual bool FQueueBuffer(void *pvData, long cb, long ibStart, long cactPlay, ULONG_PTR luData);
virtual void StopPlaying(void);
};

Expand Down
6 changes: 3 additions & 3 deletions kauai/src/menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ class MUB : public MUB_PAR
virtual void EnqueueWcid(long wcid);
#endif // WIN

virtual bool FAddListCid(long cid, long lw0, PSTN pstn);
virtual bool FRemoveListCid(long cid, long lw0, PSTN pstn = pvNil);
virtual bool FChangeListCid(long cid, long lwOld, PSTN pstnOld, long lwNew, PSTN pstnNew);
virtual bool FAddListCid(long cid, LONG_PTR lw0, PSTN pstn);
virtual bool FRemoveListCid(long cid, LONG_PTR lw0, PSTN pstn = pvNil);
virtual bool FChangeListCid(long cid, LONG_PTR lwOld, PSTN pstnOld, LONG_PTR lwNew, PSTN pstnNew);
virtual bool FRemoveAllListCid(long cid);
};

Expand Down
6 changes: 3 additions & 3 deletions kauai/src/menuwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ void MUB::EnqueueWcid(long wcid)
Adds an item identified by the given list cid, long parameter
and string.
***************************************************************************/
bool MUB::FAddListCid(long cid, long lw0, PSTN pstn)
bool MUB::FAddListCid(long cid, LONG_PTR lw0, PSTN pstn)
{
AssertThis(0);
AssertPo(pstn, 0);
Expand Down Expand Up @@ -242,7 +242,7 @@ bool MUB::FAddListCid(long cid, long lw0, PSTN pstn)
or string. If pstn is non-nil, it is used to find the item.
If pstn is nil, lw0 is used to identify the item.
***************************************************************************/
bool MUB::FRemoveListCid(long cid, long lw0, PSTN pstn)
bool MUB::FRemoveListCid(long cid, LONG_PTR lw0, PSTN pstn)
{
AssertThis(0);
AssertNilOrPo(pstn, 0);
Expand Down Expand Up @@ -435,7 +435,7 @@ bool MUB::FRemoveAllListCid(long cid)
lwNew is set as the new long parameter and if pstnNew is non-nil,
it is used as the new menu item text.
***************************************************************************/
bool MUB::FChangeListCid(long cid, long lwOld, PSTN pstnOld, long lwNew, PSTN pstnNew)
bool MUB::FChangeListCid(long cid, LONG_PTR lwOld, PSTN pstnOld, LONG_PTR lwNew, PSTN pstnNew)
{
AssertThis(0);
AssertNilOrPo(pstnOld, 0);
Expand Down
28 changes: 14 additions & 14 deletions kauai/src/mididev2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -580,8 +580,8 @@ bool MSMIX::_FInit(void)
return fFalse;
_pglmsos->SetMinGrow(1);

if (pvNil == (_pmisi = WMS::PwmsNew(_MidiProc, (ulong)this)) &&
pvNil == (_pmisi = OMS::PomsNew(_MidiProc, (ulong)this)))
if (pvNil == (_pmisi = WMS::PwmsNew(_MidiProc, (ULONG_PTR)this)) &&
pvNil == (_pmisi = OMS::PomsNew(_MidiProc, (ULONG_PTR)this)))
{
return fFalse;
}
Expand Down Expand Up @@ -867,7 +867,7 @@ void MSMIX::_SubmitBuffers(ulong tsCur)

_cpvOut++;
pvData = msos.pmdws->PvLockData(&cb);
if (_pmisi->FQueueBuffer(pvData, cb, cbSkip, msos.cactPlay, (ulong)msos.pmdws))
if (_pmisi->FQueueBuffer(pvData, cb, cbSkip, msos.cactPlay, (ULONG_PTR)msos.pmdws))
{
// it worked!
_fPlaying = fTrue;
Expand Down Expand Up @@ -1066,7 +1066,7 @@ bool MSMIX::_FGetKeyEvents(PMDWS pmdws, ulong dtsSeek, long *pcbSkip)
/***************************************************************************
Call back from the midi stream stuff.
***************************************************************************/
void MSMIX::_MidiProc(ulong luUser, void *pvData, ulong luData)
void MSMIX::_MidiProc(ULONG_PTR luUser, void *pvData, ULONG_PTR luData)
{
PMSMIX pmsmix;
PMDWS pmdws;
Expand Down Expand Up @@ -1222,7 +1222,7 @@ ulong MSMIX::_LuThread(void)
/***************************************************************************
Constructor for the MIDI stream interface.
***************************************************************************/
MISI::MISI(PFNMIDI pfn, ulong luUser)
MISI::MISI(PFNMIDI pfn, ULONG_PTR luUser)
{
AssertBaseThis(0);
Assert(pvNil != pfn, 0);
Expand Down Expand Up @@ -1375,7 +1375,7 @@ bool MISI::FActivate(bool fActivate)
/***************************************************************************
Constructor for the Win95 Midi stream class.
***************************************************************************/
WMS::WMS(PFNMIDI pfn, ulong luUser) : MISI(pfn, luUser)
WMS::WMS(PFNMIDI pfn, ULONG_PTR luUser) : MISI(pfn, luUser)
{
}

Expand Down Expand Up @@ -1410,7 +1410,7 @@ WMS::~WMS(void)
/***************************************************************************
Create a new WMS.
***************************************************************************/
PWMS WMS::PwmsNew(PFNMIDI pfn, ulong luUser)
PWMS WMS::PwmsNew(PFNMIDI pfn, ULONG_PTR luUser)
{
PWMS pwms;

Expand Down Expand Up @@ -1553,7 +1553,7 @@ bool WMS::_FOpen(void)
if (hNil != _hms)
goto LDone;

if (MMSYSERR_NOERROR != (*_pfnOpen)(&_hms, &uT, 1, (ulong)_MidiProc, (ulong)this, CALLBACK_FUNCTION))
if (MMSYSERR_NOERROR != (*_pfnOpen)(&_hms, &uT, 1, (DWORD_PTR)_MidiProc, (DWORD_PTR)this, CALLBACK_FUNCTION))
{
goto LFail;
}
Expand Down Expand Up @@ -1677,7 +1677,7 @@ void WMS::_ResetStream(void)
This submits a buffer and restarts the midi stream. If the data is
bigger than 64K, this (in conjunction with _Notify) deals with it.
***************************************************************************/
bool WMS::FQueueBuffer(void *pvData, long cb, long ibStart, long cactPlay, ulong luData)
bool WMS::FQueueBuffer(void *pvData, long cb, long ibStart, long cactPlay, ULONG_PTR luData)
{
AssertThis(0);
AssertPvCb(pvData, cb);
Expand Down Expand Up @@ -1766,7 +1766,7 @@ long WMS::_CmhSubmitBuffers(void)
cbMh = LwMin(pmsir->cb - pmsir->ibNext, kcbMaxWmsBuffer);
pmh->dwBufferLength = cbMh;
pmh->dwBytesRecorded = cbMh;
pmh->dwUser = (ulong)pmsir;
pmh->dwUser = (DWORD_PTR)pmsir;
pmsir->ibNext += cbMh;
pmsir->rgibLim[imh] = pmsir->ibNext;

Expand Down Expand Up @@ -1835,7 +1835,7 @@ void WMS::StopPlaying(void)
to 0, this stops the midi stream. If the indicated sound is done,
we notify the client.
***************************************************************************/
void __stdcall WMS::_MidiProc(HMS hms, ulong msg, ulong luUser, ulong lu1, ulong lu2)
void CALLBACK WMS::_MidiProc(HMS hms, UINT msg, DWORD_PTR luUser, DWORD_PTR lu1, DWORD_PTR lu2)
{
PWMS pwms;
PMH pmh;
Expand Down Expand Up @@ -1991,7 +1991,7 @@ void WMS::_DoCallBacks()
/***************************************************************************
Constructor for our own midi stream api implementation.
***************************************************************************/
OMS::OMS(PFNMIDI pfn, ulong luUser) : MISI(pfn, luUser)
OMS::OMS(PFNMIDI pfn, ULONG_PTR luUser) : MISI(pfn, luUser)
{
}

Expand Down Expand Up @@ -2023,7 +2023,7 @@ OMS::~OMS(void)
/***************************************************************************
Create a new OMS.
***************************************************************************/
POMS OMS::PomsNew(PFNMIDI pfn, ulong luUser)
POMS OMS::PomsNew(PFNMIDI pfn, ULONG_PTR luUser)
{
POMS poms;

Expand Down Expand Up @@ -2165,7 +2165,7 @@ bool OMS::_FClose(void)
/***************************************************************************
Queue a buffer to the midi stream.
***************************************************************************/
bool OMS::FQueueBuffer(void *pvData, long cb, long ibStart, long cactPlay, ulong luData)
bool OMS::FQueueBuffer(void *pvData, long cb, long ibStart, long cactPlay, ULONG_PTR luData)
{
AssertThis(0);
AssertPvCb(pvData, cb);
Expand Down
2 changes: 1 addition & 1 deletion kauai/src/screxe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ void SCEB::_WarnSz(PSZ psz, ...)
STN stn1, stn2;
SZS szs;

stn1.FFormatRgch(psz, CchSz(psz), (ulong *)(&psz + 1));
stn1.FFormatRgch(psz, CchSz(psz), (ULONG_PTR *)(&psz + 1));
stn2.FFormatSz(PszLit("Script ('%f', 0x%x, %d): %s"), _pscpt->Ctg(), _pscpt->Cno(), _ilwCur, &stn1);
stn2.GetSzs(szs);
Warn(szs);
Expand Down
Loading

0 comments on commit fb141c6

Please sign in to comment.