| 1 |
//////////////////////////////////////////////////////////////////////////////// |
| 2 |
// |
| 3 |
// Copyright 2016 RWS Inc, All Rights Reserved |
| 4 |
// |
| 5 |
// This program is free software; you can redistribute it and/or modify |
| 6 |
// it under the terms of version 2 of the GNU General Public License as published by |
| 7 |
// the Free Software Foundation |
| 8 |
// |
| 9 |
// This program is distributed in the hope that it will be useful, |
| 10 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
// GNU General Public License for more details. |
| 13 |
// |
| 14 |
// You should have received a copy of the GNU General Public License along |
| 15 |
// with this program; if not, write to the Free Software Foundation, Inc., |
| 16 |
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 17 |
// |
| 18 |
// RSPiXBlue.h : header file |
| 19 |
// |
| 20 |
#ifndef RSPIXBLUE_H |
| 21 |
#define RSPIXBLUE_H |
| 22 |
|
| 23 |
/////////////////////////////////////////////////////////////////////////////// |
| 24 |
// Macros. |
| 25 |
/////////////////////////////////////////////////////////////////////////////// |
| 26 |
#define DllExport __declspec( dllexport ) |
| 27 |
#define DllImport __declspec( dllimport ) |
| 28 |
|
| 29 |
#ifdef _WINDLL |
| 30 |
#define DLL2EXE DllExport |
| 31 |
#define EXE2DLL DllImport |
| 32 |
#else |
| 33 |
#define DLL2EXE DllImport |
| 34 |
#define EXE2DLL DllExport |
| 35 |
#endif // _WINDLL |
| 36 |
|
| 37 |
/////////////////////////////////////////////////////////////////////////////// |
| 38 |
// Blue Includes. |
| 39 |
/////////////////////////////////////////////////////////////////////////////// |
| 40 |
#include "common/system.h" |
| 41 |
|
| 42 |
#include "common/bluewin.h" |
| 43 |
|
| 44 |
#include "common/bcritic.h" |
| 45 |
#include "common/bdialog.h" |
| 46 |
#include "common/bdisplay.h" |
| 47 |
#include "common/bjoy.h" |
| 48 |
#include "common/bkey.h" |
| 49 |
#include "common/bmain.h" |
| 50 |
#include "common/bmouse.h" |
| 51 |
#include "common/bpalette.h" |
| 52 |
#include "common/wpalette.h" |
| 53 |
#include "common/bparms.h" |
| 54 |
#include "common/bsound.h" |
| 55 |
#include "common/btime.h" |
| 56 |
|
| 57 |
/////////////////////////////////////////////////////////////////////////////// |
| 58 |
// Green Includes. |
| 59 |
/////////////////////////////////////////////////////////////////////////////// |
| 60 |
#include "image/image.h" |
| 61 |
|
| 62 |
///////////////////////////////////////////////////////////////////////////// |
| 63 |
// CRSPiXBlue window |
| 64 |
|
| 65 |
class EXE2DLL CRSPiXBlue : public CStatic |
| 66 |
{ |
| 67 |
// Construction |
| 68 |
public: |
| 69 |
CWnd m_wndRSPiX; |
| 70 |
CWnd m_wndPal; |
| 71 |
CImage* m_pim; |
| 72 |
void Redraw(void); |
| 73 |
CRSPiXBlue(); |
| 74 |
|
| 75 |
// Attributes |
| 76 |
public: |
| 77 |
|
| 78 |
// Operations |
| 79 |
public: |
| 80 |
//////////////////////////////////////////////////////////////////////////// |
| 81 |
// Extensions/Interfaces. |
| 82 |
//////////////////////////////////////////////////////////////////////////// |
| 83 |
|
| 84 |
// Set the buffer Blue uses to draw and redraw the display. |
| 85 |
void SetDisplayImage(CImage* pim, int16_t sFlip = FALSE); |
| 86 |
|
| 87 |
// Set the palette Blue uses to draw and redraw the display. |
| 88 |
void SetDisplayPalette(CPal* ppal); |
| 89 |
|
| 90 |
|
| 91 |
//////////////////////////////////////////////////////////////////////////// |
| 92 |
// Indirection to Blue calls in the proverbial EXE. |
| 93 |
// NOTE: These are not documented as the WinBlue version could change w/o |
| 94 |
// this file being updated. Please refer to the b*.h or b*.cpp file for |
| 95 |
// details. |
| 96 |
//////////////////////////////////////////////////////////////////////////// |
| 97 |
// BCRITIC.H |
| 98 |
int16_t Blu_RemoveCritical(CRITICALL cc) |
| 99 |
{ return ::Blu_RemoveCritical(cc); } |
| 100 |
int16_t Blu_AddCritical(CRITICALL cc, uint32_t ulUser) |
| 101 |
{ return ::Blu_AddCritical(cc, ulUser); } |
| 102 |
// BDEBUG.H |
| 103 |
#undef TRACE // We will use MFC's TRACE |
| 104 |
#define TRACE ::AfxTrace("%s(%d) :", __FILE__, __LINE__),::AfxTrace |
| 105 |
#undef STRACE |
| 106 |
#define STRACE ::AfxTrace |
| 107 |
// BDIALOG.H |
| 108 |
int16_t Blu_MsgBox(uint16_t usFlags, char *pszTitle, char *pszFrmt, ...) |
| 109 |
{ |
| 110 |
char szOutput[16384]; |
| 111 |
va_list varp; |
| 112 |
// Get pointer to the arguments. |
| 113 |
va_start(varp, pszFrmt); |
| 114 |
// Compose string. |
| 115 |
vsprintf(szOutput, pszFrmt, varp); |
| 116 |
// Done with var arguments. |
| 117 |
va_end(varp); |
| 118 |
return ::Blu_MsgBox(usFlags, pszTitle, szOutput); |
| 119 |
} |
| 120 |
int16_t Blu_OpenBox(char* pszBoxTitle, char *pszFileName, int16_t sStrSize) |
| 121 |
{ return ::Blu_OpenBox(pszBoxTitle, pszFileName, sStrSize); } |
| 122 |
int16_t Blu_MultiOpenBox( char* pszBoxTitle, |
| 123 |
char* pszFileNameMemory, |
| 124 |
int32_t lNumBytes, |
| 125 |
char **ppszFileNames, |
| 126 |
int16_t sMaxPtrs, |
| 127 |
int16_t* psNumFiles |
| 128 |
) |
| 129 |
{ |
| 130 |
return ::Blu_MultiOpenBox( pszBoxTitle, pszFileNameMemory, |
| 131 |
lNumBytes, ppszFileNames, |
| 132 |
sMaxPtrs, psNumFiles); |
| 133 |
} |
| 134 |
// BDISPLAY.H |
| 135 |
int16_t Blu_CreateDisplay(int32_t lWidth, int32_t lHeight, int16_t sColorDepth) |
| 136 |
{ return ::Blu_CreateDisplay(lWidth, lHeight, sColorDepth); } |
| 137 |
void Blu_SetRedrawBuf( void* pvBuf, |
| 138 |
int32_t lBufW, int32_t lBufH, |
| 139 |
int32_t sx, int32_t sy, |
| 140 |
int32_t dx, int32_t dy, |
| 141 |
int32_t lBltW, int32_t lBltH, |
| 142 |
int16_t sColorDepth, |
| 143 |
int16_t sVertFlip = FALSE) |
| 144 |
{ |
| 145 |
::Blu_SetRedrawBuf( pvBuf, lBufW, lBufH, sx, sy, dx, dy, |
| 146 |
lBltW, lBltH, sColorDepth, sVertFlip); |
| 147 |
} |
| 148 |
void Blu_SetDisplayBuf( void* pvBuf, int32_t lWidth, int32_t lHeight, |
| 149 |
int16_t sColorDepth, int16_t sVertFlip = FALSE) |
| 150 |
{ ::Blu_SetDisplayBuf(pvBuf, lWidth, lHeight, sColorDepth, sVertFlip); } |
| 151 |
U16* Blu_GetPaletteTranslation(void) |
| 152 |
{ return ::Blu_GetPaletteTranslation(); } |
| 153 |
int16_t Blu_UpdateDisplay(int32_t sx, int32_t sy, |
| 154 |
int32_t dx, int32_t dy, |
| 155 |
int32_t w, int32_t h) |
| 156 |
{ return ::Blu_UpdateDisplay(sx, sy, dx, dy, w, h); } |
| 157 |
int16_t Blu_SetWindowControls(int16_t sControls) |
| 158 |
{ return ::Blu_SetWindowControls(sControls); } |
| 159 |
int32_t Blu_GetDisplayInfo(uint16_t usInfo) |
| 160 |
{ return ::Blu_GetDisplayInfo(usInfo); } |
| 161 |
int16_t Blu_SetWindowTitle(char *pszTitleNameText) |
| 162 |
{ return ::Blu_SetWindowTitle(pszTitleNameText); } |
| 163 |
int16_t Blu_ValidateRect(int32_t lX, int32_t lY, int32_t lW, int32_t lH) |
| 164 |
{ return ::Blu_ValidateRect(lX, lY, lW, lH); } |
| 165 |
// BJOY.H |
| 166 |
int16_t Blu_UpdateJoy(int16_t sJoy) |
| 167 |
{ return ::Blu_UpdateJoy(sJoy); } |
| 168 |
void Blu_GetJoyPos(int16_t sJoy, int32_t *px, int32_t *py, int32_t *pz) |
| 169 |
{ ::Blu_GetJoyPos(sJoy, px, py, pz); } |
| 170 |
void Blu_GetJoyPrevPos(int16_t sJoy, int32_t *px, int32_t *py, int32_t *pz) |
| 171 |
{ ::Blu_GetJoyPrevPos(sJoy, px, py, pz); } |
| 172 |
uint16_t Blu_GetJoyState(int16_t sJoy) |
| 173 |
{ return ::Blu_GetJoyState(sJoy); } |
| 174 |
void Blu_GetJoyState(int16_t sJoy, PJOYSTATE pjs) |
| 175 |
{ ::Blu_GetJoyState(sJoy, pjs); } |
| 176 |
uint16_t Blu_GetJoyPrevState(int16_t sJoy) |
| 177 |
{ return ::Blu_GetJoyPrevState(sJoy); } |
| 178 |
void Blu_GetJoyPrevState(int16_t sJoy, PJOYSTATE pjs) |
| 179 |
{ ::Blu_GetJoyPrevState(sJoy, pjs); } |
| 180 |
// BKEY.H |
| 181 |
int16_t Blu_GetKeyboard(PKEYBOARD pkb) |
| 182 |
{ return ::Blu_GetKeyboard(pkb); } |
| 183 |
// BMAIN.H |
| 184 |
void Blu_System(void) |
| 185 |
{ ::Blu_System(); } |
| 186 |
void Blu_DispatchEvents(int16_t sDispatch) |
| 187 |
{ ::Blu_DispatchEvents(sDispatch); } |
| 188 |
// BMOUSE.H |
| 189 |
int16_t Blu_GetMousePos(int32_t* px, int32_t* py) |
| 190 |
{ return ::Blu_GetMousePos(px, py); } |
| 191 |
int16_t Blu_SetMousePos(int32_t x, int32_t y) |
| 192 |
{ return ::Blu_SetMousePos(x, y); } |
| 193 |
int16_t Blu_GetMouseButton(int16_t sButton) |
| 194 |
{ return ::Blu_GetMouseButton(sButton); } |
| 195 |
// BPALETTE.H |
| 196 |
int16_t Blu_SetPalette(PRGBT8 prgbt8, int16_t sIndex, int16_t sNumEntries) |
| 197 |
{ return ::Blu_SetPalette(prgbt8, sIndex, sNumEntries); } |
| 198 |
int16_t Blu_SetPalette(PRGBQ8 prgbq8, int16_t sIndex, int16_t sNumEntries) |
| 199 |
{ return ::Blu_SetPalette(prgbq8, sIndex, sNumEntries); } |
| 200 |
int16_t Blu_SetPalette(PRGBT5 prgbt5, int16_t sIndex, int16_t sNumEntries) |
| 201 |
{ return ::Blu_SetPalette(prgbt5, sIndex, sNumEntries); } |
| 202 |
int16_t Blu_SetPaletteUsage(int16_t sFull) |
| 203 |
{ return ::Blu_SetPaletteUsage(sFull); } |
| 204 |
void Blu_SetPaletteWindowVisibility(int16_t sVisible) |
| 205 |
{ ::Blu_SetPaletteWindowVisibility(sVisible); } |
| 206 |
// WPALETTE.H |
| 207 |
int16_t Blu_SetPalette(RGBQUAD* prgbq, int16_t sIndex, int16_t sNumEntries) |
| 208 |
{ return ::Blu_SetPalette(prgbq, sIndex, sNumEntries); } |
| 209 |
RGBQUAD* Blu_GetPalette(void) |
| 210 |
{ return ::Blu_GetPalette(); } |
| 211 |
HWND Blu_GetPaletteWindow(void) |
| 212 |
{ return ::Blu_GetPaletteWindow(); } |
| 213 |
// BPARMS.H |
| 214 |
int16_t Blu_GetNumParms(void) |
| 215 |
{ return ::Blu_GetNumParms(); } |
| 216 |
char* Blu_GetParm(int16_t sNum) |
| 217 |
{ return ::Blu_GetParm(sNum); } |
| 218 |
// BSOUND.H |
| 219 |
int32_t Blu_GetSoundOutWindowSize(void) |
| 220 |
{ return ::Blu_GetSoundOutWindowSize(); } |
| 221 |
void Blu_SetSoundOutWindowSize(int32_t lWindowSize) |
| 222 |
{ ::Blu_SetSoundOutWindowSize(lWindowSize); } |
| 223 |
int32_t Blu_GetSoundOutPaneSize(void) |
| 224 |
{ return ::Blu_GetSoundOutPaneSize(); } |
| 225 |
void Blu_SetSoundOutPaneSize(int32_t lPaneSize) |
| 226 |
{ ::Blu_SetSoundOutPaneSize(lPaneSize); } |
| 227 |
int16_t Blu_OpenSoundOut( uint32_t ulSampleRate, |
| 228 |
uint16_t usBitsPerSample, |
| 229 |
uint16_t usNumChannels) |
| 230 |
{ |
| 231 |
return ::Blu_OpenSoundOut( ulSampleRate, |
| 232 |
usBitsPerSample, |
| 233 |
usNumChannels); |
| 234 |
} |
| 235 |
int16_t Blu_CloseSoundOut(void) |
| 236 |
{ return ::Blu_CloseSoundOut(); } |
| 237 |
int16_t Blu_StartSoundOut(BLU_SND_CALLBACK callback, |
| 238 |
uint32_t ulUser) |
| 239 |
{ return ::Blu_StartSoundOut(callback, ulUser); } |
| 240 |
int16_t Blu_IsSoundOutOpen(void) |
| 241 |
{ return ::Blu_IsSoundOutOpen(); } |
| 242 |
int16_t Blu_ResetSoundOut(void) |
| 243 |
{ return ::Blu_ResetSoundOut(); } |
| 244 |
int16_t Blu_PauseSoundOut(void) |
| 245 |
{ return ::Blu_PauseSoundOut(); } |
| 246 |
int16_t Blu_ResumeSoundOut(void) |
| 247 |
{ return ::Blu_ResumeSoundOut(); } |
| 248 |
int32_t Blu_GetSoundOutPos(void) |
| 249 |
{ return ::Blu_GetSoundOutPos(); } |
| 250 |
int32_t Blu_GetSoundOutTime(void) |
| 251 |
{ return ::Blu_GetSoundOutTime(); } |
| 252 |
// BTIME.H |
| 253 |
int32_t Blu_GetTime(void) |
| 254 |
{ return ::Blu_GetTime(); } |
| 255 |
// SYSINFO |
| 256 |
SYSINFO* GetSysInfo(void) |
| 257 |
{ return &gsi; } |
| 258 |
|
| 259 |
// Additional non-blue. |
| 260 |
// Returns a CWnd* to the RSPiX window. |
| 261 |
CWnd* GetBlueWindow(); |
| 262 |
|
| 263 |
// Returns a CWnd* to the palette window. |
| 264 |
CWnd* GetPaletteWindow(); |
| 265 |
|
| 266 |
//////////////////////////////////////////////////////////////////////////// |
| 267 |
// Overrides |
| 268 |
//////////////////////////////////////////////////////////////////////////// |
| 269 |
// ClassWizard generated virtual function overrides |
| 270 |
//{{AFX_VIRTUAL(CRSPiXBlue) |
| 271 |
protected: |
| 272 |
virtual void PreSubclassWindow(); |
| 273 |
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); |
| 274 |
//}}AFX_VIRTUAL |
| 275 |
|
| 276 |
// Implementation |
| 277 |
public: |
| 278 |
virtual ~CRSPiXBlue(); |
| 279 |
|
| 280 |
// Generated message map functions |
| 281 |
protected: |
| 282 |
//{{AFX_MSG(CRSPiXBlue) |
| 283 |
afx_msg void OnDestroy(); |
| 284 |
afx_msg void OnSetFocus(CWnd* pOldWnd); |
| 285 |
//}}AFX_MSG |
| 286 |
|
| 287 |
DECLARE_MESSAGE_MAP() |
| 288 |
}; |
| 289 |
|
| 290 |
///////////////////////////////////////////////////////////////////////////// |
| 291 |
#endif // RSPIXBLUE_H |