ADDED "change backdrop color" button to palette view and added corresponding hack to the core rendering engine for all graphic modes.

This commit is contained in:
spacy51 2008-10-25 18:29:07 +00:00
parent cbff68bd78
commit 1b80b3577d
13 changed files with 148 additions and 27 deletions

View File

@ -1451,7 +1451,7 @@
<Globals>
<Global
Name="RESOURCE_FILE"
Value="\Dev\VBA-M\trunk\src\win32\VBA.rc"
Value="\Dev\vbam\trunk\src\win32\VBA.rc"
/>
</Globals>
</VisualStudioProject>

View File

@ -52,6 +52,11 @@ bool cheatsEnabled = true;
bool mirroringEnable = false;
bool skipSaveGameBattery = false;
// this is an optional hack to change the backdrop/background color:
// -1: disabled
// 0x0000 to 0x7FFF: set custom 15 bit color
int customBackdropColor = -1;
u8 *bios = NULL;
u8 *rom = NULL;
u8 *internalRAM = NULL;

View File

@ -61,6 +61,7 @@ extern int cpuSaveType;
extern bool cheatsEnabled;
extern bool mirroringEnable;
extern bool skipSaveGameBattery;
extern int customBackdropColor;
extern u8 *bios;
extern u8 *rom;

View File

@ -49,7 +49,12 @@ void mode0RenderLine()
gfxDrawSprites(lineOBJ);
u32 backdrop = (READ16LE(&palette[0]) | 0x30000000);
u32 backdrop;
if(customBackdropColor == -1) {
backdrop = (READ16LE(&palette[0]) | 0x30000000);
} else {
backdrop = ((customBackdropColor & 0x7FFF) | 0x30000000);
}
for(int x = 0; x < 240; x++) {
u32 color = backdrop;
@ -156,7 +161,12 @@ void mode0RenderLineNoWindow()
gfxDrawSprites(lineOBJ);
u32 backdrop = (READ16LE(&palette[0]) | 0x30000000);
u32 backdrop;
if(customBackdropColor == -1) {
backdrop = (READ16LE(&palette[0]) | 0x30000000);
} else {
backdrop = ((customBackdropColor & 0x7FFF) | 0x30000000);
}
int effect = (BLDMOD >> 6) & 3;
@ -349,7 +359,12 @@ void mode0RenderLineAll()
gfxDrawSprites(lineOBJ);
gfxDrawOBJWin(lineOBJWin);
u32 backdrop = (READ16LE(&palette[0]) | 0x30000000);
u32 backdrop;
if(customBackdropColor == -1) {
backdrop = (READ16LE(&palette[0]) | 0x30000000);
} else {
backdrop = ((customBackdropColor & 0x7FFF) | 0x30000000);
}
u8 inWin0Mask = WININ & 0xFF;
u8 inWin1Mask = WININ >> 8;

View File

@ -51,7 +51,12 @@ void mode1RenderLine()
gfxDrawSprites(lineOBJ);
u32 backdrop = (READ16LE(&palette[0]) | 0x30000000);
u32 backdrop;
if(customBackdropColor == -1) {
backdrop = (READ16LE(&palette[0]) | 0x30000000);
} else {
backdrop = ((customBackdropColor & 0x7FFF) | 0x30000000);
}
for(int x = 0; x < 240; x++) {
u32 color = backdrop;
@ -153,7 +158,12 @@ void mode1RenderLineNoWindow()
gfxDrawSprites(lineOBJ);
u32 backdrop = (READ16LE(&palette[0]) | 0x30000000);
u32 backdrop;
if(customBackdropColor == -1) {
backdrop = (READ16LE(&palette[0]) | 0x30000000);
} else {
backdrop = ((customBackdropColor & 0x7FFF) | 0x30000000);
}
for(int x = 0; x < 240; x++) {
u32 color = backdrop;
@ -330,7 +340,12 @@ void mode1RenderLineAll()
gfxDrawSprites(lineOBJ);
gfxDrawOBJWin(lineOBJWin);
u32 backdrop = (READ16LE(&palette[0]) | 0x30000000);
u32 backdrop;
if(customBackdropColor == -1) {
backdrop = (READ16LE(&palette[0]) | 0x30000000);
} else {
backdrop = ((customBackdropColor & 0x7FFF) | 0x30000000);
}
u8 inWin0Mask = WININ & 0xFF;
u8 inWin1Mask = WININ >> 8;

View File

@ -54,7 +54,12 @@ void mode2RenderLine()
gfxDrawSprites(lineOBJ);
u32 backdrop = (READ16LE(&palette[0]) | 0x30000000);
u32 backdrop;
if(customBackdropColor == -1) {
backdrop = (READ16LE(&palette[0]) | 0x30000000);
} else {
backdrop = ((customBackdropColor & 0x7FFF) | 0x30000000);
}
for(int x = 0; x < 240; x++) {
u32 color = backdrop;
@ -150,7 +155,12 @@ void mode2RenderLineNoWindow()
gfxDrawSprites(lineOBJ);
u32 backdrop = (READ16LE(&palette[0]) | 0x30000000);
u32 backdrop;
if(customBackdropColor == -1) {
backdrop = (READ16LE(&palette[0]) | 0x30000000);
} else {
backdrop = ((customBackdropColor & 0x7FFF) | 0x30000000);
}
for(int x = 0; x < 240; x++) {
u32 color = backdrop;
@ -316,7 +326,12 @@ void mode2RenderLineAll()
gfxDrawSprites(lineOBJ);
gfxDrawOBJWin(lineOBJWin);
u32 backdrop = (READ16LE(&palette[0]) | 0x30000000);
u32 backdrop;
if(customBackdropColor == -1) {
backdrop = (READ16LE(&palette[0]) | 0x30000000);
} else {
backdrop = ((customBackdropColor & 0x7FFF) | 0x30000000);
}
u8 inWin0Mask = WININ & 0xFF;
u8 inWin1Mask = WININ >> 8;

View File

@ -47,7 +47,12 @@ void mode3RenderLine()
gfxDrawSprites(lineOBJ);
u32 background = (READ16LE(&palette[0]) | 0x30000000);
u32 background;
if(customBackdropColor == -1) {
background = (READ16LE(&palette[0]) | 0x30000000);
} else {
background = ((customBackdropColor & 0x7FFF) | 0x30000000);
}
for(int x = 0; x < 240; x++) {
u32 color = background;
@ -124,7 +129,12 @@ void mode3RenderLineNoWindow()
gfxDrawSprites(lineOBJ);
u32 background = (READ16LE(&palette[0]) | 0x30000000);
u32 background;
if(customBackdropColor == -1) {
background = (READ16LE(&palette[0]) | 0x30000000);
} else {
background = ((customBackdropColor & 0x7FFF) | 0x30000000);
}
for(int x = 0; x < 240; x++) {
u32 color = background;
@ -269,7 +279,12 @@ void mode3RenderLineAll()
u8 inWin1Mask = WININ >> 8;
u8 outMask = WINOUT & 0xFF;
u32 background = (READ16LE(&palette[0]) | 0x30000000);
u32 background;
if(customBackdropColor == -1) {
background = (READ16LE(&palette[0]) | 0x30000000);
} else {
background = ((customBackdropColor & 0x7FFF) | 0x30000000);
}
for(int x = 0; x < 240; x++) {
u32 color = background;

View File

@ -46,7 +46,12 @@ void mode4RenderLine()
gfxDrawSprites(lineOBJ);
u32 backdrop = (READ16LE(&palette[0]) | 0x30000000);
u32 backdrop;
if(customBackdropColor == -1) {
backdrop = (READ16LE(&palette[0]) | 0x30000000);
} else {
backdrop = ((customBackdropColor & 0x7FFF) | 0x30000000);
}
for(int x = 0; x < 240; x++) {
u32 color = backdrop;
@ -122,7 +127,12 @@ void mode4RenderLineNoWindow()
gfxDrawSprites(lineOBJ);
u32 backdrop = (READ16LE(&palette[0]) | 0x30000000);
u32 backdrop;
if(customBackdropColor == -1) {
backdrop = (READ16LE(&palette[0]) | 0x30000000);
} else {
backdrop = ((customBackdropColor & 0x7FFF) | 0x30000000);
}
for(int x = 0; x < 240; x++) {
u32 color = backdrop;
@ -262,7 +272,12 @@ void mode4RenderLineAll()
gfxDrawSprites(lineOBJ);
gfxDrawOBJWin(lineOBJWin);
u32 backdrop = (READ16LE(&palette[0]) | 0x30000000);
u32 backdrop;
if(customBackdropColor == -1) {
backdrop = (READ16LE(&palette[0]) | 0x30000000);
} else {
backdrop = ((customBackdropColor & 0x7FFF) | 0x30000000);
}
u8 inWin0Mask = WININ & 0xFF;
u8 inWin1Mask = WININ >> 8;

View File

@ -47,7 +47,12 @@ void mode5RenderLine()
gfxDrawSprites(lineOBJ);
u32 background = (READ16LE(&palette[0]) | 0x30000000);
u32 background;
if(customBackdropColor == -1) {
background = (READ16LE(&palette[0]) | 0x30000000);
} else {
background = ((customBackdropColor & 0x7FFF) | 0x30000000);
}
for(int x = 0; x < 240; x++) {
u32 color = background;
@ -124,7 +129,12 @@ void mode5RenderLineNoWindow()
gfxDrawSprites(lineOBJ);
u32 background = ( READ16LE(&palette[0]) | 0x30000000);
u32 background;
if(customBackdropColor == -1) {
background = (READ16LE(&palette[0]) | 0x30000000);
} else {
background = ((customBackdropColor & 0x7FFF) | 0x30000000);
}
for(int x = 0; x < 240; x++) {
u32 color = background;
@ -269,7 +279,12 @@ void mode5RenderLineAll()
u8 inWin1Mask = WININ >> 8;
u8 outMask = WINOUT & 0xFF;
u32 background = (READ16LE(&palette[0]) | 0x30000000);
u32 background;
if(customBackdropColor == -1) {
background = (READ16LE(&palette[0]) | 0x30000000);
} else {
background = ((customBackdropColor & 0x7FFF) | 0x30000000);
}
for(int x = 0; x < 240; x++) {
u32 color = background;

View File

@ -80,7 +80,8 @@ BEGIN_MESSAGE_MAP(PaletteView, CDialog)
ON_BN_CLICKED(IDC_CLOSE, OnClose)
//}}AFX_MSG_MAP
ON_MESSAGE(WM_PALINFO, OnPalInfo)
END_MESSAGE_MAP()
ON_BN_CLICKED(IDC_CHANGE_BACKDROP, &PaletteView::OnBnClickedChangeBackdrop)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// PaletteView message handlers
@ -190,6 +191,7 @@ void PaletteView::OnAutoUpdate()
} else {
theApp.winRemoveUpdateListener(this);
}
(CButton*)GetDlgItem(IDC_REFRESH2)->EnableWindow(!autoUpdate);
}
void PaletteView::OnClose()
@ -243,3 +245,21 @@ void PaletteView::PostNcDestroy()
{
delete this;
}
void PaletteView::OnBnClickedChangeBackdrop()
{
CColorDialog cdlg;
COLORREF color;
switch( cdlg.DoModal() ) {
case IDOK:
color = cdlg.GetColor();
customBackdropColor =
( ( GetBValue( color ) >> 3 ) << 10 ) |
( ( GetGValue( color ) >> 3 ) << 5 ) |
( GetRValue( color ) >> 3 );
break;
case IDCANCEL:
customBackdropColor = -1; // disable hack
break;
}
}

View File

@ -82,7 +82,9 @@ class PaletteView : public ResizeDlg, IUpdateListener
afx_msg void OnClose();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
public:
afx_msg void OnBnClickedChangeBackdrop();
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

View File

@ -577,15 +577,15 @@ BEGIN
LTEXT "",IDC_PALETTE_NUM,130,135,53,8,SS_NOPREFIX
END
IDD_PALETTE_VIEW DIALOG 0, 0, 316, 266
IDD_PALETTE_VIEW DIALOGEX 0, 0, 316, 266
STYLE DS_SETFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
CAPTION "Palette View"
FONT 8, "MS Sans Serif"
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
PUSHBUTTON "Save BG...",IDC_SAVE_BG,30,245,50,14
PUSHBUTTON "Save OBJ...",IDC_SAVE_OBJ,98,245,50,14
PUSHBUTTON "&Refresh",IDC_REFRESH2,166,245,50,14
PUSHBUTTON "&Close",IDC_CLOSE,234,245,50,14
PUSHBUTTON "Save BG...",IDC_SAVE_BG,102,246,50,14
PUSHBUTTON "Save OBJ...",IDC_SAVE_OBJ,162,246,50,14
PUSHBUTTON "&Refresh",IDC_REFRESH2,6,246,50,14
PUSHBUTTON "&Close",IDC_CLOSE,260,246,50,14
LTEXT "",IDC_ADDRESS,53,168,50,8,SS_NOPREFIX
LTEXT "",IDC_R,53,180,50,8,SS_NOPREFIX
LTEXT "",IDC_G,53,192,50,8,SS_NOPREFIX
@ -604,6 +604,7 @@ BEGIN
LTEXT "Value:",IDC_STATIC,7,216,38,8
LTEXT "Click on a color for more information",IDC_STATIC,7,7,302,8
CONTROL "Automatic update",IDC_AUTO_UPDATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,229,71,10
PUSHBUTTON "Change backdrop color...",IDC_CHANGE_BACKDROP,102,228,108,14
END
IDD_MEM_VIEWER DIALOG 0, 0, 380, 178

View File

@ -392,6 +392,8 @@
#define IDC_MAP_VIEW_ZOOM 1138
#define IDS_MOVIE_PLAY 1138
#define IDC_VIEWER 1140
#define IDC_SAVE_BG2 1140
#define IDC_CHANGE_BACKDROP 1140
#define IDC_ADDRESSES 1141
#define IDC_GO 1143
#define IDC_8_BIT 1144