newemuloop: fix some timing regressions; win32: improve map view
This commit is contained in:
parent
3c0646c423
commit
3f291c8e6a
|
@ -719,6 +719,8 @@ void GPU_setMasterBrightness (GPU *gpu, u16 val)
|
|||
}
|
||||
gpu->MasterBrightFactor = (val & 0x1F);
|
||||
gpu->MasterBrightMode = (val>>14);
|
||||
//printf("MASTER BRIGHTNESS %d to %d at %d\n",gpu->core,gpu->MasterBrightFactor,nds.VCount);
|
||||
|
||||
}
|
||||
|
||||
void SetupFinalPixelBlitter (GPU *gpu)
|
||||
|
@ -958,11 +960,11 @@ FORCEINLINE void GPU::renderline_checkWindows(u16 x, bool &draw, bool &effect) c
|
|||
// PIXEL RENDERING - BGS
|
||||
/*****************************************************************************/
|
||||
|
||||
template<bool BACKDROP> FORCEINLINE void GPU::setFinalBGColorSpecialNone(u16 &color, const u8 x)
|
||||
template<bool BACKDROP> FORCEINLINE void GPU::setFinalBGColorSpecialNone(u16 &color, const u32 x)
|
||||
{
|
||||
}
|
||||
|
||||
template<bool BACKDROP> FORCEINLINE void GPU::setFinalBGColorSpecialBlend(u16 &color, const u8 x)
|
||||
template<bool BACKDROP> FORCEINLINE void GPU::setFinalBGColorSpecialBlend(u16 &color, const u32 x)
|
||||
{
|
||||
//blend backdrop with what?? this doesn't make sense
|
||||
if(BACKDROP) return;
|
||||
|
@ -975,7 +977,7 @@ template<bool BACKDROP> FORCEINLINE void GPU::setFinalBGColorSpecialBlend(u16 &c
|
|||
}
|
||||
}
|
||||
|
||||
template<bool BACKDROP> FORCEINLINE void GPU::setFinalBGColorSpecialIncrease (u16 &color, const u8 x)
|
||||
template<bool BACKDROP> FORCEINLINE void GPU::setFinalBGColorSpecialIncrease (u16 &color, const u32 x)
|
||||
{
|
||||
if(blend1) // the bg to draw has a special color effect
|
||||
{
|
||||
|
@ -983,7 +985,7 @@ template<bool BACKDROP> FORCEINLINE void GPU::setFinalBGColorSpecialIncrease (u1
|
|||
}
|
||||
}
|
||||
|
||||
template<bool BACKDROP> FORCEINLINE void GPU::setFinalBGColorSpecialDecrease(u16 &color, const u8 x)
|
||||
template<bool BACKDROP> FORCEINLINE void GPU::setFinalBGColorSpecialDecrease(u16 &color, const u32 x)
|
||||
{
|
||||
if(blend1) // the bg to draw has a special color effect
|
||||
{
|
||||
|
@ -991,7 +993,7 @@ template<bool BACKDROP> FORCEINLINE void GPU::setFinalBGColorSpecialDecrease(u16
|
|||
}
|
||||
}
|
||||
|
||||
template<bool BACKDROP> FORCEINLINE bool GPU::setFinalBGColorSpecialNoneWnd(u16 &color, const u8 x)
|
||||
template<bool BACKDROP> FORCEINLINE bool GPU::setFinalBGColorSpecialNoneWnd(u16 &color, const u32 x)
|
||||
{
|
||||
bool windowDraw = true, windowEffect = true;
|
||||
|
||||
|
@ -1013,7 +1015,7 @@ template<bool BACKDROP> FORCEINLINE bool GPU::setFinalBGColorSpecialNoneWnd(u16
|
|||
return false;
|
||||
}
|
||||
|
||||
template<bool BACKDROP> FORCEINLINE bool GPU::setFinalBGColorSpecialBlendWnd(u16 &color, const u8 x)
|
||||
template<bool BACKDROP> FORCEINLINE bool GPU::setFinalBGColorSpecialBlendWnd(u16 &color, const u32 x)
|
||||
{
|
||||
bool windowDraw = true, windowEffect = true;
|
||||
|
||||
|
@ -1036,7 +1038,7 @@ template<bool BACKDROP> FORCEINLINE bool GPU::setFinalBGColorSpecialBlendWnd(u16
|
|||
return false;
|
||||
}
|
||||
|
||||
template<bool BACKDROP> FORCEINLINE bool GPU::setFinalBGColorSpecialIncreaseWnd(u16 &color, const u8 x)
|
||||
template<bool BACKDROP> FORCEINLINE bool GPU::setFinalBGColorSpecialIncreaseWnd(u16 &color, const u32 x)
|
||||
{
|
||||
bool windowDraw = true, windowEffect = true;
|
||||
|
||||
|
@ -1055,7 +1057,7 @@ template<bool BACKDROP> FORCEINLINE bool GPU::setFinalBGColorSpecialIncreaseWnd(
|
|||
return false;
|
||||
}
|
||||
|
||||
template<bool BACKDROP> FORCEINLINE bool GPU::setFinalBGColorSpecialDecreaseWnd(u16 &color, const u8 x)
|
||||
template<bool BACKDROP> FORCEINLINE bool GPU::setFinalBGColorSpecialDecreaseWnd(u16 &color, const u32 x)
|
||||
{
|
||||
bool windowDraw = true, windowEffect = true;
|
||||
|
||||
|
@ -1125,7 +1127,7 @@ static void _master_setFinalOBJColor(GPU *gpu, u32 passing, u8 *dst, u16 color,
|
|||
gpu->bgPixels[x] = 4;
|
||||
}
|
||||
|
||||
template<bool BACKDROP> FORCEINLINE void GPU::setFinalColorBG(u16 color, u8 x)
|
||||
template<bool BACKDROP> FORCEINLINE void GPU::setFinalColorBG(u16 color, const u32 x)
|
||||
{
|
||||
//It is not safe to assert this here.
|
||||
//This is probably the best place to enforce it, since almost every single color that comes in here
|
||||
|
@ -1173,13 +1175,12 @@ FORCEINLINE void GPU::setFinalColor3d(int dstX, int srcX)
|
|||
|
||||
//this was forced inline because most of the time it just falls through to setFinalColorBck() and the function call
|
||||
//overhead was ridiculous and terrible
|
||||
template<bool MOSAIC, bool BACKDROP> FORCEINLINE void GPU::__setFinalColorBck(u16 color, const u8 x, const bool opaque)
|
||||
template<bool MOSAIC, bool BACKDROP> FORCEINLINE void GPU::__setFinalColorBck(u16 color, const u32 x, const bool opaque)
|
||||
{
|
||||
//I commented out this line to make a point.
|
||||
//indeed, since x is a u8 we cannot pass in anything >=256
|
||||
//under ordinary circumstances, nobody should pass in something >=256
|
||||
//but in fact, someone is going to try. specifically, that is the map viewer debug tools
|
||||
//which try to render the enter BG. in cases where that is large, it could be up to 1024 wide.
|
||||
//I think it survives this truncation to 8bits.
|
||||
//assert(x<256);
|
||||
|
||||
int x_int;
|
||||
|
@ -1582,7 +1583,20 @@ static void lineNull(GPU * gpu)
|
|||
template<bool MOSAIC> void lineText(GPU * gpu)
|
||||
{
|
||||
BGxOFS * ofs = &gpu->dispx_st->dispx_BGxOFS[gpu->currBgNum];
|
||||
renderline_textBG<MOSAIC>(gpu, T1ReadWord((u8 *)&ofs->BGxHOFS, 0), gpu->currLine + T1ReadWord((u8 *)&ofs->BGxVOFS, 0), 256);
|
||||
|
||||
|
||||
|
||||
if(gpu->debug)
|
||||
{
|
||||
const s32 wh = gpu->BGSize[gpu->currBgNum][0];
|
||||
renderline_textBG<MOSAIC>(gpu, 0, gpu->currLine, wh);
|
||||
}
|
||||
else
|
||||
{
|
||||
const u16 vofs = T1ReadWord((u8 *)&ofs->BGxVOFS,0);
|
||||
const u16 hofs = T1ReadWord((u8 *)&ofs->BGxHOFS,0);
|
||||
renderline_textBG<MOSAIC>(gpu, hofs, gpu->currLine + vofs, 256);
|
||||
}
|
||||
}
|
||||
|
||||
template<bool MOSAIC> void lineRot(GPU * gpu)
|
||||
|
@ -1593,8 +1607,12 @@ template<bool MOSAIC> void lineRot(GPU * gpu)
|
|||
} else {
|
||||
parms = &(gpu->dispx_st)->dispx_BG3PARMS;
|
||||
}
|
||||
|
||||
if(gpu->debug)
|
||||
rotBG2<MOSAIC>(gpu, 0, (s16)gpu->currLine*256, 256,0, -1,-1, 256);
|
||||
{
|
||||
s32 wh = gpu->BGSize[gpu->currBgNum][0];
|
||||
rotBG2<MOSAIC>(gpu, 0, (s16)gpu->currLine*256, 256,0, 0,-77, wh);
|
||||
}
|
||||
else
|
||||
{
|
||||
rotBG2<MOSAIC>(gpu,
|
||||
|
@ -1620,7 +1638,10 @@ template<bool MOSAIC> void lineExtRot(GPU * gpu)
|
|||
}
|
||||
|
||||
if(gpu->debug)
|
||||
extRotBG2<MOSAIC>(gpu, 0, (s16)gpu->currLine*256, 256,0, -1,-1, 256);
|
||||
{
|
||||
s32 wh = gpu->BGSize[gpu->currBgNum][0];
|
||||
extRotBG2<MOSAIC>(gpu, 0, (s16)gpu->currLine*256, 256,0, 0,-77, wh);
|
||||
}
|
||||
else
|
||||
{
|
||||
extRotBG2<MOSAIC>(gpu,
|
||||
|
@ -2468,7 +2489,7 @@ static void GPU_ligne_layer(NDS_Screen * screen, u16 l)
|
|||
}
|
||||
|
||||
//useful for debugging individual layers
|
||||
//if(gpu->core == 0 && i16 != 1) continue;
|
||||
//if(gpu->core == 1 || i16 != 2) continue;
|
||||
|
||||
if(gpu->curr_mosaic_enabled)
|
||||
gpu->modeRender<true>(i16);
|
||||
|
@ -2804,6 +2825,9 @@ void GPU_ligne(NDS_Screen * screen, u16 l)
|
|||
gpu->refreshAffineStartRegs(-1,-1);
|
||||
}
|
||||
|
||||
//if(gpu->core == 1)
|
||||
// printf("%d\n",l);
|
||||
|
||||
//blacken the screen if it is turned off by the user
|
||||
if(!CommonSettings.showGpu.screens[gpu->core])
|
||||
{
|
||||
|
@ -2812,6 +2836,12 @@ void GPU_ligne(NDS_Screen * screen, u16 l)
|
|||
return;
|
||||
}
|
||||
|
||||
//{
|
||||
// extern int currFrameCounter;
|
||||
// u8 * dst = GPU_screen + (screen->offset + l) * 512;
|
||||
// memset(dst,currFrameCounter,512);
|
||||
//}
|
||||
|
||||
//cache some parameters which are assumed to be stable throughout the rendering of the entire line
|
||||
gpu->currLine = (u8)l;
|
||||
u16 mosaic_control = T1ReadWord((u8 *)&gpu->dispx_st->dispx_MISC.MOSAIC, 0);
|
||||
|
@ -2874,8 +2904,6 @@ void GPU_ligne(NDS_Screen * screen, u16 l)
|
|||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
GPU_ligne_MasterBrightness(screen, l);
|
||||
}
|
||||
|
||||
|
|
|
@ -728,9 +728,9 @@ struct GPU
|
|||
u8 MasterBrightMode;
|
||||
u32 MasterBrightFactor;
|
||||
|
||||
u8 bgPixels[256];
|
||||
u8 bgPixels[1024]; //yes indeed, this is oversized. map debug tools try to write to it
|
||||
|
||||
u8 currLine;
|
||||
u32 currLine;
|
||||
u8 currBgNum;
|
||||
bool blend1;
|
||||
u8* currDst;
|
||||
|
@ -779,17 +779,17 @@ struct GPU
|
|||
void _spriteRender(u8 * dst, u8 * dst_alpha, u8 * typeTab, u8 * prioTab);
|
||||
void spriteRender(u8 * dst, u8 * dst_alpha, u8 * typeTab, u8 * prioTab);
|
||||
|
||||
template<bool BACKDROP> void setFinalColorBG(u16 color, u8 x);
|
||||
template<bool BACKDROP> void setFinalColorBG(u16 color, const u32 x);
|
||||
void setFinalColor3d(int dstX, int srcX);
|
||||
|
||||
template<bool BACKDROP> FORCEINLINE void setFinalBGColorSpecialNone(u16 &color, u8 x);
|
||||
template<bool BACKDROP> FORCEINLINE void setFinalBGColorSpecialBlend(u16 &color, u8 x);
|
||||
template<bool BACKDROP> FORCEINLINE void setFinalBGColorSpecialIncrease(u16 &color, u8 x);
|
||||
template<bool BACKDROP> FORCEINLINE void setFinalBGColorSpecialDecrease(u16 &color, u8 x);
|
||||
template<bool BACKDROP> FORCEINLINE bool setFinalBGColorSpecialNoneWnd(u16 &color, u8 x);
|
||||
template<bool BACKDROP> FORCEINLINE bool setFinalBGColorSpecialBlendWnd(u16 &color, u8 x);
|
||||
template<bool BACKDROP> FORCEINLINE bool setFinalBGColorSpecialIncreaseWnd(u16 &color, u8 x);
|
||||
template<bool BACKDROP> FORCEINLINE bool setFinalBGColorSpecialDecreaseWnd(u16 &color, u8 x);
|
||||
template<bool BACKDROP> FORCEINLINE void setFinalBGColorSpecialNone(u16 &color, const u32 x);
|
||||
template<bool BACKDROP> FORCEINLINE void setFinalBGColorSpecialBlend(u16 &color, const u32 x);
|
||||
template<bool BACKDROP> FORCEINLINE void setFinalBGColorSpecialIncrease(u16 &color, const u32 x);
|
||||
template<bool BACKDROP> FORCEINLINE void setFinalBGColorSpecialDecrease(u16 &color, const u32 x);
|
||||
template<bool BACKDROP> FORCEINLINE bool setFinalBGColorSpecialNoneWnd(u16 &color, const u32 x);
|
||||
template<bool BACKDROP> FORCEINLINE bool setFinalBGColorSpecialBlendWnd(u16 &color, const u32 x);
|
||||
template<bool BACKDROP> FORCEINLINE bool setFinalBGColorSpecialIncreaseWnd(u16 &color, const u32 x);
|
||||
template<bool BACKDROP> FORCEINLINE bool setFinalBGColorSpecialDecreaseWnd(u16 &color, const u32 x);
|
||||
|
||||
FORCEINLINE void setFinal3DColorSpecialNone(int dstX, int srcX);
|
||||
FORCEINLINE void setFinal3DColorSpecialBlend(int dstX, int srcX);
|
||||
|
@ -801,7 +801,7 @@ struct GPU
|
|||
FORCEINLINE void setFinal3DColorSpecialDecreaseWnd(int dstX, int srcX);
|
||||
|
||||
|
||||
template<bool MOSAIC, bool BACKDROP> void __setFinalColorBck(u16 color, const u8 x, const bool opaque);
|
||||
template<bool MOSAIC, bool BACKDROP> void __setFinalColorBck(u16 color, const u32 x, const bool opaque);
|
||||
void setAffineStart(int layer, int xy, u32 val);
|
||||
void setAffineStartWord(int layer, int xy, u16 val, int word);
|
||||
u32 getAffineStart(int layer, int xy);
|
||||
|
|
|
@ -1800,8 +1800,21 @@ void execHardware_hblank()
|
|||
//this logic was formerly at hblank time. it was moved to the beginning of the scanline on a whim
|
||||
if(nds.VCount<192)
|
||||
{
|
||||
//trigger hblank dmas.
|
||||
//but should this happen for non-displayed scanlines??? not sure
|
||||
//so, we have chosen to do the line drawing at hblank time.
|
||||
//this is the traditional time for it in desmume.
|
||||
//while it may seem more ruthlessly accurate to do it at hstart,
|
||||
//in practice we need to be more forgiving, in case things have overrun the scanline start.
|
||||
//this should be safe since games cannot do anything timing dependent until this next
|
||||
//scanline begins, anyway (as this scanline was in the middle of drawing)
|
||||
if(!SkipCur2DFrame)
|
||||
{
|
||||
GPU_ligne(&MainScreen, nds.VCount);
|
||||
GPU_ligne(&SubScreen, nds.VCount);
|
||||
}
|
||||
|
||||
//trigger hblank dmas
|
||||
//but notice, we do that just after we finished drawing the line
|
||||
//(values copied by this hdma should not be used until the next scanline)
|
||||
execHardware_doAllDma(EDMAMode_HBlank);
|
||||
}
|
||||
}
|
||||
|
@ -1889,23 +1902,14 @@ void execHardware_hstart()
|
|||
//handle vcount status
|
||||
execHardware_hstart_vcount();
|
||||
|
||||
//this logic was formerly at hblank time. it was moved to the beginning of the scanline on a whim
|
||||
//trigger hstart dmas
|
||||
execHardware_doAllDma(EDMAMode_HStart);
|
||||
|
||||
if(nds.VCount<192)
|
||||
{
|
||||
//trigger hstart dmas
|
||||
//in an effort to more accurately mimic what might happen in cases where these are used
|
||||
//to adjust the scanline which is just about to render, the dma occurs before the scanline draw
|
||||
execHardware_doAllDma(EDMAMode_HStart);
|
||||
|
||||
//this is hacky.
|
||||
//there is a corresponding hack in doDMA
|
||||
execHardware_doAllDma(EDMAMode_MemDisplay);
|
||||
|
||||
if(!SkipCur2DFrame)
|
||||
{
|
||||
GPU_ligne(&MainScreen, nds.VCount);
|
||||
GPU_ligne(&SubScreen, nds.VCount);
|
||||
}
|
||||
}
|
||||
|
||||
//end of 3d vblank
|
||||
|
|
|
@ -156,6 +156,7 @@ DWORD hKeyInputTimer;
|
|||
|
||||
extern LRESULT CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
void InitRamSearch();
|
||||
void FilterUpdate(HWND hwnd, bool user=true);
|
||||
|
||||
|
||||
CRITICAL_SECTION win_sync;
|
||||
|
@ -1620,8 +1621,7 @@ int _main()
|
|||
CommonSettings.wifiBridgeAdapterNum = GetPrivateProfileInt("Wifi", "BridgeAdapter", 0, IniName);
|
||||
|
||||
video.currentfilter = GetPrivateProfileInt("Video", "Filter", video.NONE, IniName);
|
||||
void FilterUpdate(HWND hwnd);
|
||||
FilterUpdate(MainWindow->getHWnd());
|
||||
FilterUpdate(MainWindow->getHWnd(),false);
|
||||
|
||||
/* Read the firmware settings from the init file */
|
||||
win_fw_config.fav_colour = GetPrivateProfileInt("Firmware","favColor", 10, IniName);
|
||||
|
@ -2365,12 +2365,13 @@ void RunConfig(CONFIGSCREEN which)
|
|||
NDS_UnPause();
|
||||
}
|
||||
|
||||
void FilterUpdate (HWND hwnd){
|
||||
void FilterUpdate (HWND hwnd, bool user){
|
||||
UpdateScreenRects();
|
||||
UpdateWndRects(hwnd);
|
||||
SetScreenGap(video.screengap);
|
||||
SetRotate(hwnd, video.rotation);
|
||||
ScaleScreen(windowSize);
|
||||
if(user && windowSize==0) {}
|
||||
else ScaleScreen(windowSize);
|
||||
WritePrivateProfileInt("Video", "Filter", video.currentfilter, IniName);
|
||||
WritePrivateProfileInt("Video", "Width", video.width, IniName);
|
||||
WritePrivateProfileInt("Video", "Height", video.height, IniName);
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
This file is part of DeSmuME
|
||||
This file is part of DeSmuME
|
||||
|
||||
DeSmuME is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
DeSmuME is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DeSmuME is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
DeSmuME is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DeSmuME; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DeSmuME; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapView.h"
|
||||
|
@ -32,12 +32,13 @@ using namespace GPU_EXT;
|
|||
|
||||
struct mapview_struct
|
||||
{
|
||||
u32 autoup_secs;
|
||||
bool autoup;
|
||||
u32 autoup_secs;
|
||||
bool autoup;
|
||||
|
||||
u16 map;
|
||||
u16 lcd;
|
||||
u16 bitmap[1024*1024];
|
||||
u16 map;
|
||||
u16 lcd;
|
||||
u16 bitmap[1024*1024];
|
||||
bool clear;
|
||||
|
||||
void render()
|
||||
{
|
||||
|
@ -72,105 +73,118 @@ LRESULT MapView_OnPaint(mapview_struct * win, HWND hwnd, WPARAM wParam, LPARAM l
|
|||
{
|
||||
Lock lock;
|
||||
|
||||
HDC hdc;
|
||||
PAINTSTRUCT ps;
|
||||
char text[80];
|
||||
u32 dispcnt = ((volatile u32 *)ARM9Mem.ARM9_REG)[(win->lcd*0x400)];
|
||||
u32 bgcnt = ((volatile u16 *)ARM9Mem.ARM9_REG)[(8 + (win->map<<1) + (win->lcd*0x1000))>>1];
|
||||
BITMAPV4HEADER bmi;
|
||||
u16 lg;
|
||||
u16 ht;
|
||||
BGxPARMS * parms;
|
||||
HDC hdc;
|
||||
PAINTSTRUCT ps;
|
||||
char text[80];
|
||||
u32 dispcnt = ((volatile u32 *)ARM9Mem.ARM9_REG)[(win->lcd*0x400)];
|
||||
u32 bgcnt = ((volatile u16 *)ARM9Mem.ARM9_REG)[(8 + (win->map<<1) + (win->lcd*0x1000))>>1];
|
||||
BITMAPV4HEADER bmi;
|
||||
u16 lg;
|
||||
u16 ht;
|
||||
BGxPARMS * parms;
|
||||
|
||||
//CreateBitmapIndirect(&bmi);
|
||||
memset(&bmi, 0, sizeof(bmi));
|
||||
bmi.bV4Size = sizeof(bmi);
|
||||
bmi.bV4Planes = 1;
|
||||
bmi.bV4BitCount = 16;
|
||||
bmi.bV4V4Compression = BI_RGB|BI_BITFIELDS;
|
||||
bmi.bV4RedMask = 0x001F;
|
||||
bmi.bV4GreenMask = 0x03E0;
|
||||
bmi.bV4BlueMask = 0x7C00;
|
||||
//CreateBitmapIndirect(&bmi);
|
||||
memset(&bmi, 0, sizeof(bmi));
|
||||
bmi.bV4Size = sizeof(bmi);
|
||||
bmi.bV4Planes = 1;
|
||||
bmi.bV4BitCount = 16;
|
||||
bmi.bV4V4Compression = BI_RGB|BI_BITFIELDS;
|
||||
bmi.bV4RedMask = 0x001F;
|
||||
bmi.bV4GreenMask = 0x03E0;
|
||||
bmi.bV4BlueMask = 0x7C00;
|
||||
|
||||
if(win->lcd)
|
||||
{
|
||||
lg = SubScreen.gpu->BGSize[win->map][0];
|
||||
ht = SubScreen.gpu->BGSize[win->map][1];
|
||||
}
|
||||
else
|
||||
{
|
||||
lg = MainScreen.gpu->BGSize[win->map][0];
|
||||
ht = MainScreen.gpu->BGSize[win->map][1];
|
||||
}
|
||||
bmi.bV4Width = lg;
|
||||
bmi.bV4Height = -ht;
|
||||
|
||||
hdc = BeginPaint(hwnd, &ps);
|
||||
|
||||
sprintf(text, "%d %08X, %08X", (int)(dispcnt&7), (int)dispcnt, (int)bgcnt);
|
||||
SetWindowText(GetDlgItem(hwnd, IDC_MODE), text);
|
||||
|
||||
if(!(bgcnt&(1<<7)))
|
||||
sprintf(text, "normal 16");
|
||||
else
|
||||
{
|
||||
if(!(dispcnt&(1<<30)))
|
||||
sprintf(text, "normal 256");
|
||||
else
|
||||
{
|
||||
switch(win->map)
|
||||
{
|
||||
case 0 :
|
||||
sprintf(text, "extended slot %d", (bgcnt&(1<<13))?2:0);
|
||||
break;
|
||||
case 1 :
|
||||
sprintf(text, "extended slot %d", (bgcnt&(1<<13))?3:1);
|
||||
break;
|
||||
default :
|
||||
sprintf(text, "extended slot %d", MainScreen.gpu->BGExtPalSlot[win->map]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
SetWindowText(GetDlgItem(hwnd, IDC_PAL), text);
|
||||
|
||||
sprintf(text, "%d", (int)(bgcnt&3));
|
||||
SetWindowText(GetDlgItem(hwnd, IDC_PRIO), text);
|
||||
if(win->lcd)
|
||||
{
|
||||
lg = SubScreen.gpu->BGSize[win->map][0];
|
||||
ht = SubScreen.gpu->BGSize[win->map][1];
|
||||
}
|
||||
else
|
||||
{
|
||||
lg = MainScreen.gpu->BGSize[win->map][0];
|
||||
ht = MainScreen.gpu->BGSize[win->map][1];
|
||||
}
|
||||
bmi.bV4Width = lg;
|
||||
bmi.bV4Height = -ht;
|
||||
|
||||
|
||||
if((dispcnt>>8>>win->map)&1)
|
||||
SetWindowText(GetDlgItem(hwnd, IDC_VISIBLE), "true");
|
||||
hdc = BeginPaint(hwnd, &ps);
|
||||
|
||||
sprintf(text, "%d %08X, %08X", (int)(dispcnt&7), (int)dispcnt, (int)bgcnt);
|
||||
SetWindowText(GetDlgItem(hwnd, IDC_MODE), text);
|
||||
|
||||
if(!(bgcnt&(1<<7)))
|
||||
sprintf(text, "normal 16");
|
||||
else
|
||||
{
|
||||
if(!(dispcnt&(1<<30)))
|
||||
sprintf(text, "normal 256");
|
||||
else
|
||||
SetWindowText(GetDlgItem(hwnd, IDC_VISIBLE), "false");
|
||||
|
||||
sprintf(text, "0x%08X", (int)(0x6000000 + ((bgcnt>>2)&0xF)*0x4000 + win->lcd*0x200000 +((dispcnt>>24)&7)*0x10000));
|
||||
SetWindowText(GetDlgItem(hwnd, IDC_CHAR), text);
|
||||
|
||||
sprintf(text, "0x%08X", (int)(0x6000000 + 0x800*((bgcnt>>8)&0x1F) + win->lcd*0x200000 + ((dispcnt>>27)&7)*0x10000));
|
||||
SetWindowText(GetDlgItem(hwnd, IDC_SCR), text);
|
||||
|
||||
//sprintf(text, "%d x %d", MainScreen.gpu->BGPA[win->map], MainScreen.gpu->BGPB[win->map]);
|
||||
sprintf(text, "%d x %d", (int)MainScreen.gpu->BGSize[win->map][0], (int)MainScreen.gpu->BGSize[win->map][1]);
|
||||
SetWindowText(GetDlgItem(hwnd, IDC_MSIZE), text);
|
||||
|
||||
if (win->map==2) {
|
||||
parms = &(MainScreen.gpu->dispx_st)->dispx_BG2PARMS;
|
||||
} else {
|
||||
parms = &(MainScreen.gpu->dispx_st)->dispx_BG3PARMS;
|
||||
{
|
||||
switch(win->map)
|
||||
{
|
||||
case 0 :
|
||||
sprintf(text, "extended slot %d", (bgcnt&(1<<13))?2:0);
|
||||
break;
|
||||
case 1 :
|
||||
sprintf(text, "extended slot %d", (bgcnt&(1<<13))?3:1);
|
||||
break;
|
||||
default :
|
||||
sprintf(text, "extended slot %d", MainScreen.gpu->BGExtPalSlot[win->map]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
sprintf(text, "%d x %d", parms->BGxPC, parms->BGxPD);
|
||||
SetWindowText(GetDlgItem(hwnd, IDC_SCROLL), text);
|
||||
|
||||
for(int i = 0; i < (1024*1024); i++)
|
||||
win->bitmap[i] = 0x7C1F;
|
||||
}
|
||||
SetWindowText(GetDlgItem(hwnd, IDC_PAL), text);
|
||||
|
||||
win->render();
|
||||
sprintf(text, "%d", (int)(bgcnt&3));
|
||||
SetWindowText(GetDlgItem(hwnd, IDC_PRIO), text);
|
||||
|
||||
SetDIBitsToDevice(hdc, 200, 4, lg, ht, 0, 0, 0, ht, win->bitmap, (BITMAPINFO*)&bmi, DIB_RGB_COLORS);
|
||||
|
||||
EndPaint(hwnd, &ps);
|
||||
|
||||
return 0;
|
||||
if((dispcnt>>8>>win->map)&1)
|
||||
SetWindowText(GetDlgItem(hwnd, IDC_VISIBLE), "true");
|
||||
else
|
||||
SetWindowText(GetDlgItem(hwnd, IDC_VISIBLE), "false");
|
||||
|
||||
sprintf(text, "0x%08X", (int)(0x6000000 + ((bgcnt>>2)&0xF)*0x4000 + win->lcd*0x200000 +((dispcnt>>24)&7)*0x10000));
|
||||
SetWindowText(GetDlgItem(hwnd, IDC_CHAR), text);
|
||||
|
||||
sprintf(text, "0x%08X", (int)(0x6000000 + 0x800*((bgcnt>>8)&0x1F) + win->lcd*0x200000 + ((dispcnt>>27)&7)*0x10000));
|
||||
SetWindowText(GetDlgItem(hwnd, IDC_SCR), text);
|
||||
|
||||
//sprintf(text, "%d x %d", MainScreen.gpu->BGPA[win->map], MainScreen.gpu->BGPB[win->map]);
|
||||
sprintf(text, "%d x %d", (int)MainScreen.gpu->BGSize[win->map][0], (int)MainScreen.gpu->BGSize[win->map][1]);
|
||||
SetWindowText(GetDlgItem(hwnd, IDC_MSIZE), text);
|
||||
|
||||
if (win->map==2) {
|
||||
parms = &(MainScreen.gpu->dispx_st)->dispx_BG2PARMS;
|
||||
} else {
|
||||
parms = &(MainScreen.gpu->dispx_st)->dispx_BG3PARMS;
|
||||
}
|
||||
sprintf(text, "%d x %d", parms->BGxPC, parms->BGxPD);
|
||||
SetWindowText(GetDlgItem(hwnd, IDC_SCROLL), text);
|
||||
|
||||
for(int i = 0; i < ARRAY_SIZE(win->bitmap); i++)
|
||||
win->bitmap[i] = 0x7C1F;
|
||||
|
||||
win->render();
|
||||
|
||||
if(win->clear)
|
||||
{
|
||||
RECT r;
|
||||
r.left = 200;
|
||||
r.top = 4;
|
||||
r.right = 200 + 1024;
|
||||
r.bottom = 200 + 1024;
|
||||
HBRUSH brush = CreateSolidBrush(GetSysColor(COLOR_3DFACE));
|
||||
FillRect(hdc, &r, brush);
|
||||
DeleteObject(brush);
|
||||
win->clear = false;
|
||||
}
|
||||
|
||||
SetDIBitsToDevice(hdc, 200, 4, lg, ht, 0, 0, 0, ht, win->bitmap, (BITMAPINFO*)&bmi, DIB_RGB_COLORS);
|
||||
|
||||
EndPaint(hwnd, &ps);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL CALLBACK ViewMapsProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
@ -180,119 +194,121 @@ BOOL CALLBACK ViewMapsProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lPara
|
|||
return false;
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case WM_INITDIALOG :
|
||||
{
|
||||
MapView = new mapview_struct;
|
||||
memset(MapView, 0, sizeof(MapView));
|
||||
MapView->autoup_secs = 1;
|
||||
SendMessage(GetDlgItem(hwnd, IDC_AUTO_UPDATE_SPIN),
|
||||
UDM_SETRANGE, 0, MAKELONG(99, 1));
|
||||
SendMessage(GetDlgItem(hwnd, IDC_AUTO_UPDATE_SPIN),
|
||||
UDM_SETPOS32, 0, MapView->autoup_secs);
|
||||
HWND combo = GetDlgItem(hwnd, IDC_BG_SELECT);
|
||||
SendMessage(combo, CB_ADDSTRING, 0,(LPARAM)"Main BackGround 0");
|
||||
SendMessage(combo, CB_ADDSTRING, 0,(LPARAM)"Main BackGround 1");
|
||||
SendMessage(combo, CB_ADDSTRING, 0,(LPARAM)"Main BackGround 2");
|
||||
SendMessage(combo, CB_ADDSTRING, 0,(LPARAM)"Main BackGround 3");
|
||||
SendMessage(combo, CB_ADDSTRING, 0,(LPARAM)"Sub BackGround 0");
|
||||
SendMessage(combo, CB_ADDSTRING, 0,(LPARAM)"Sub BackGround 1");
|
||||
SendMessage(combo, CB_ADDSTRING, 0,(LPARAM)"Sub BackGround 2");
|
||||
SendMessage(combo, CB_ADDSTRING, 0,(LPARAM)"Sub BackGround 3");
|
||||
SendMessage(combo, CB_SETCURSEL, 0, 0);
|
||||
}
|
||||
return 1;
|
||||
case WM_CLOSE :
|
||||
{
|
||||
case WM_INITDIALOG :
|
||||
{
|
||||
MapView = new mapview_struct;
|
||||
memset(MapView, 0, sizeof(MapView));
|
||||
MapView->clear = true;
|
||||
MapView->autoup_secs = 1;
|
||||
SendMessage(GetDlgItem(hwnd, IDC_AUTO_UPDATE_SPIN),
|
||||
UDM_SETRANGE, 0, MAKELONG(99, 1));
|
||||
SendMessage(GetDlgItem(hwnd, IDC_AUTO_UPDATE_SPIN),
|
||||
UDM_SETPOS32, 0, MapView->autoup_secs);
|
||||
HWND combo = GetDlgItem(hwnd, IDC_BG_SELECT);
|
||||
SendMessage(combo, CB_ADDSTRING, 0,(LPARAM)"Main BackGround 0");
|
||||
SendMessage(combo, CB_ADDSTRING, 0,(LPARAM)"Main BackGround 1");
|
||||
SendMessage(combo, CB_ADDSTRING, 0,(LPARAM)"Main BackGround 2");
|
||||
SendMessage(combo, CB_ADDSTRING, 0,(LPARAM)"Main BackGround 3");
|
||||
SendMessage(combo, CB_ADDSTRING, 0,(LPARAM)"Sub BackGround 0");
|
||||
SendMessage(combo, CB_ADDSTRING, 0,(LPARAM)"Sub BackGround 1");
|
||||
SendMessage(combo, CB_ADDSTRING, 0,(LPARAM)"Sub BackGround 2");
|
||||
SendMessage(combo, CB_ADDSTRING, 0,(LPARAM)"Sub BackGround 3");
|
||||
SendMessage(combo, CB_SETCURSEL, 0, 0);
|
||||
}
|
||||
return 1;
|
||||
case WM_CLOSE :
|
||||
{
|
||||
if(MapView->autoup)
|
||||
{
|
||||
if(MapView->autoup)
|
||||
{
|
||||
KillTimer(hwnd, IDT_VIEW_MAP);
|
||||
MapView->autoup = false;
|
||||
}
|
||||
if (MapView!=NULL)
|
||||
{
|
||||
delete MapView;
|
||||
MapView = NULL;
|
||||
}
|
||||
//INFO("Close Map view dialog\n");
|
||||
PostQuitMessage(0);
|
||||
return 0;
|
||||
KillTimer(hwnd, IDT_VIEW_MAP);
|
||||
MapView->autoup = false;
|
||||
}
|
||||
case WM_PAINT:
|
||||
MapView_OnPaint(MapView, hwnd, wParam, lParam);
|
||||
return 1;
|
||||
case WM_TIMER:
|
||||
SendMessage(hwnd, WM_COMMAND, IDC_REFRESH, 0);
|
||||
if (MapView!=NULL)
|
||||
{
|
||||
delete MapView;
|
||||
MapView = NULL;
|
||||
}
|
||||
//INFO("Close Map view dialog\n");
|
||||
PostQuitMessage(0);
|
||||
return 0;
|
||||
}
|
||||
case WM_PAINT:
|
||||
MapView_OnPaint(MapView, hwnd, wParam, lParam);
|
||||
return 1;
|
||||
case WM_TIMER:
|
||||
SendMessage(hwnd, WM_COMMAND, IDC_REFRESH, 0);
|
||||
return 1;
|
||||
case WM_COMMAND :
|
||||
switch (LOWORD (wParam))
|
||||
{
|
||||
case IDC_FERMER :
|
||||
SendMessage(hwnd, WM_CLOSE, 0, 0);
|
||||
return 1;
|
||||
case IDC_AUTO_UPDATE :
|
||||
if(MapView->autoup)
|
||||
{
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_AUTO_UPDATE_SECS), false);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_AUTO_UPDATE_SPIN), false);
|
||||
KillTimer(hwnd, IDT_VIEW_MAP);
|
||||
MapView->autoup = FALSE;
|
||||
return 1;
|
||||
case WM_COMMAND :
|
||||
switch (LOWORD (wParam))
|
||||
{
|
||||
case IDC_FERMER :
|
||||
SendMessage(hwnd, WM_CLOSE, 0, 0);
|
||||
return 1;
|
||||
case IDC_AUTO_UPDATE :
|
||||
if(MapView->autoup)
|
||||
{
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_AUTO_UPDATE_SECS), false);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_AUTO_UPDATE_SPIN), false);
|
||||
KillTimer(hwnd, IDT_VIEW_MAP);
|
||||
MapView->autoup = FALSE;
|
||||
return 1;
|
||||
}
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_AUTO_UPDATE_SECS), true);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_AUTO_UPDATE_SPIN), true);
|
||||
MapView->autoup = TRUE;
|
||||
SetTimer(hwnd, IDT_VIEW_MAP, MapView->autoup_secs*20, (TIMERPROC) NULL);
|
||||
return 1;
|
||||
case IDC_AUTO_UPDATE_SECS:
|
||||
{
|
||||
int t = GetDlgItemInt(hwnd, IDC_AUTO_UPDATE_SECS, FALSE, TRUE);
|
||||
if (!MapView)
|
||||
{
|
||||
SendMessage(hwnd, WM_INITDIALOG, 0, 0);
|
||||
}
|
||||
if (t != MapView->autoup_secs)
|
||||
{
|
||||
MapView->autoup_secs = t;
|
||||
if (MapView->autoup)
|
||||
SetTimer(hwnd, IDT_VIEW_MAP,
|
||||
MapView->autoup_secs*20, (TIMERPROC) NULL);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
case IDC_REFRESH:
|
||||
InvalidateRect(hwnd, NULL, FALSE);
|
||||
return 1;
|
||||
case IDC_BG_SELECT :
|
||||
switch(HIWORD(wParam))
|
||||
{
|
||||
case CBN_SELCHANGE :
|
||||
case CBN_CLOSEUP :
|
||||
{
|
||||
u32 sel= SendMessage(GetDlgItem(hwnd, IDC_BG_SELECT), CB_GETCURSEL, 0, 0);
|
||||
switch(sel)
|
||||
{
|
||||
case 0 :
|
||||
case 1 :
|
||||
case 2 :
|
||||
case 3 :
|
||||
MapView->map = sel;
|
||||
MapView->lcd = 0;
|
||||
break;
|
||||
case 4 :
|
||||
case 5 :
|
||||
case 6 :
|
||||
case 7 :
|
||||
MapView->map = sel-4;
|
||||
MapView->lcd = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
InvalidateRect(hwnd, NULL, FALSE);
|
||||
return 1;
|
||||
}//switch et case
|
||||
}//switch
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_AUTO_UPDATE_SECS), true);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_AUTO_UPDATE_SPIN), true);
|
||||
MapView->autoup = TRUE;
|
||||
SetTimer(hwnd, IDT_VIEW_MAP, MapView->autoup_secs*20, (TIMERPROC) NULL);
|
||||
return 1;
|
||||
case IDC_AUTO_UPDATE_SECS:
|
||||
{
|
||||
int t = GetDlgItemInt(hwnd, IDC_AUTO_UPDATE_SECS, FALSE, TRUE);
|
||||
if (!MapView)
|
||||
{
|
||||
SendMessage(hwnd, WM_INITDIALOG, 0, 0);
|
||||
}
|
||||
if (t != MapView->autoup_secs)
|
||||
{
|
||||
MapView->autoup_secs = t;
|
||||
if (MapView->autoup)
|
||||
SetTimer(hwnd, IDT_VIEW_MAP,
|
||||
MapView->autoup_secs*20, (TIMERPROC) NULL);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
case IDC_REFRESH:
|
||||
InvalidateRect(hwnd, NULL, FALSE);
|
||||
return 1;
|
||||
case IDC_BG_SELECT :
|
||||
switch(HIWORD(wParam))
|
||||
{
|
||||
case CBN_SELCHANGE :
|
||||
case CBN_CLOSEUP :
|
||||
{
|
||||
u32 sel= SendMessage(GetDlgItem(hwnd, IDC_BG_SELECT), CB_GETCURSEL, 0, 0);
|
||||
switch(sel)
|
||||
{
|
||||
case 0 :
|
||||
case 1 :
|
||||
case 2 :
|
||||
case 3 :
|
||||
MapView->map = sel;
|
||||
MapView->lcd = 0;
|
||||
break;
|
||||
case 4 :
|
||||
case 5 :
|
||||
case 6 :
|
||||
case 7 :
|
||||
MapView->map = sel-4;
|
||||
MapView->lcd = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
MapView->clear = true;
|
||||
InvalidateRect(hwnd, NULL, FALSE);
|
||||
return 1;
|
||||
}//switch et case
|
||||
}//switch
|
||||
return 1;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue